1417 Commits

Author SHA1 Message Date
Sheetal Nandi
e21738c351 Store package.json for the directories in buildinfo 2022-12-09 14:49:30 -08:00
Sheetal Nandi
5c11252b71 Add tests for package json edits 2022-12-09 14:49:30 -08:00
Sheetal Nandi
7de47805fe Use the hashes to verify the affecting location before using the resolution 2022-12-09 14:49:29 -08:00
Sheetal Nandi
e1ed9ea312 Store package json hash in buildinfo 2022-12-09 14:49:29 -08:00
Sheetal Nandi
6261b6cf67 Add tests where cache resoluition is incorrectly used because of not checking affected locations 2022-12-09 14:49:28 -08:00
Sheetal Nandi
2219b5dc95 Start using cache as perDirectory lookup 2022-12-09 14:49:27 -08:00
Sheetal Nandi
84cda33850 More tests for cache reuse directory structure 2022-12-09 14:49:27 -08:00
Sheetal Nandi
feb3220299 Tests for unresolved imports from multiple places 2022-12-09 14:49:26 -08:00
Sheetal Nandi
71ebed9c00 Modify resolution cache to update on program creation completion 2022-12-09 14:49:26 -08:00
Sheetal Nandi
591960edb0 Set old program build info as a location to look for from module resolution caches 2022-12-09 14:49:25 -08:00
Sheetal Nandi
0446430aaa Add tests where module resolution caches should reuse the resolutions from buildInfo 2022-12-09 14:49:24 -08:00
Sheetal Nandi
959206d3e9 Do not store failed lookups with cacheResolution option if it is resolved to a file since they do not matter 2022-12-09 14:49:23 -08:00
Sheetal Nandi
ce07d0e961 Handle resolutions that would be same in ancestor directory and can be derived through ancestor map 2022-12-09 14:49:22 -08:00
Sheetal Nandi
d55ab98d59 Test for module resolutions from different directories 2022-12-09 14:49:22 -08:00
Sheetal Nandi
0132dc0b1d Handle project reference redirects for the module and type reference resolutions 2022-12-09 14:49:21 -08:00
Sheetal Nandi
1eeea260d6 Store resolved module and type reference resolution cache in buildinfo 2022-12-09 14:49:19 -08:00
Sheetal Nandi
666eece8cc Add tests 2022-12-09 14:49:19 -08:00
Sheetal Nandi
e1600ab800 Add baselining of modules and type refs 2022-12-09 14:49:18 -08:00
Sheetal Nandi
3716ffe748
Make getSupportedCodeFixes on LS so it can be proxied by plugins (#51769)
Fixes #28966
2022-12-08 09:52:25 -08:00
Sheetal Nandi
832a6e45a7
Unify verifyTsc and verifyTscWithEdits and make them look like verifyTscWatch for easy copy paste (#51798)
* Make edits optional in verifyTscWatch

* Unify verifyTsc and verifyTscWithEdits and make them look like verifyTscWatch
2022-12-06 17:18:31 -08:00
Sheetal Nandi
e0293b5877
Instead of computing signatures during building, compute them afterwards for verification (#51718)
This helps with finding issues with d.ts emit because of caching.
2022-12-06 16:55:08 -08:00
Sheetal Nandi
38f33ade06
Use non relative name cache for type reference resolutions and API updates (#51732)
* Make the non relative name resolution cache generic

* Add cache for non relative type reference resolution

* Add getter only methods so we can use these in future for sharing resolutions across the projects

* Mark existing non relative module name cache getOrCreate as deprecated

* Prefer getters for getting directory results
2022-12-06 14:22:03 -08:00
Jake Bailey
703652cebf
Remove some files from the repo root (#51446) 2022-12-06 13:42:54 -08:00
Daniel Rosenwasser
3c99d50da5
Replace a few type assertions with annotations and satisfies. (#51685) 2022-12-06 11:52:17 -08:00
Nathan Shively-Sanders
5bb204e321
Remove webServer (#51699)
* Remove webServer

First draft; I may move some things around to be more readable.

* Refactor moved code

1. Move StartSessionOptions to common next to where it's first used.
2. Inline single-use BaseLogger base class into its only child class,
Logger.
3. Start using direct imports, eg `import {} from './common'`. I hope
this is OK?!

* Fix lint

* move imports back to namespace import

* hereby tsserver: remove exportIsTsObject
2022-12-06 08:41:01 -08:00
Sheetal Nandi
9e845d2248
Api cleanup for Module and Type Reference directive resolution (#51546)
* Refactoring so CacheWithRedirects has Key and Value type parameters

* ModuleResolutionCache or TypeRefDirectiveCache will look in directory before solving, so ResolutionCache doesnt need this check

* Test showing module resolution is not shared because resolution cache doesnt update own options

* Enable traceResolution on some of the project reference tests

* Simplify CacheWithRedirects and ensure the options are set in all common scenarios so cache can be shared between redirects

* Make failedlookup etc optional in ResolvedModule/TypeRefefWithFailedLookupLocations
Also make accidental public failed lookup internal

* Add new API for module and type ref resolution

* Store auto type reference resolutions

* Modify test to show how using program partially doesnt report resolution diagnostics

* Ensure that resolution diagnostics are reported in filePreocessingDiagnostics so they can be reused when program is reused

* Some cleanup

* Remove the newly added ReoslutionInfo in favor of new APIs

* update
2022-12-05 11:56:33 -08:00
Sheetal Nandi
7b7f6a75ea
Code refactoring for module resolution api (#51675)
* Refactoring so CacheWithRedirects has Key and Value type parameters

* ModuleResolutionCache or TypeRefDirectiveCache will look in directory before solving, so ResolutionCache doesnt need this check

* Test showing module resolution is not shared because resolution cache doesnt update own options

* Enable traceResolution on some of the project reference tests

* Simplify CacheWithRedirects and ensure the options are set in all common scenarios so cache can be shared between redirects
2022-12-01 10:17:58 -08:00
Sheetal Nandi
16edc29bc9
Handle empty string when getting file version (#51689)
* Test for empty string change

* Fix empty string for file versioning
2022-11-30 10:30:32 -08:00
Sheetal Nandi
c2519bb301
When there is no change in file text for program, no need to update program (#51626)
* When fsEvent for change is repeated

* When trying to check if program is uptodate, read the files from disk to determine the version instead of delaying so that new program is not created if file contents have not changed
2022-11-29 12:20:41 -08:00
Sheetal Nandi
af36a859b9
Fix the crash when affected file pending emit is not in program is being serialized into buildInfo (#51674)
Fixes #51641
2022-11-29 12:20:09 -08:00
Sheetal Nandi
59e659ac4a
More test cleanup/baselining for future changes (#51635)
* More test cleanup/baselining for future changes

* More cleanup

* More cleanup

* Make the reuse program structure stable for each test
2022-11-28 15:49:08 -08:00
Sheetal Nandi
c1427c90b6
Convert reuse program structure and tracing of module resolution to baseline for easier updates (#51628)
* Modify all usages of file name lower casing to use custom lower casing method

* Baseline reuse program structure tests for easy update when making changes to module resolution
2022-11-22 20:58:21 -08:00
Jake Bailey
00dc0b6674
Flip imports to case insensitive sorting (#51579) 2022-11-17 15:35:28 -08:00
Jake Bailey
2d2a4343b8
Reformat imports to be one identifier per line (#51565) 2022-11-17 13:42:18 -08:00
Anders Hejlsberg
7b85cd6b72
Numeric literals assignable to enum literals only when values match (#51561)
* Numeric literal assignable to enum literal only when values match

* Accept new baselines

* Update compiler sources

* Accept new baselines

* Fix test runner

* Any numeric literal type is assignable to a computed numeric enum type
2022-11-16 18:56:01 -08:00
Sheetal Nandi
2f2a17ad0b
Removing some unnecessary methods from host and function parameters (#51499) 2022-11-15 17:34:58 -08:00
Jake Bailey
4d53a1f8f1
Move deprecate from Debug to deprecatedCompat (#51522) 2022-11-15 16:00:33 -08:00
Tomasz Lenarcik
dfc1242aaf
Fix asyncDelegator reporting "done" too early (#51274)
* Fix asyncDelegator reporting done too early

* Add unit test for yields inside finally block

See #45400
2022-11-15 18:12:26 -05:00
Andrew Branch
3fcd1b51a1
Refactor module resolution Extensions, fix lookup priorities (#51471)
* Refactor `Extensions`, fix lookup priorities

* Update baselines

* Clean up

* Temporarily apply same fix to `node` for testing

* Revert ancestor node_modules lookups back to two passes

* Revert "Temporarily apply same fix to `node` for testing"

This reverts commit 4014f3005a2a01a5c71a88e6418cc635498a83bc.

* Update baselines

* Add new test for node_modules searching behavior

* Update new baseline
2022-11-15 14:18:11 -08:00
Sheetal Nandi
3eafb64faf
Handle reusing type reference resolution in resolution cache correctly (#51475)
* Add tests where typeRef resolution is not in the cache

* Ensure that type ref reuse is actually handled since type ref resolution only sends containingSourceFileMode and not containingSourceFile
2022-11-10 16:03:25 -08:00
Sheetal Nandi
57a916c455
Emit buildinfo if file deleted isnt global (#51472)
* Add test for when file is deleted

* Emit buildinfo if file deleted isnt global
2022-11-09 18:07:17 -08:00
Jake Bailey
9f64a3a58c
Remove ts.{Map,Set,ESMap,Iterator} and associated types (#51439) 2022-11-09 15:06:31 -08:00
Jake Bailey
d798493647
Remove no-unnecessary-qualifier from eslintrc (#51456) 2022-11-09 15:02:29 -08:00
Sheetal Nandi
6e0a62e8dd
Detangle unittests to reference helpers directly (#51450)
* Remove unnecessary redirection now that we are not in namespaces

* Move the tsc helpers in one place

* Move virtual file system with watch in unittests folder instead of harness since harness doesnt use it anyways

* Replace protocol and commandNames

* Revert incorrect pick
2022-11-09 10:02:40 -08:00
Sheetal Nandi
48aebcdcdb
TypeReference directive reuse (#49750) 2022-11-07 15:15:11 -08:00
Jake Bailey
776907cd4d Add ts to globalThis in run.js for convenience during debugging
In namespaces, we'd have access to a variable named "ts" when debugging,
because that was just the ts namespace in the current file. But when
modules, that variable doesn't exist, either because we are pure modules
(so no ts variable), or named something else (when bundled, for export).

Tack a "ts" object onto the globals, which should make this easier. Of
course, someone may eventually declare a variable in the top level scope
named "ts" and break this, but we can cross that bridge when we come to
it.
2022-11-07 13:35:48 -08:00
Jake Bailey
4139807e75 Add build via esbuild
This configures the existing build tasks to use esbuild by default. If
using the plain files is desired, passing `--bundle=false` will build
using plain files and still produce a runnable system.

This is only a basic build; a more efficient build is provided later
when gulp is replaced by hereby.
2022-11-07 13:34:44 -08:00
Jake Bailey
36e29448e9 Get codebase building pre bundling
This isn't totally complete, but enough to get everything building and
tests running manually. The next commit will make the build work fully.
2022-11-07 13:34:44 -08:00
Jake Bailey
01e5200096 Convert require calls to imports
Although the existing require calls would work fine, it's more
consistent to make them actual imports and let them be converted at
compile/bundle time. It also lets us emit ESM if needed.

There are still conditional requires present for things like the node
System, but that's a more difficult problem to solve.
2022-11-07 13:34:44 -08:00
Jake Bailey
39e27fbb6b Fix up linting, make lint clean
Now that we are modules, there's no reason to ban multiple namespaces
per file; each file is its own scope and declaring a namespace won't
merge it into any other files.
2022-11-07 13:33:07 -08:00