Commit graph

195 commits

Author SHA1 Message Date
Andrew Casey 7fc1cb4b36
Use realpathSync.native on case-insensitive file systems (#44966)
* Make getSourceOfProjectReferenceRedirect take a Path

* Add useCaseSensitiveFileNames to ModuleResolutionHost

...so that path comparisons can use it during module resolution.

* Re-enable realpathSync.native for case-insensitive file systems
2021-08-26 15:35:04 -07:00
Andrew Branch 30103de1dd
Let AutoImportProviderProject resolve JS when allowJs and maxNodeModulesJsDepth allows (#45524)
* Let AutoImportProviderProject resolve JS when allowJs and maxNodeModulesJsDepth allows

* Simplify function
2021-08-25 15:06:14 -07:00
Wesley Wigham 8e855d140b
Watch mode watches for changes in package.json files used in resolution (#44935)
* watch mode watches for changes in package.json files used in resolution

* Pathify result of realpath

* Actually accept pathified baselines
2021-07-12 17:23:08 -07:00
Andrew Casey 3ffa245f07
Cache parsed path mapping patterns (#44078)
* Cache parsed path mapping patterns

If a project has many of them (e.g. 1800), parsing the patterns
repeatedly can take up a lot of time.

* Move cache to ConfigFileSpecs

* Inline constants

* Simplify cache access
2021-05-26 09:40:42 -07:00
Sheetal Nandi cfed79b7a2
Correctly use ownMap from module resolution cache (#43986)
* Test showing the moduleResolutionCache reset issue with tsc --b --w

* Fix incorrect usage of ownMap by making it function returning ownMap instead of constant value
2021-05-07 09:56:29 -07:00
Andrew Branch 96c48b746a
Fix package.json auto imports for pnpm without project references (#43892)
* Fix package.json auto imports for pnpm without project references

* Make property optional

* Revert unnecessary unnittest change

* Set symlinked files when setting symlinked directories

* Update `typeDirectiveIsEqualTo`

* Consider symlinks found during type reference directive resolution into `discoverProbableSymlinks`

* Rename `originalFileName` to `originalPath`, make internal
2021-05-06 14:51:30 -07:00
Sheetal Nandi 233f28ca27
When directory watcher is invoked with any file from node_modules package, invalidate for file paths in that package (#43974)
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-05-06 09:48:26 -07:00
Sheetal Nandi f6d425e1e3
Module Resolution and Type Reference directive cache updates and its API changes (#43700)
* Make the module resolution cache apis for updating compiler options or clearing it

* Cache package.json lookup results from module resolution

* Use per directory cache for type reference directive resolution as well

* Update Baselines and/or Applied Lint Fixes

* Change trace according to feedback

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-04-21 21:30:18 -07:00
Sheetal Nandi d36df0dda5
Try file if matched pattern specifies the extension instead of all the time (#42246)
* Test case for path mapping with extension

* Try file if matched pattern specifies the extension instead of all the time
Fixes #39743
2021-01-08 12:03:29 -08:00
Song Gao 8cbc576954
Fix #41800 correctly. (#41895)
* fix as suggestion.

* Update moduleSpecifiers.ts

* compare symbol rather than string

* fix typo.

* fix

* fix lint.

* better name and more clear code

* fix comment.

Co-authored-by: Orta Therox <git@orta.io>
2020-12-16 18:56:18 -08:00
Song Gao 37e898cfd7
import statement from "node" in js source file could produce correct declaration path. (#41816)
* fix #41800

* add test

* fix test
2020-12-07 13:54:47 +00:00
inokawa d57954345b
Fix typos (#41723) 2020-12-01 13:46:41 -08:00
Andrew Branch 575baf5c7f
Support auto-import from paths alias without baseUrl (#40546) 2020-09-14 15:23:47 -07:00
Andrew Branch 9c8d11b5ed
Allow 'paths' without 'baseUrl' (#40101)
* Allow paths without baseUrl

* Remove exception for leading * paths

* Add comment, remove commented code

* Update baselines

* Remove unnecessary default

* Fix test harness

* Fix baseline

* Resolve relative to host.getCurrentDirectory() with createProgram API
2020-09-11 12:58:40 -07:00
Ron Buckton 9d5cd280ef Merge branch 'master' into migrateMapsAndSets
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/commandLineParser.ts
#	src/compiler/core.ts
#	src/compiler/moduleNameResolver.ts
#	src/compiler/transformers/declarations.ts
#	src/compiler/tsbuildPublic.ts
#	src/compiler/types.ts
#	src/compiler/utilities.ts
#	src/harness/client.ts
#	src/server/editorServices.ts
#	src/server/typingsCache.ts
#	src/server/utilities.ts
#	src/services/codefixes/convertToAsyncFunction.ts
#	src/services/documentRegistry.ts
#	src/services/importTracker.ts
#	src/services/refactorProvider.ts
#	src/services/refactors/extractSymbol.ts
#	src/testRunner/unittests/programApi.ts
#	src/typingsInstallerCore/typingsInstaller.ts
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2020-07-07 13:53:46 -07:00
Ron Buckton 7b942b4fa8
Revert the type change to ts.Map (#39366) 2020-07-01 17:00:26 -07:00
Ron Buckton 611b77f2e6 Migrate more places to use Map/Set 2020-06-26 10:15:53 -07:00
Ron Buckton eb2f4e2337
Switch to ES Map/Set internally (#33771)
* Add full implemention of Map and Set to shims

* Update default Map interface

* Remove WeakMap/WeakSet

* Add tests for set shim

* Update most usages of Map<K, true> to Set

* PR Feedback

* Fix lint issues

* Change key in fsWatchCallback

* Simpler shim, more tests

* Fix typo in collection shim
2020-06-26 10:12:47 -07:00
Sheetal Nandi 1a9c8197ff
Optimize module resolution cache for watch and editor (#37055)
* Refactor resolveName

* Have resolutions of failed lookups as array and resolved to fileName map
2020-03-11 14:35:26 -07:00
Ron Buckton 6769313eee
Fix potential leaks in checker (#36491) 2020-01-28 16:48:28 -08:00
Wesley Wigham 85ec9bf175
Remove duplicate definition of Push (#35397)
It's also defined in `corePublic.ts` - there's no errors because they're (almost) identical and merge (creating a redundant overload for `push`). Ironically, while this definition was internal, the other is public (and more complete).
2019-12-02 11:47:42 -08:00
Alexander T fd72a1c76b @typescript-eslint/unified-signatures 2019-08-19 13:38:58 +03:00
Alexander 481d70d50d Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-07 21:23:10 +03:00
Michael Crane 7d44a4592e Remove try-finally blocks 2019-08-02 16:39:33 -07:00
Michael Crane fa3e9c86db Add PerfLogger and NullLogger to simplify conditional logic 2019-08-01 12:46:33 -07:00
Bill Ticehurst 996e7e50d5 Use optional module "@microsoft/typescript-etw" for ETW logging 2019-07-29 15:32:40 -07:00
Alexander T 2c32308f35 no-null/no-null 2019-07-18 10:50:38 +03:00
Alexander T 769bb0b475 remove tslint configuration 2019-06-27 13:49:35 +03:00
Alexander 7389200ce2 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-06-23 18:49:35 +03:00
Wesley Wigham 37b20f6afd
Eliminate references to defunct LSHost in comments (#32018) 2019-06-20 19:11:46 -07:00
Alexander T 39c7e9a360 @typescript-eslint/unified-signatures 2019-06-20 11:47:12 +03:00
Ron Buckton dfd28d2751
Fix handling of empty 'types', 'typings', etc. fields in package.json (#31539) 2019-05-23 17:19:32 -07:00
Sheetal Nandi 5d188a8c68 Always use resolved file to figure out subModule name in package id
Fixes #30429
2019-05-22 14:30:56 -07:00
Sheetal Nandi 85d3c5d7a1 Trace Package id at the module resolution site 2019-05-22 12:35:20 -07:00
Sheetal Nandi 94ee0dc769
Merge pull request #31100 from Microsoft/tsBuildCacheModuleResolution
Cache module resolutions across tsbuild to be able to resolve the modules faster
2019-04-26 07:33:59 -07:00
Andy Hanson aafba363e4 Avoid recalculating versionPaths in loadNodeModuleFromDirectory (#27537)
* Avoid recalculating versionPaths in loadNodeModuleFromDirectory

* Update baselines
2019-04-25 11:06:31 -07:00
Sheetal Nandi 93b958e0ea Share module resolution cache among different program 2019-04-24 12:47:01 -07:00
Sheetal Nandi 3264b64f08 Reuse map if module resolution is same for redirected and own files 2019-04-24 11:57:59 -07:00
EECOLOR 1a9c20949e path mappings now supports rooted disk paths and urls - fixes #13730 2018-11-07 22:19:04 +01:00
Wesley Wigham 05716a74a5
Add support for configuration inheritance via packages (#27348)
* Add support for configuration inheritance via packages

* Fix lint

* Propagate trace into config parse hosts
2018-10-25 10:19:57 -07:00
Andy 72244c5b03
Support 'isSourceFileFromExternalLibrary' for source files from '/// <reference types="" />'' (#28004)
* Support 'isSourceFileFromExternalLibrary' for source files from '/// <reference types="" />''

* Calculate `isExternalLibraryImport` at the end

* Calculate isExternalLibraryImport with symlink path
2018-10-19 18:00:45 -07:00
Sheetal Nandi 6923f2cdb0 Handle caching of module resolution depending on project references 2018-10-04 15:04:11 -07:00
Sheetal Nandi 0e4b10d726 Use resolution options of project reference if the file is from the project reference 2018-10-04 15:04:10 -07:00
Andy 9bdd6a3b55
Support loading "index.d.ts" using "typesVersions" without "types", "typings", or "main" (#27514)
* Support loading "index.d.ts" using "typesVersions" without "types", "typings", or "main"

* Update baseline
2018-10-03 11:44:16 -07:00
Sheetal Nandi ee04b8c7f3 Handle the case of failed lookup location being not normalized.
Also fixed issue where type defs with relative name didnt resolve when directoryExists is present on the host
Fixes #27405
2018-09-28 14:40:34 -07:00
Valera Rozuvan 8bd7f4e3f8 Fix 27086. Ignore directories starting with a dot. 2018-09-23 14:48:48 +03:00
Andy c57ff087d6
Add codefix to generate types for untyped module (#26588) 2018-09-18 11:47:29 -07:00
Nathan Shively-Sanders 64d0e0d448
Shorten more internal names to JS or TS (#27080) 2018-09-13 15:05:57 -07:00
Nathan Shively-Sanders 6bd1da20c9
Rename JS-specific concepts (#26795)
* Rename JS concepts

1. Assignment declaration -- an assignment that is treated like a
declaration. Previously called [JS] special (assignment|declaration),
among other things.
2. Expando -- a value that can be used as a target in assignment
declarations. Currently, a class, function or empty object literal.
Functions are allowed in Typescript, too. Previously called a JS
container, JS initializer or expando object.
3. JavaScript -> Javascript. This is annoying to type, and looks like
'Java Script' in a camelCase world.

Everything is a pure rename as far as I know. The only test change is
the API baselines, which reflect the rename from SymbolFlags.JSContainer
to SymbolFlags.Assignment.

* Remove TODO

* Rename Javascript->JS

Note that this introduces a variable name collision in a couple of
places, which I resolved like this:

```ts
const isInJavascript = isInJSFile(node);
```
2018-09-12 10:44:46 -07:00
Ron Buckton e726e4cfec PR Feedback 2018-09-05 11:23:39 -07:00