1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
Commit graph

10044 commits

Author SHA1 Message Date
林炳权
2ca10cc3a9
chore: update to Rust 1.73 (#20781) 2023-10-13 00:39:41 +02:00
Divy Srivastava
e377c172e3
fix(ext/node): implement uv.errname (#20785)
Fixes https://github.com/denoland/deno/issues/20617
2023-10-13 00:39:40 +02:00
Marcos Casagrande
0fb5d2e60c
fix(ext/formdata): support multiple headers in FormData (#20801)
Fixes https://github.com/denoland/deno/issues/20793
2023-10-13 00:39:40 +02:00
Matt Mastracci
e484758180
chore(ext/ffi): migrate from op -> op2 for ffi (#20509)
Migrate to op2. Making a few decisions to get this across the line:

- Empty slices, no matter where the come from, are null pointers. The v8
bugs (https://bugs.chromium.org/p/v8/issues/detail?id=13489) and
(https://bugs.chromium.org/p/v8/issues/detail?id=13488) make passing
around zero-length slice pointers too dangerous as they might be
uninitialized or null data.
- Offsets and lengths are `#[number] isize` and `#[number] usize`
respectively -- 53 bits should be enough for anyone
- Pointers are bigints. This is a u64 in the fastcall world, and can
accept Integer/Int32/Number/BigInt v8 types in the slow world.
2023-10-13 00:39:40 +02:00
Bartek Iwańczuk
ab64fec11d
refactor: rewrite several extension ops to op2 (#20457)
Rewrites following extensions:
- `ext/web`
- `ext/url`
- `ext/webstorage`
- `ext/io`

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-13 00:39:40 +02:00
Nayeem Rahman
feb9bc5e81
refactor(test): support custom writer in PrettyTestReporter (#20783) 2023-10-13 00:39:40 +02:00
Asher Gomez
6f3ce68455
docs: update alternative APIs for write(), writeSync(), read() and readSync() (#20792)
Closes #20701
2023-10-13 00:39:40 +02:00
David Sherret
3ef1adce96
refactor(node): combine node resolution code for resolving a package subpath from external code (#20791)
We had two methods that did the same functionality.
2023-10-13 00:39:39 +02:00
Nayeem Rahman
3977ae4ed7
fix(lsp): show diagnostics for type imports from untyped deps (#20780) 2023-10-13 00:39:39 +02:00
Divy Srivastava
8153f4a156
refactor: rewrite websocket to use op2 macro (#20140)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-13 00:39:39 +02:00
Kyle Kelley
56a288fd2c
fix(jupyter): keep this around (#20789)
This fixes #20767.

We were losing `this` and then when an exception was happening, it
didn't show up in the output because we weren't bubbling up exceptions
from within a user defined function for displaying. I thought about
doing a `.call(object)` but didn't want to get in the way of a bound
`this` that a user or library was already putting on the function.
2023-10-13 00:39:39 +02:00
Bartek Iwańczuk
a3af77926c
refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-13 00:39:39 +02:00
Trevor Manz
82b247662d
feat(jupyter): send binary data with Deno.jupyter.broadcast (#20755)
Adds `buffers` to the `Deno.jupyter.broadcast` API to send binary data
via comms. This affords the ability to send binary data via websockets
to the jupyter widget frontend.
2023-10-13 00:39:38 +02:00
Yoshiya Hinosawa
12e02c01ce
feat(unstable): add unix domain socket support to Deno.serve (#20759) 2023-10-13 00:39:38 +02:00
David Sherret
d97701c2d7
refactor(npm): break up NpmModuleLoader and move more methods into the managed CliNpmResolver (#20777)
Part of https://github.com/denoland/deno/issues/18967
2023-10-13 00:39:38 +02:00
Bartek Iwańczuk
c73a5a0dc2
chore: upgrade deno_core to 0.220.0 (#20766) 2023-10-13 00:39:38 +02:00
David Sherret
eae70d3886
fix(npm): upgrade to deno_npm 0.15.2 (#20772)
* fix: handle optional deps not found in dependencies map
(https://github.com/denoland/deno_npm/pull/38)
* fix: resolve a version requirement to the latest dist tag if it
matches (https://github.com/denoland/deno_npm/pull/37)

Closes #20771
2023-10-13 00:39:38 +02:00
David Sherret
6e457d5612
refactor(npm): make NpmCache, CliNpmRegistryApi, and NpmResolution internal to npm::managed (#20764) 2023-10-13 00:39:38 +02:00
Luca Casonato
ceef888cec
fix(ext/node): don't call undefined nextTick fn (#20724)
The `process` global is not defined in this file.

Fixes #20441

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-13 00:39:30 +02:00
Nayeem Rahman
7c0a1b3dca
refactor(lsp): clean up tsc requests (#20743) 2023-10-13 00:39:30 +02:00
Marcos Casagrande
38d4b379fd
perf(ext/web): optimize DOMException (#20715)
This PR optimizes `DOMException` constructor increasing performance of
all Web APIs that throw a `DOMException` (ie: `AbortSignal`)

**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)

new DOMException()            9.66 µs/iter     103,476.8   (8.47 µs … 942.71 µs)   9.62 µs  11.29 µs  14.04 µs
abort writeTextFileSync      16.45 µs/iter      60,775.5    (13.65 µs … 1.33 ms)  16.39 µs  20.59 µs  24.12 µs
abort readFile               16.25 µs/iter      61,542.2  (15.12 µs … 621.14 µs)  16.18 µs  19.59 µs  22.33 µs
```

**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)

benchmark                    time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------- -----------------------------
new DOMException()            2.37 µs/iter     421,657.0     (2.33 µs … 2.58 µs)   2.37 µs   2.58 µs   2.58 µs
abort writeTextFileSync        7.1 µs/iter     140,760.1     (6.94 µs … 7.68 µs)   7.13 µs   7.68 µs   7.68 µs
abort readFile                5.48 µs/iter     182,648.2      (5.3 µs … 5.69 µs)   5.56 µs   5.69 µs   5.69 µ
```

```js
Deno.bench("new DOMException()", () => {
  new DOMException();
});

Deno.bench("abort writeTextFileSync", () => {
  const ac = new AbortController();
  ac.abort();
  try {
    Deno.writeTextFileSync("/tmp/out", "x", { signal: ac.signal });
  } catch {}
});

Deno.bench("abort readFile", async () => {
  const ac = new AbortController();
  ac.abort();
  try {
    await Deno.readFile("/tmp/out", { signal: ac.signal });
  } catch {}
});
```
2023-10-13 00:39:30 +02:00
David Sherret
6a85593392
refactor(npm): create cli::npm::managed module (#20740)
Creates the `cli::npm::managed` module and starts moving more
functionality into it.
2023-10-13 00:39:30 +02:00
Divy Srivastava
e79da1679e
perf(node): use faster utf8 byte length in Buffer#from (#20746)
Use the `core.byteLength` op for string utf8 length calculation in
`node:buffer`

```
# This patch
file:///Users/divy/gh/deno/buffer.mjs
benchmark        time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------- -----------------------------
Buffer#from     272.11 ns/iter   3,675,029.3 (268.41 ns … 301.15 ns) 271.62 ns  295.5 ns 301.15 ns

# Deno 1.37.1
file:///Users/divy/gh/deno/buffer.mjs
benchmark        time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------- -----------------------------
Buffer#from     411.28 ns/iter   2,431,428.8 (393.82 ns … 439.92 ns) 418.85 ns  434.4 ns 439.92 ns
```
2023-10-13 00:39:30 +02:00
Rui He
554b7792b4
feat(node/os): Add availableParallelism (#20745) 2023-10-13 00:39:29 +02:00
Hirotaka Tagawa / wafuwafu13
e178ac6a9e
test(node_compat): add test-http-url.parse* (#20458)
Add `test-http-url.parse*` tests for Node compat.
2023-10-13 00:39:29 +02:00
Trevor Manz
cf3229a4aa
feat(jupyter): send Jupyter messaging metadata with Deno.jupyter.broadcast (#20714)
Exposes
[`metadata`](https://jupyter-client.readthedocs.io/en/latest/messaging.html#metadata)
to the `Deno.jupyter.broadcast` API.

```js
await Deno.jupyter.broadcast(msgType, content, metadata);
```

The metadata is required for
[`"comm_open"`](https://github.com/jupyter-widgets/ipywidgets/blob/main/packages/schema/messages.md#instantiating-a-widget-object-1)
for with `jupyter.widget` target.
2023-10-13 00:39:29 +02:00
Nayeem Rahman
63ba58239c
feat(lsp): jupyter notebook analysis (#20719) 2023-10-13 00:39:29 +02:00
Igor Zinkovsky
9ce3b22bd4
fix(ext/kv): send queue wake messages accross different kv instances (#20465)
fixes #20454

Current KV queues implementation assumes that `enqueue` and
`listenQueue` are called on the same instance of `Deno.Kv`. It's
possible that the same Deno process opens multiple KV instances pointing
to the same fs path, and in that case `listenQueue` should still get
notified of messages enqueued through a different KV instance.
2023-10-13 00:39:29 +02:00
David Sherret
3b01e3fa8b
refactor(cli): make CliNpmResolver a trait (#20732)
This makes `CliNpmResolver` a trait. The terminology used is:

- **managed** - Deno manages the node_modules folder and does an
auto-install (ex. `ManagedCliNpmResolver`)
- **byonm** - "Bring your own node_modules" (ex. `ByonmCliNpmResolver`,
which is in this PR, but unimplemented at the moment)

Part of #18967
2023-10-13 00:39:28 +02:00
David Sherret
8d851c95ec
refactor(ext/node): remove dependency on deno_npm and deno_semver (#20718)
This is required from BYONM (bring your own node_modules).

Part of #18967
2023-10-13 00:39:28 +02:00
Bartek Iwańczuk
a913a54656
fix(jupyter): more robust Deno.jupyter namespace (#20710) 2023-10-13 00:39:28 +02:00
David Sherret
f5243f1dbd
fix(upgrade): use tar.exe to extract on Windows (#20711)
This is what we do for deno install, so it should be fine here
https://github.com/denoland/deno_install/pull/219

Closes https://github.com/denoland/deno/issues/20683
2023-10-13 00:39:28 +02:00
David Sherret
3f7207d1a9
chore: add back dotcom step to release (#20713)
Accidentally removed in
69b7166c20
2023-10-13 00:39:28 +02:00
Matt Mastracci
ec60b78e77
chore(ext/ffi): migrate part of FFI to op2 (#20699) 2023-10-13 00:39:28 +02:00
Chen Su
ae84e01e8a
fix(ext/node): fix TypeError in Buffer.from with base64url encoding. (#20705)
For the following example, if I set the encoding to `base64url`, it'll
throw an unexpected TypeError:

```ts
import { Buffer } from "node:buffer";

Buffer.from("IntcImhlbGxvXCI6XCJoZGQvZStpXCJ9Ig", "base64url").toString();

// error: Uncaught TypeError: src.subarray is not a function
// const buf = Buffer.from(
//                    ^
//     at blitBuffer (ext:deno_node/internal/buffer.mjs:1779:15)
//     at Uint8Array.base64urlWrite (ext:deno_node/internal/buffer.mjs:691:10)
//     at Object.write (ext:deno_node/internal/buffer.mjs:2195:11)
//     at Uint8Array.write (ext:deno_node/internal/buffer.mjs:794:14)
//     at fromString (ext:deno_node/internal/buffer.mjs:214:22)
//     at _from (ext:deno_node/internal/buffer.mjs:119:12)
//     at Function.from (ext:deno_node/internal/buffer.mjs:157:10)
//     at file:///Users/foodieats/temp/buffer1.ts:3:20
```

The error caused by `base64urlWrite` function, it should call
`forgivingBase64UrlDecode` not `forgivingBase64UrlEncode`

Also fixed #20563 .
2023-10-13 00:39:27 +02:00
Luca Casonato
16419c44b8
fix(cli): panic with __runtime_js_sources (#20704)
Also a drive-by cleanup elsewhere (removing unused enum).

Fixes #20702
2023-10-13 00:39:27 +02:00
denobot
72c276d61a
1.37.1 (#20703)
Bumped versions for 1.37.1

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-09-27 11:54:44 +05:30
Igor Zinkovsky
f0a022bed4
fix(kv_queues): graceful shutdown (#20627)
This fixes the `TypeError: Database closed` error during shutdown.
2023-09-26 20:06:57 -07:00
Nayeem Rahman
b433133a1f
fix(lsp): allow query strings for "deno:/status.md" (#20697) 2023-09-27 01:48:34 +01:00
Bartek Iwańczuk
46a4bd5178
feat(unstable): add Deno.jupyter.broadcast API (#20656)
Closes https://github.com/denoland/deno/issues/20591

---------

Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-27 02:21:06 +02:00
Matt Mastracci
d39659332c
chore: update deno_core and cargo update (#20696)
```
    Updating deno_core v0.217.0 -> v0.218.0
    Updating deno_ops v0.93.0 -> v0.94.0
    Updating deno_semver v0.5.0 -> v0.5.1
    Updating fastrand v2.0.0 -> v2.0.1
    Updating serde_v8 v0.126.0 -> v0.127.0
    Updating sha2 v0.10.7 -> v0.10.8
    Updating time v0.3.28 -> v0.3.29
    Updating time-core v0.1.1 -> v0.1.2
    Updating time-macros v0.2.14 -> v0.2.15
```
2023-09-26 23:38:43 +00:00
David Sherret
91832ce278
fix(upgrade): error instead of panic on unzip failure (#20691)
For #20683
2023-09-26 17:52:47 -04:00
Nayeem Rahman
cb154d6afa
chore(lsp): bump tower-lsp to 0.20.0 (#20693) 2023-09-26 21:57:14 +01:00
David Sherret
dcb00bb9b8
chore: slight cleanup in npm resolvers (#20692) 2023-09-26 16:42:39 -04:00
Bartek Iwańczuk
50a3209fff
chore: deprecate Deno.metrics() API (#20684)
This API is providing hoops to jump through with undergoing migration to
`#[op2]` macro. 

The overhead of supporting this API is non-trivial and besides internal
use of it in test sanitizers is very rarely used in the wild.
2023-09-26 17:34:53 +02:00
Bartek Iwańczuk
3c0d6de155
refactor: rewrite ext/node/crypto to op2 macro (#20675) 2023-09-26 12:07:04 +00:00
Laurence Rowe
8fcea5966c
refactor(ext/http): use scopeguard defer to handle async drop (#20652)
Use the [scopeguard](https://docs.rs/scopeguard/) defer macro to run
cleanup code for `new_slab_future`.
This means it can be a single async function, avoiding the need to
create a struct and implement `PinnedDrop`

Async cleanup in Rust is awkward because async functions may be
cancelled at any await point when their Future is dropped.
The scopeguard approach comes from the following articles:
* [How to think about `async`/`await` in
Rust](http://cliffle.com/blog/async-inversion/)
* [Async Cancellation
I](https://blog.yoshuawuyts.com/async-cancellation-1/) (Reddit
[discussion](https://www.reddit.com/r/rust/comments/qrhg39/blog_post_async_cancellation/))
2023-09-26 05:42:48 -06:00
Luca Casonato
c68650d532
fix(cli/test): clear connection pool after tests (#20680)
This helps reduce flakes where a test starts an HTTP server and makes a
request using fetch, then shuts down the server, then starting a new
test with a new server, but the connection pool still has a "not quite
closed yet" connection to the old server, and a new request to the new
server gets sent on the closed connection, which obviously errors out.
2023-09-26 19:46:06 +09:00
Luca Casonato
6f87962a77
chore: clean up lint script (#20682)
Right now, if one of the linters fails, the all other ones continue
running in the background. This fixes this by waiting until all linters
are done before settling.
2023-09-26 04:41:07 +00:00
Nayeem Rahman
939279aa10
feat(lsp): support more vscode built-in settings (#20679) 2023-09-26 03:54:07 +01:00