summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
AgeCommit message (Collapse)Author
2024-11-13feat(node): stabilize detecting if CJS via `"type": "commonjs"` in a ↵David Sherret
package.json (#26439) This will respect `"type": "commonjs"` in a package.json to determine if `.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to be ESM it will be loaded as ESM though.
2024-11-04fix(lsp): scope attribution for lazily loaded assets (#26699)Nayeem Rahman
2024-11-01fix: improved support for cjs and cts modules (#26558)David Sherret
* cts support * better cjs/cts type checking * deno compile cjs/cts support * More efficient detect cjs (going towards stabilization) * Determination of whether .js, .ts, .jsx, or .tsx is cjs or esm is only done after loading * Support `import x = require(...);` Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-28fix(check): expose more globals from @types/node (#26603)David Sherret
Extracted out of https://github.com/denoland/deno/pull/26558 Closes https://github.com/denoland/deno/issues/26578
2024-10-25feat(lsp): "typescript.preferences.preferTypeOnlyAutoImports" setting (#26546)Nayeem Rahman
2024-09-18feat(check): turn on noImplicitOverride (#25695)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/11836 Ref https://github.com/denoland/deno/issues/25162
2024-09-17feat(lsp): auto-import types with 'import type' (#25662)Nayeem Rahman
2024-09-14feat: TypeScript 5.6 and `npm:@types/node@22` (#25614)David Sherret
2024-09-13fix(check): move is cjs check from resolving to loading (#25597)David Sherret
This is required to do when loading because TypeScript handles and resolves `/// <reference path="..." />` internally.
2024-09-12refactor: cleanup unstable checks for WebGPU, FFI and FS APIs (#25586)Asher Gomez
Continuation of work in #25488. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-12feat: stabilize `Deno.createHttpClient()` (#25569)Asher Gomez
Closes #25518
2024-09-06feat(lsp): turn on useUnknownInCatchVariables (#25474)Kenta Moriuchi
2024-09-05BREAKING(fs): remove `Deno.funlock[Sync]()` (#25442)Asher Gomez
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-03chore(fs): remove `Deno.flock[Sync]()` (#25350)Asher Gomez
Towards #22079
2024-08-02docs: fix typos (#24820)Andreas Deininger
This PR fixes various typos I spotted in the project.
2024-07-22fix(lsp): scope attribution for asset documents (#24663)Nayeem Rahman
2024-07-10fix(check): CJS types importing dual ESM/CJS package should prefer CJS types ↵David Sherret
(#24492) Closes #16370
2024-06-26feat(lsp): ts language service scopes (#24345)Nayeem Rahman
2024-05-09refactor(lsp): Have JS drive TSC event loop in LSP (#23565)Nathan Whitaker
2024-05-01fix(lsp): Catch cancellation exceptions thrown by TSC, stop waiting for TS ↵Nathan Whitaker
result upon cancellation (#23645) Fixes #23643. We weren't catching the cancellation exception thrown by TSC on the JS side, so the rust side was catching this exception and then attempting to print out the exception via `toString`. That last bit resulted in a cryptic `[object Object]` showing up in the logs like so: ``` Error during TS request "getCompletionEntryDetails": [object Object] ``` I'm not 100% sure how we weren't seeing this in the past. My guess is that #23409 and the subsequent PR to improve the exception catching and logging surfaced this, but I'm still not quite clear on it. My initial fix here returned `null` to rust when a server request was cancelled, but this resulted in a deserialization error when we attempted to deserialize that into the expected response type. So now, as soon as the request's cancellation token signals we'll stop waiting for a response and return an error (which will get swallowed as the LSP request is being cancelled). I was a bit surprised to find that [this branch](https://github.com/nathanwhit/deno/blob/0c671c9792ac706c1ecd60f88efdc5eb8e941917/cli/lsp/tsc.rs#L1093) actually executes sometimes, I believe due to the fact that aborting a future may not [immediately stop its execution](https://docs.rs/futures/latest/futures/stream/struct.AbortHandle.html#method.abort).
2024-04-24chore(lsp): revert respect shouldCreateNewSourceFile (#23535)David Sherret
Reverts https://github.com/denoland/deno/pull/23515 but adds a comment for why this is ignored
2024-04-23fix(lsp): Fix logic for coalescing pending changes + clear script names ↵Nathan Whitaker
cache when file is closed (#23517)
2024-04-23chore(lsp): respect shouldCreateNewSourceFile parameter (#23515)David Sherret
2024-04-22feat: add jsx precompile skip element option (#23457)Marvin Hagemeister
<!-- Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> This PR wires up a new `jsxPrecompileSkipElements` option in `compilerOptions` that can be used to exempt a list of elements from being precompiled with the `precompile` JSX transform.
2024-04-22perf(lsp): Batch "$projectChanged" notification in with the next JS request ↵Nathan Whitaker
(#23451) The actual handling of `$projectChanged` is quick, but JS requests are not. The cleared caches only get repopulated on the next actual request, so just batch the change notification in with the next actual request. No significant difference in benchmarks on my machine, but this speeds up `did_change` handling and reduces our total number of JS requests (in addition to coalescing multiple JS change notifs into one).
2024-04-19perf(lsp): Avoid passing struct into op_resolve (#23452)Nathan Whitaker
Going through serde_v8 is slow, so just pass the args separately. `op_resolve` is especially hot, so any speedups are good.
2024-04-17perf(lsp): release unused documents (#23398)Nayeem Rahman
2024-04-15fix(lsp): improved cjs tracking (#23374)David Sherret
Our cjs tracking was a bit broken. It was marking stuff as esm that was actually cjs leading to type checking errors.
2024-04-15fix(lsp): ensure project version is incremented when config changes (#23366)David Sherret
I'm running into a node resolution bug in the lsp only and while tracking it down I noticed this one. Fixed by moving the project version out of `Documents`.
2024-04-12perf(lsp): Only deserialize response from `op_respond` once (#23349)Nathan Whitaker
Previously we were deserializing it twice - once to `serde_json::Value`, and then again from the `serde_json::Value` to a concrete type
2024-04-11perf(lsp): use a stub module in tsc for failed resolutions (#23313)Nayeem Rahman
2024-04-11perf(lsp): replace document registry source cache on update (#23311)Nayeem Rahman
2024-04-10perf(lsp): Only evict caches on JS side when things actually change (#23293)Nathan Whitaker
Currently we evict a lot of the caches on the JS side of things on every request, namely script versions, script file names, and compiler settings (as of #23283, it's not quite every request but it's still unnecessarily often). This PR reports changes to the JS side, so that it can evict exactly the caches that it needs too. We might want to do some batching in the future so as not to do 1 request per change.
2024-04-08perf(lsp): cache ts config in isolate until new project version (#23283)Nayeem Rahman
2024-04-08perf(lsp): don't pass remote modules as tsc roots (#23259)Nayeem Rahman
2024-04-08Revert "perf(lsp): Don't retain `SourceFileObject`s in `sourceFileCache` ↵Nayeem Rahman
longer than necessary (#23258)" (#23285)
2024-04-06perf(lsp): Don't retain `SourceFileObject`s in `sourceFileCache` longer than ↵Nathan Whitaker
necessary (#23258) The TS language service requests source files via [getSourceFile](https://github.com/nathanwhit/deno/blob/7a25fd5ef0a82c2aac76594ccd467e9210e92b80/cli/tsc/99_main_compiler.js#L560). In that function, we [unconditionally add](https://github.com/nathanwhit/deno/blob/7a25fd5ef0a82c2aac76594ccd467e9210e92b80/cli/tsc/99_main_compiler.js#L613-L614) the source file to our sourceFileCache. The issue is that we only remove things from that cache if the source file [becomes out of date](https://github.com/nathanwhit/deno/blob/7a25fd5ef0a82c2aac76594ccd467e9210e92b80/cli/tsc/99_main_compiler.js#L777-L783). For files that don't get changed, we keep them in the cache indefinitely. So sometimes we keep SourceFile objects from being GC'ed because they're retained in our cache, even though TS doesn't refer to them any more. I see this in pretty much all of the heap snapshots I've taken. --- The fix here is pretty direct - just store weak references to the sourcefiles in the cache. It doesn't really change our caching behavior, it just prevents us from being the only retainer of a `SourceFile`. I also split the `sourceFileCache` into a separate cache just for assets, as we rely on those being alive. The simpler fix is to only cache assets, but presumably that has a perf impact. --- In local testing, this PR reduced the size of the JS heap by about 1 GB when using `deno lsp` in the Typescript repo.
2024-03-29fix(lsp): implement missing ts server host apis (#23131)Nayeem Rahman
2024-03-27fix(check): do not suggest running with `--unstable` (#23092)David Sherret
Closes #23079
2024-03-26refactor(lsp): unify config file data into ConfigTree (#23032)Nayeem Rahman
2024-01-22feat(unstable): remove Deno.upgradeHttp API (#21856)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/21828. This API is a huge footgun. And given that "Deno.serveHttp" is a deprecated API that is discouraged to use (use "Deno.serve()" instead); it makes no sense to keep this API around. This is a step towards fully migrating to Hyper 1.
2024-01-10fix(lsp): implement host.getGlobalTypingsCacheLocation() (#21882)Nayeem Rahman
2024-01-08perf(lsp): use host-owned cache for auto-import completions (#21852)Nayeem Rahman
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-28perf(lsp): use LanguageServiceHost::getProjectVersion() (#21719)Nayeem Rahman
2023-12-12perf(lsp): use null types instead of stub modules (#21541)Nayeem Rahman
2023-12-11perf(lsp): simplify some of the startup code (#21538)Bartek Iwańczuk
Remove some dead code in "99_main_compiler.js". Eagerly start the LSP TSC host, it was adding some not needed complexity around the TSC thread code.
2023-12-06feat: TypeScript 5.3 (#21480)David Sherret
https://github.com/denoland/TypeScript/pull/9
2023-12-03refactor: faster args for op_load in TSC (#21438)Bartek Iwańczuk
This commit changes the argument that "op_load" accepts, from a serde struct to "&str". This should equal to a slightly better performance.
2023-12-02perf(lsp): fix redundant serialization of sources (#21435)Nayeem Rahman