Commit graph

424 commits

Author SHA1 Message Date
David Sherret c03e0f3853
refactor: remove deno_graph::Locker usage (#16877)
This is just a straight refactor and doesn't make any improvements to
the code that could now be made.

Closes #16493
2022-12-06 14:12:51 -05:00
David Sherret 3973ceb634
fix(npm): dependency types were sometimes not being resolved when package had no types entry (#16958)
Closes #16957
2022-12-05 20:09:31 -05:00
阿豪 8b5b327b18
feat(ext/ffi): better type hints for Deno.dlopen (#16874) 2022-12-03 17:45:35 +05:30
Divy Srivastava 9b2b8df927
feat(ops): Fast zero copy string arguments (#16777)
Uses SeqOneByteString optimization to do zero-copy `&str` arguments in
fast calls.

- [x] Depends on https://github.com/denoland/rusty_v8/pull/1129
- [x] Depends on
https://chromium-review.googlesource.com/c/v8/v8/+/4036884
- [x] Disable in async ops
- [x] Make it work with owned `String` with an extra alloc in fast path.
- [x] Support `Cow<'_, str>`. Owned for slow case, Borrowed for fast
case

```rust
#[op]
fn op_string_len(s: &str) -> u32 { 
  str.len() as u32 
}
```
2022-12-02 05:29:15 +00:00
David Sherret b1e29d1bd0
fix(npm): improve package.json exports support for types (#16880) 2022-11-30 23:07:32 +00:00
David Sherret 2d4c46c975
refactor: create util folder, move nap_sym to napi/sym, move http_cache to cache folder (#16857) 2022-11-28 17:28:54 -05:00
Leo Kettmeir 1dd4843b62
feat(unstable): rework Deno.Command (#16812)
Refactors the `Deno.Command` class to not handle any state, but only being an intermediary to calling its methods, and as such any methods and properties besides `output`, `outputSync` & `spawn` have been removed. Interracting with a `spawn`ed subprocess now works by using the methods and properties on the returned class of the `spawn` method.
2022-11-28 12:33:51 +01:00
David Sherret dcb4ffb93a
refactor: move dts files, diagnostics.rs, and tsc.rs to tsc folder (#16820) 2022-11-25 18:29:48 -05:00
David Sherret beaa0d8867
chore: more debug logging and avoid allocating strings in ts logging when not debug (#16689) 2022-11-23 13:34:44 -05:00
Bartek Iwańczuk b70f520ebc
fix: Make npm packages works with import maps (#16754)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-22 20:09:30 +01:00
David Sherret bfd9912e1f
fix(typescript): allow synthetic default imports when using ModuleKind.ESNext (#16438)
Closes #16437
2022-10-27 08:12:40 -04:00
David Sherret 8864a1d10f
fix(lsp): regression - error when removing file (#16388) 2022-10-22 15:36:07 -04:00
David Sherret bcfe279fba
feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
Divy Srivastava 0f27b84a5c
chore(core): remove core.opSync (#16379)
This patch removes the last uses of `core.opSync` from Deno.

The new and JIT-friendly way to call sync ops is `core.ops.op_name()`.
2022-10-21 19:35:23 +05:30
Kitson Kelly 7d78f58187
feat: support inlay hints (#16287)
Closes: #11853
2022-10-16 13:39:43 +11:00
Kitson Kelly 73e89844ba
feat(cli): update to TypeScript 4.8 (#15064) 2022-09-20 07:00:01 +10:00
Aapo Alasuutari 2164f6b1eb
perf(ops): Monomorphic sync op calls (#15337)
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params).

Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple:

```
opSync("op_foo", param1, param2);
// -> turns to
ops.op_foo(param1, param2);
```

This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path.

Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-08-11 15:56:56 +02:00
Yongwook Choi 2138b68c24
fix: Update Object.prototype.__proto__ related comments (#15394) 2022-08-04 08:39:16 +05:30
David Sherret 0c87dd1e98
perf: use emit from swc instead of tsc (#15118) 2022-07-12 18:58:39 -04:00
Kitson Kelly 5db16d1229
fix(lsp): enable auto imports (#15145)
Fixes: #15111
2022-07-12 09:35:18 +10:00
Rafael Ávila de Espíndola 2d15e926f9
fix: update to TypeScript 4.7.4 (#15022) 2022-07-04 15:13:50 +10:00
Bartek Iwańczuk 681bb49d0d
fix(lsp): restart TS language service when caching dependencies (#14979) 2022-06-27 19:43:43 +02:00
Nayeem Rahman ef7bc5e0a6
fix(check): ignore TS2306 (#14940)
Fixes a regression where this type checking error was being surfaced in certain scenarios.
2022-06-23 12:18:32 -04:00
Nayeem Rahman 845d4754c6
fix(check): use "moduleDetection": "force" (#14875) 2022-06-15 12:26:43 -04:00
Kitson Kelly 5692132755
fix(lsp): handle get diagnostic errors better (#14776) 2022-06-03 22:23:33 +10:00
Kitson Kelly 7eee521199
feat: update to TypeScript 4.7 (#14242) 2022-06-01 10:19:18 +10:00
Bartek Iwańczuk d76acfdc17
fix: base64 encoding of source maps with emojis (#14607)
This commit fixes source maps for files that contain emojis.

This is done by updating "deno_ast" to "0.14.1" for the case
of "--no-check" flag (ie using SWC emit) and by overriding
TSC's default base64 encoder (which turned out to be buggy)
for the type checking case.
2022-05-17 16:59:35 +02:00
David Sherret eb5ffab1cb
fix(lsp): correct positions in some scenarios (#14359) 2022-05-15 14:41:37 -04:00
Kitson Kelly ef26a267ae
fix(cli): add dom.extras lib (#14430)
Closes: #12558
Fixes: #14344
2022-04-29 13:47:58 +10:00
David Sherret c0e3b6096d
refactor(lsp): store all the assets in Rust when initializing (#14367) 2022-04-25 11:23:24 -04:00
Divy Srivastava b4e42953e1
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-03-14 18:44:15 +01:00
Kitson Kelly 7fc5bfe51b
feat(cli): update to TypeScript 4.6.2 (#13474) 2022-03-02 07:44:43 +11:00
David Sherret 37aba8f754
perf(lsp): cancellable TS diagnostics (#13565) 2022-02-02 09:25:22 -05:00
Yoshiya Hinosawa 4c1053ad33
chore: update copyright year (#13434) 2022-01-20 16:10:16 +09:00
Ryan Dahl 1fb5858009
chore: update copyright to 2022 (#13306)
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2022-01-07 22:09:52 -05:00
Kitson Kelly 345f0fbe5c
feat(cli): update to TypeScript 4.5 (#12410)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-12-10 09:12:21 +11:00
Kitson Kelly 210300d049
feat(lsp): add type definition provider (#12789) 2021-11-23 11:09:19 +11:00
Kitson Kelly bf5657cd59
feat(lsp): add workspace symbol provider (#12787) 2021-11-23 11:08:56 +11:00
Kitson Kelly 99de9eb4c2
fix(cli): don't ignore diagnostics about for await (#12116)
Fixes #12115
2021-09-17 16:54:52 +10:00
Kitson Kelly 935133f53a
feat(cli): Update to TypeScript 4.4 (#11678) 2021-08-27 10:12:59 +10:00
David Sherret 15a763152f
chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
Kitson Kelly 465cf9a6fe
feat: add new esnext types (#11627) 2021-08-10 10:33:08 +02:00
Jean Pierre 728d205d9d
feat(lsp): implement refactoring code actions (#11555)
Closes: denoland/vscode_deno#433
2021-08-06 11:46:32 +10:00
Kitson Kelly c6f4e41529
refactor(lsp): minor improvements to handling closed documents (#11518)
Ref #10897
2021-07-27 07:40:12 +10:00
Kitson Kelly 07eb44e483
fix(tsc): add .at() types manually to tsc (#11443)
Fixes: #11441
2021-07-19 11:56:14 +10:00
Kitson Kelly 281c4cd8fc
feat(cli): support "types" when type checking (#10999)
Fixes #10677
2021-06-22 07:18:32 +10:00
Kitson Kelly 59237d195f
feat(cli): upgrade to TypeScript 4.3 (#9960) 2021-05-28 09:33:11 +10:00
Yusuke Tanaka cda09c166f
chore: update deno_lint binary used in CI to v0.5.0 (#10652) 2021-05-18 17:24:01 +02:00
Satya Rohith 8ffeabc678
fix(lsp): ignore type definition not found diagnostic (#10610)
Fixes #10575
2021-05-18 14:09:33 +10:00
Kitson Kelly 3318c495f6
refactor(lsp): memoize script versions per tsc request (#10601) 2021-05-18 08:51:35 +10:00
Aaron O'Mullan ea917384fe
refactor(core): convert core.print() to a builtin op (#10436) 2021-05-02 19:30:03 -04:00
Aaron O'Mullan 83bece56b0
refactor(core): move op cache sync responsibility to rust space (#10340)
Even if bootstrapping the JS runtime is low level, it's an abstraction leak of 
core to require users to call `Deno.core.ops()` in JS space.

So instead we're introducing a `JsRuntime::sync_ops_cache()` method, 
once we have runtime extensions a new runtime will ensure the ops 
cache is setup (for the provided extensions) and then loading/unloading 
plugins should be the only operations that require op cache syncs
2021-04-25 22:00:05 +02:00
Aaron O'Mullan ff9ff4a377
refactor(core): simplify error handling (#10297)
- register builtin v8 errors in core.js so consumers don't have to
- remove complexity of error args handling (consumers must provide a 
  constructor with custom args, core simply provides msg arg)
2021-04-21 20:50:50 -04:00
Jean Pierre 6d404ec54b
feat(lsp): Implement textDocument/semanticTokens/full (#10233)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-04-20 11:26:36 +10:00
Jean Pierre 65a2a04d3b
feat(lsp): implement textDocument/prepareCallHierarchy (#10061) 2021-04-19 15:11:26 +10:00
Aaron O'Mullan 46b1c653c0
refactor(deno): remove concept of bin & json ops (#10145) 2021-04-12 15:55:05 -04:00
Jean Pierre 035f7b0ca0
feat(lsp): implement textDocument/foldingRange (#9900)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-04-02 17:21:07 +11:00
Kitson Kelly 881e1e8164
fix(cli): re-add dom.asynciterable lib (#9888)
Fixes: #9881
2021-03-25 22:09:03 +11:00
Jean Pierre 77cfadf532
feat(lsp): implement textDocument/selectionRange (#9845)
Ref: #8643
2021-03-24 10:33:25 +11:00
Kitson Kelly 506b321d47
refactor(lsp): refactor completions and add tests (#9789) 2021-03-16 09:01:41 +11:00
Luca Casonato 975705a649
chore(core): optional args for registerErrorClass (#9602) 2021-02-25 20:06:06 +01:00
Kitson Kelly d7837c8eb5
feat(cli): update to TypeScript 4.2 (#9341) 2021-02-25 15:16:19 +11:00
Yuki Tanaka ccd6ee5c23
feat(lsp): Implement textDocument/signatureHelp (#9330)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-02-16 13:34:09 +11:00
Trivikram Kamat ffe12aa92d
chore: bump TypeScript to 4.1.4 (#9459) 2021-02-09 23:27:38 +01:00
Kitson Kelly b77fcbc518
feat(lsp): add TS quick fix code actions (#9396) 2021-02-05 05:53:02 +11:00
Yoshiya Hinosawa 23281be33a
fix(cli): fix handling of non-normalized specifier (#9357) 2021-02-01 17:02:02 +09:00
Kitson Kelly 534531e4dd
feat(lsp): add references code lens (#9316) 2021-02-01 14:30:41 +11:00
Kitson Kelly 7bda0f567e
fix(cli): add lib dom.asynciterable (#9288)
Fixes #9218
2021-01-29 06:41:30 +11:00
Kitson Kelly 1a9209d1e3
fix(lsp): handle mbc documents properly (#9151)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2021-01-22 21:03:16 +11:00
Hirochika Matsumoto 8d5af6ca52
feat(lsp): Add textDocument/implementation (#9071)
Ref #8643
2021-01-13 08:53:27 +11:00
Yusuke Tanaka d8fd71afdf
chore: update copyright to 2021 (#9092) 2021-01-11 18:13:41 +01:00
Bartek Iwańczuk 46c0cab763
refactor(core): simplify Deno.core initialisation, remove stale TODO (#8847)
This commit rewrites initialisation of the "shared queue" and
in effect prevents from double execution of "core/core.js" and
"core/error.js".

Previously both of these files were executed every time a "JsRuntime"
was created. That lead to a situation where one copy of each script
was included in the snapshot and then another copy would be
executed after loading the snapshot.

Effectively "JsRuntime::shared_init" was removed; instead execution
of those scripts and actual initialisation of shared queue
was split into two helper functions: "JsRuntime::js_init" and
"JsRuntime::share_queue_init".

Additionally stale TODO comments were removed.
2021-01-05 22:10:50 +01:00
Kitson Kelly e8a81724bb
fix(lsp): handle ts debug errors better (#8914)
Fixes #8864
2020-12-30 12:46:58 +11:00
hrsh7th 57b0562957
feat(lsp): Implement textDocument/rename (#8910) 2020-12-30 11:58:20 +11:00
Kitson Kelly a4d557126e
fix(lsp): provide diagnostics for unresolved modules (#8872) 2020-12-24 21:53:03 +11:00
Luca Casonato bd85d0ed42
refactor: rewrite lsp to be async (#8727)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2020-12-21 08:44:26 -05:00
Nayeem Rahman ffb5f7a4e1
refactor: Rename runtime/rt to runtime/js (#8806) 2020-12-17 17:37:57 +01:00
Trivikram Kamat 63e0ab99a1
upgrade TypeScript to 4.1.3 (#8785) 2020-12-16 11:46:32 -05:00
Kitson Kelly 892d6cc997
refactor(lsp): optimise static assets (#8771)
Fixes #8158
2020-12-16 06:34:39 +11:00
Luca Casonato e94a18240e
feat(lsp): basic support for textDocument/completion (#8651) 2020-12-08 11:36:13 +01:00
Kitson Kelly 301d3e4b68
feat: add mvp language server (#8515)
Resolves #8400
2020-12-07 21:46:39 +11:00
Kitson Kelly 276f529755
feat(cli): update to TypeScript 4.1 (#7573) 2020-11-24 09:31:10 +11:00
Nayeem Rahman e7fc7d7151
fix(cli/tsc): allow non-standard extensions on imports (#8464) 2020-11-23 10:20:32 +11:00
Bartek Iwańczuk 8e914be742
build: migrate to dlint (#8176)
This commit migrates repository from using "eslint" 
to "dlint" for linting JavaScript code.
2020-11-03 16:19:29 +01:00
Kitson Kelly d672e1405d
refactor(cli): cleanup compiler snapshot and tsc/module_graph (#8220) 2020-11-03 06:41:20 +11:00
Trivikram Kamat 40cd4db974
feat(cli): bump TypeScript to 4.0.5 (#8138) 2020-11-03 06:39:39 +11:00
Kitson Kelly fdcc78500c
refactor(cli): migrate runtime compile/bundle to new infrastructure (#8192)
Fixes #8060
2020-11-02 13:51:56 +11:00
Kitson Kelly 6844caa9a5
fix(cli): restore tripleslash lib refs support (#8157)
Fixes #8147
2020-10-28 11:52:20 +11:00
Kitson Kelly 5af1dcfe29
fix(cli): do not throw on empty typescript files (#8143)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-10-27 13:19:27 +01:00
Bartek Iwańczuk 57cad53945
refactor(cli): rewrite Deno.transpileOnly() to use SWC (#8090)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2020-10-26 14:03:03 +01:00
Kitson Kelly ab898556a4
refactor(cli): move bundle check to new infrastructure (#8071) 2020-10-23 22:05:41 +11:00
Kitson Kelly 7e2c7fb6c5
refactor(cli): migrate run and cache to new infrastructure (#7996)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-10-23 11:50:15 +11:00
Kitson Kelly 0fb39f9176
feat(cli): add types for WeakRef/FinalizationRegistry (#8056)
Fixes #8051
2020-10-21 21:57:01 +11:00
Kitson Kelly 10654fa955
refactor(cli): add tsc2 (#7942)
Ref #7225
2020-10-14 10:52:49 +11:00
Kitson Kelly e077b93d77
refactor: add concept of 'legacy' compiler to enable non-breaking refactoring (#7762) 2020-10-01 20:33:15 +10:00
Bartek Iwańczuk ff785bc35a
refactor: use JsRuntime to implement TSC (#7691)
This commits removes "CompilerWorker" in favor of
using "JsRuntime".

"cli/ops/compiler.rs" has been removed in favor of inline
registration of ops in "cli/tsc.rs"
2020-09-26 16:33:25 +02:00
Bartek Iwańczuk 18b7109f76
refactor: prune unneeded JS code (#7689) 2020-09-26 15:59:24 +02:00
Bartek Iwańczuk 83f53c6455
refactor: remove tsc/40_error_stack.js (#7673)
This commit removes cli/tsc/40_error_stack.js as it is not
needed in TSC host. All errors originating in TSC are terminal
and don't require source mapping hence we can rely on default
stack traces provided by deno_core.

Additionally tsc/06_util.js was removed and its code moved
to tsc/99_main_compiler.js
2020-09-25 14:04:51 +02:00
Trivikram Kamat 49807ac4ac
feat: bump TypeScript to 4.0.3 (#7637) 2020-09-23 14:36:03 +10:00
Kitson Kelly 751bb45a0a
fix: ignore fileExists in tsc host (#7635)
Fixes #7630
2020-09-23 11:39:20 +10:00
Nayeem Rahman a43984c9cf
refactor(cli/fmt_errors): Color stack traces in Rust (#7628) 2020-09-22 19:01:30 +02:00
Bartek Iwańczuk 7845740637
refactor: deno_fetch op crate (#7524) 2020-09-18 09:20:55 -04:00
Bartek Iwańczuk 6c4da0e429
refactor: remove dispatch_json.js from cli/rt and cli/tsc (#7521)
Instead use Deno.core.jsonOpSync and Deno.core.jsonOpAsync
2020-09-16 22:22:43 +02:00
Kitson Kelly a6f34d4722
refactor: use ParsedModule and improve MediaTypes enum (#7456) 2020-09-14 14:27:44 +02:00
Kitson Kelly 10fbfcbc79
refactor: improve tsc diagnostics (#7420) 2020-09-12 11:53:57 +02:00
Bartek Iwańczuk c14436a424
fix(tsc): config resolution using relative paths (#7392) 2020-09-09 13:37:22 +02:00
Luca Casonato 6ff9395532
feat(unstable): enable isolatedModules by default (#7327) 2020-09-08 15:28:42 +02:00
Kitson Kelly 9e50b3ee61
fix: don't expose globalThis.__bootstrap (#7344) 2020-09-04 07:52:19 -04:00
Casper Beyer 32de714dc7
feat(unstable): add Deno.futime and Deno.futimeSync (#7266) 2020-08-31 14:29:43 -04:00
Bartek Iwańczuk c82c3b982e
refactor: Compiler config in Rust (#7228)
* port tsc_config.rs

* cleanup options

* bring back allowNonTsExtension

* try

* fix test

* fix test2

* move config for bundling

* remove Transpile compile request

* remove dead code

* remove more dead code

* remove checkJs regex

* fix

* handle config str for runtime APIs

* lint

* runtimeCompile config in Rust

* runtimeCompile and runtimeTranspile config in Rust

* fix

* remove lint supression

* upgrade: jsonc-parser 0.13.0

* remove unneeded to_string()

* upgrade: jsonc-parser 0.14.0

* remove AsRef<str>
2020-08-31 20:12:24 +02:00
Bartek Iwańczuk d761246e16
refactor: remove dead code in tsc (#7277) 2020-08-31 11:02:13 +02:00
Bert Belder c8b5f1e454
Simplify ErrBox-to-class mapping & hook it up to core json ops (#7195) 2020-08-26 18:48:04 +02:00
Kitson Kelly c4d5b01acf
feat: update to TypeScript 4.0 (#6514) 2020-08-24 19:43:54 -04:00
Ryan Dahl c4d9c6aa4b
upgrade: TypeScript to 3.9.7 (#7036) 2020-08-12 20:49:02 +02:00
Luca Casonato da98f9e3a1
fix(unstable): add missing globals to diagnostics (#6988) 2020-08-10 18:08:12 -04:00
Nayeem Rahman 52c1017a74
feat: Stabilize Deno.mainModule (#6993) 2020-08-10 16:41:51 -04:00
Bartek Iwańczuk 59ca66a207
Encode op errors as strings instead of numbers (#6977) 2020-08-07 16:47:18 -04:00
Bartek Iwańczuk 41215eb29c
Op crate for Web APIs (#6906)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-08-07 16:55:02 +02:00
Luca Casonato f6cd36f8c8
fix: add missing globals to unstable diagnostics (#6960) 2020-08-05 16:17:45 -04:00
Luca Casonato ce7808baf0
feat(cli): custom http client for fetch (#6918) 2020-08-05 20:44:03 +02:00
Bartek Iwańczuk b45f9a7357
fix: deno-types directive should have higher precedence than X-TypeScript-Types header (#6761) 2020-07-24 14:21:36 +02:00
Ryan Dahl ca4dcb36dd
Rename cli/js2 to cli/rt (#6857) 2020-07-23 16:27:26 +02:00
Bartek Iwańczuk b449964d1a
refactor: remove more compiler runtime code (#6841) 2020-07-23 15:29:36 +02:00
Ryan Dahl bf9930066d
Reduce size of TypeScript Compiler snapshot (#6809)
This PR is intentionally ugly. It duplicates all of the code in cli/js2/ into
cli/tsc/  ... because it's very important that we all understand that this code
is unnecessarily duplicated in our binary. I hope this ugliness provides the
motivation to clean it up.

The typescript git submodule is removed, because it's a very large repo and
contains all sorts of stuff we don't need. Instead the necessary files are
copied directly into the deno repo. Hence +200k lines.

COMPILER_SNAPSHOT.bin size
```
master         3448139
this branch    3320972
```

Fixes #6812
2020-07-22 12:03:46 -04:00