Commit graph

5205 commits

Author SHA1 Message Date
Matt Mastracci 612818d043
fix(cli): ensure that an exception in getOwnPropertyDescriptor('constructor') doesn't break Deno.inspect (#20568)
Fixes #20561
2023-09-19 18:24:19 +00:00
Nayeem Rahman 40122d7f2a
fix(lsp): force correct media type detection from tsc (#20562) 2023-09-19 16:37:27 +01:00
Nayeem Rahman 9004117790
fix(lsp): refresh npm completions on each character (#20565) 2023-09-19 12:01:06 +00:00
Luca Casonato 2772d302f5
perf: make deno test 10x faster (#20550) 2023-09-19 12:10:20 +02:00
Nayeem Rahman b9b4ad31d9
refactor(lsp): dedup import map lookup for auto-imports (#20538) 2023-09-19 00:59:26 +01:00
Kyle Kelley 788bc8d021
fix(cli): Enhanced errors for Jupyter (#20530) 2023-09-18 22:07:33 +00:00
David Sherret 3de9af4d0b
fix(npm): properly handle legacy shasum of package (#20557)
Closes #20554
2023-09-18 16:40:41 -04:00
await-ovo dc1da30927
fix(cli): for main-module that exists in package.json, use the version defined in package.json directly (#20328) 2023-09-18 20:02:58 +00:00
Nayeem Rahman f5963b6a05
refactor(lsp): cleanup document preload (#20520) 2023-09-18 20:58:16 +01:00
Nayeem Rahman 86c04f43e0
fix(lsp): pass quote preference to tsc (#20547) 2023-09-18 20:48:32 +01:00
Nayeem Rahman f7ba701304
fix(lsp): prefer local auto-import specifiers (#20539)
Give auto-import completion entries a sort-text suffix depending on if
the specifier parses as a URL. This will favour relative and bare
(likely import-mapped) specifiers.
2023-09-18 19:55:24 +01:00
Shreyas d72f5d573a
fix: Deno.Command - improve error message when cwd is not a directory (#20460) 2023-09-18 17:48:54 +00:00
Nayeem Rahman 87ddd1f04d
fix(lsp): restore tsc's quick fix ordering (#20545) 2023-09-18 17:39:28 +01:00
Kyle Kelley ee38bbbc8e
fix(jupyter-kernel): don't log errors from objects without a Symbol.for("Jupyter.display") (#20546)
Fast follow up to #20537.

Before:


![image](https://github.com/denoland/deno/assets/836375/8a12e83d-9008-419b-bd1f-24c0ac90afd3)

After:

<img width="235" alt="image"
src="https://github.com/denoland/deno/assets/836375/467bf381-278e-4577-a980-7b0ddb08d2af">

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-18 16:31:20 +00:00
Matt Mastracci 701931477c
fix(cli): fetch works in Jupyter (#20552)
An op2 needs to be overloaded by an op2, not an op1.
2023-09-18 15:39:39 +00:00
David Sherret 0709c051f8
feat(unstable): package manager (#20517)
Adds an experimental unstable built-in package manager to Deno, but it is
currently not usable because the registry infrastructure hasn't been
setup and it points to a non-existent url by default. The default
registry url can be configured via the `DENO_REGISTRY_URL` environment
variable.
2023-09-18 10:46:44 -04:00
Bartek Iwańczuk 4fcd9a0de8
fix(lsp): sort quickfix actions (#17221)
This commit changes ordering of quickfix actions, by sorting them in
following order:

- TSC fixes
- Deno fixes
- deno_lint fixes

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-09-17 19:05:19 +01:00
Kyle Kelley 81d6ea8e11
feat(jupyter-kernel): accept nested objects from display calls (#20537)
Closes #20535.

# Screenshots

## JSON
<img width="779" alt="image"
src="https://github.com/denoland/deno/assets/836375/668bb1a6-3f76-4b36-974e-cdc6c93f94c3">

## Vegalite

<img width="558" alt="image"
src="https://github.com/denoland/deno/assets/836375/a5e70908-6b87-42d8-85c3-1323ad52a00f">

# Implementation

Instead of going the route of recursively getting all the objects under
`application/.*json` keys, I went with `JSON.stringify`ing in denospace
then parsing it from rust. One of the key benefits of serializing and
deserializing is that non-JSON-able entries will get stripped
automatically. This also keeps the code pretty simple.

In the future we should _only_ do this for `application/.*json` keys.

cc @mmastrac
2023-09-17 10:38:52 -06:00
第二扩展 23bf05cff2
build: add an environment variable to skip cross build check (#20281) (#20533) 2023-09-17 16:06:51 +00:00
Nayeem Rahman fa18878f54
fix(lsp): include JSON modules in local import completions (#20536) 2023-09-17 07:50:30 +01:00
Kyle Kelley 3b2e553b05
set evalue to a one space string for truthiness on old jupyter (#20531)
"Fixes" the exception display issue of #20524 on older versions of
Jupyter that required `evalue` to be truthy. For now, until we can do
proper processing of the `ExceptionDetails` this will make Jupyter
Notebook 6.5.1 and below happy.

This is the alternative "just work now" PR to #20530
2023-09-17 02:02:21 +00:00
Nayeem Rahman d13e6e6db8
feat(lsp): include source in auto import completion label (#20523) 2023-09-16 15:51:35 +01:00
Luca Casonato 430b63c2c4
perf: improve async op santizer speed and accuracy (#20501)
This commit improves async op sanitizer speed by only delaying metrics
collection if there are pending ops. This
results in a speedup of around 30% for small CPU bound unit tests.

It performs this check and possible delay on every collection now,
fixing an issue with parent test leaks into steps.
2023-09-16 07:48:31 +02:00
Bartek Iwańczuk bf07604113
feat: Add "deno jupyter" subcommand (#20337)
This commit adds "deno jupyter" subcommand which
provides a Deno kernel for Jupyter notebooks.

The implementation is mostly based on Deno's REPL and
reuses large parts of it (though there's some clean up that
needs to happen in follow up PRs). Not all functionality of
Jupyter kernel is implemented and some message type
are still not implemented (eg. "inspect_request") but
the kernel is fully working and provides all the capatibilities
that the Deno REPL has; including TypeScript transpilation
and npm packages support.

Closes https://github.com/denoland/deno/issues/13016

---------

Co-authored-by: Adam Powers <apowers@ato.ms>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-16 02:42:09 +02:00
Bartek Iwańczuk 5a1505db67
feat(ext/node): http2.connect() API (#19671)
This commit improves compatibility of "node:http2" module by polyfilling
"connect" method and "ClientHttp2Session" class. Basic operations like
streaming, header and trailer handling are working correctly. 
Refing/unrefing is still a TODO and "npm:grpc-js/grpc" is not yet working
correctly.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-15 21:51:25 +02:00
Nayeem Rahman 11f0ccf805
fix(test): share fail fast tracker between threads (#20515) 2023-09-15 15:46:48 +00:00
Matt Mastracci d226970c0e
chore(ext/http): fix a rejection test (#20514)
Use `assertRejects` to actually catch errors.
2023-09-15 08:53:38 -06:00
Matt Mastracci 71af3c375c
fix(ext/http): ensure aborted bodies throw (#20503)
Fixes #20502 -- ensure that Hyper errors make it through to JS.
2023-09-15 08:08:21 -06:00
Luca Casonato 06ece5645c
fix: init v8 platform once on main thread (#20495)
This is a mitigation for segfaults happening in V8 on CPU with MPK
(memory protected keys).

After much trail and error we found that unless V8 platform is
initialized on main thread the segfaults start appears once JIT 
kicks in. "deno test" and "deno bench" were affected by
this problem.

Fixes https://github.com/denoland/deno/issues/19926
Fixes https://github.com/denoland/deno/issues/20243
Fixes https://github.com/denoland/deno/issues/20450

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-15 00:17:01 +02:00
Bartek Iwańczuk 5e7435fb80
refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
Matt Mastracci dc505e905e
chore(cli): update chrono to remove broken time dep (#20508)
Fixes the last dependabot security warning
2023-09-14 13:17:38 -06:00
David Sherret 6dc8682b9a
feat: explicit resource management in TypeScript (#20506)
This adds support for `using` and `await using` declarations in
TypeScript only. We need to wait for v8 to support it for this to work
in JS.
2023-09-14 18:08:59 +00:00
David Sherret e66d3c2c2e
refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504)
https://github.com/denoland/deno/pull/20488 enables us to remove this
functionality. This is better because our test suite is now not testing
a separate code path.
2023-09-14 17:51:28 +00:00
David Sherret 54890ee98b
chore(tests): ability to pattern match unordered lines (#20488)
This adds the ability to pattern match unordered lines. For example, the
downloading messages may appear in any order

```
[UNORDERED_START]
Download https://localhost:4546/a.ts
Download https://localhost:4546/b.ts
[UNORDERED_END]
Hello!
```

Additionally, I've made the pattern matching slightly more strict and the output better.
2023-09-14 16:21:57 +00:00
Luca Casonato 851f795001
fix: output traces for op sanitizer in more cases (#20494)
This adds traces for the "started outside test, closed inside test"
case.
2023-09-14 16:38:15 +02:00
lionel-rowe 2046aeed70
feat(ext/web): Add name to Deno.customInspect of File objects (#20415)
Fixes https://github.com/denoland/deno/issues/20414
2023-09-14 07:06:58 +02:00
David Sherret 12a75e3b43
refactor: move deno_core::TaskQueue to cli::util::sync (#20481)
TaskQueue is being removed from `deno_core` and replaced with an unsync
version in deno_unsyc.

https://github.com/denoland/deno_core/pull/193

This is a change in preparation for that. The remaining
`deno_core::TaskQueue` usage in this repo should be replaced with
`deno_core::unsync::TaskQueue` once upgraded.
2023-09-13 21:53:07 +00:00
Nayeem Rahman 022664aab4
feat(lsp): WorkspaceSettings::disablePaths (#20475) 2023-09-13 17:30:27 +01:00
Nayeem Rahman bdf1850679
fix(lsp): match enable_paths by whole path components (#20470) 2023-09-12 14:36:50 +01:00
Bartek Iwańczuk 0b78a61f08
refactor: rewrite cli/ ops to op2 (#20462) 2023-09-12 13:14:45 +02:00
Leigh McCulloch 4a8b873111
fix(init): skip existing files instead of erroring (#20434)
### What
Skip writing files from the template if the files already exist in the
project directory.

### Why
When I run deno init in a directory that already has a main.ts, or one
of the other template files, I usually want to initialize a workspace
around a file I've started working in. A hard error in this case seems
counter productive. An informational message about what's being skipped
seems sufficient.

Close #20433
2023-09-12 12:55:26 +02:00
Bartek Iwańczuk f32acb945e
refactor: rewrite ext/io, ext/webstorage ops to op2 (#20461) 2023-09-12 12:42:05 +02:00
Bartek Iwańczuk 82c2864065
refactor: strongly typed TSC ops (#20466)
Removes usage of `serde_json::Value` in several ops used in TSC, in
favor of using strongly typed structs. This will unblock more 
changes in https://github.com/denoland/deno/pull/20462.
2023-09-12 00:55:57 +00:00
Matt Mastracci 950e0e9cd6
fix(ext/http): create a graceful shutdown API (#20387)
This PR implements a graceful shutdown API for Deno.serve, allowing all
current connections to drain from the server before shutting down, while
preventing new connections from being started or new transactions on
existing connections from being created.

We split the cancellation handle into two parts: a listener handle, and
a connection handle. A graceful shutdown cancels the listener only,
while allowing the connections to drain. The connection handle aborts
all futures. If the listener handle is cancelled, we put the connections
into graceful shutdown mode, which disables keep-alive on http/1.1 and
uses http/2 mechanisms for http/2 connections.

In addition, we now guarantee that all connections are complete or
cancelled, and all resources are cleaned up when the server `finished`
promise resolves -- we use a Rust-side server refcount for this.

Performance impact: does not appear to affect basic serving performance
by more than 1% (~126k -> ~125k)

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-12 00:06:38 +00:00
Matt Mastracci bfd230fd78
chore: update inner #\![allow] to #[allow] (#20463)
Functions should generally be annotated with `#[allow]` blocks rather
than using inner `#![allow]` annotations.
2023-09-11 17:12:33 -06:00
Marvin Hagemeister 9d1385896f
fix: exclude internal JS files from coverage (#20448) 2023-09-11 13:53:42 +00:00
Nayeem Rahman 4460336fda
fix(lsp): always enable semantic tokens responses (#20440) 2023-09-10 20:09:45 +01:00
Marvin Hagemeister 0b3968c468
chore: speed up test name escapeing (#20439) 2023-09-10 14:07:00 +02:00
David Sherret c228adc27d
feat: TypeScript 5.2 (#20425)
Without `using` declarations or decorator metadata (waiting for that in
v8).
2023-09-09 15:03:21 -04:00
Nayeem Rahman f75a17521d
fix(lsp): respect configured exclusions for testing APIs (#20427)
LSP testing APIs now obey the various file inclusion settings:
- Modules shown in the text explorer now respect the `exclude`,
`test.exclude` and `test.include` fields in `deno.json`, as well as
`deno.enablePaths` in VSCode settings.
- Modules with testing code lens now respect the `"exclude"`,
`test.exclude` and `test.include` fields in `deno.json`. Code lens
already respects `deno.enablePaths`.
2023-09-09 19:37:01 +01:00