1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
Commit graph

1608 commits

Author SHA1 Message Date
Leo Kettmeir
6f02fa1abf
feat(streams): ReadableStream.read min option (#20849) 2023-11-24 23:24:41 +01:00
denobot
2941dd7da8
chore: forward v1.38.3 release commit to main (#21320) 2023-11-24 07:09:15 +01:00
Matt Mastracci
68a0877f8d
fix(ext/http): avoid lockup in graceful shutdown (#21253)
Follow-up to #20822. cc @lrowe 

The `httpServerExplicitResourceManagement` tests were randomly failing
on CI because of a race.

The `drain` waker was missing wakeup events if the listeners shut down
after the last HTTP response finished. If we lost the race (rare), the
server Rc would be dropped and we wouldn't poll it again.

This replaces the drain waker system with a signalling Rc that always
resolves when the refcount is about to become 1.

Fix verified by running serve tests in a loop:

```
for i in {0..100}; do cargo run --features=__http_tracing -- test
 -A --unstable '/Users/matt/Documents/github/deno/deno/cli/tests/unit/ser
ve_test.ts' --filter httpServerExplicitResourceManagement; done;
```
2023-11-23 16:39:17 +00:00
Yoshiya Hinosawa
bf42467e21
fix(ext/node): fix node:stream.Writable (#21297)
This change applies the same fix as
https://github.com/nodejs/node/pull/46818, and the original example
given in #20456 works as expected.

closes #20456
2023-11-23 09:57:05 +09:00
Asher Gomez
616354e76c
refactor: replace deferred() from std/async with Promise.withResolvers() (#21234)
Closes #21041

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-11-22 12:11:20 +01:00
Divy Srivastava
c97a97240b
fix(ext/node): handle closing process.stdin more than once (#21267)
Fixes https://github.com/denoland/deno/issues/21112

Aligns more towards what Node.js does. Closing stdin more than once is a
nop.
2023-11-20 18:57:18 +05:30
Kenta Moriuchi
498bdc1e2a
fix(ext/url): add deno_console dependency for bench (#21266)
Should fix the benchmarks.

Signed-off-by: Kenta Moriuchi <moriken@kimamass.com>
2023-11-20 14:01:30 +01:00
Kenta Moriuchi
c806fbdabe
fix(ext,runtime): add missing custom inspections (#21219) 2023-11-19 09:13:38 +01:00
Matt Mastracci
76df375c84
chore(ext/http): bump version for re-release (#21254)
Syncs the changes to main for a deno_http version bump we needed to do.
`deno_http` v1.20 was released from the v1.38 branch.
2023-11-18 15:13:17 -07:00
Matt Mastracci
679b7bb8fa
fix(ext/http): fix crash in dropped Deno.serve requests (#21252)
Fixes #21250

We were attempting to recycle dropped resource responses too early.
2023-11-18 13:16:53 -07:00
denobot
21e6a76519
chore: forward v1.38.2 release commit to main (#21236)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-11-17 17:57:25 +09:00
David Sherret
544923afdc
fix(doc): issue discovering re-exports of re-exports sometimes (#21223) 2023-11-16 17:34:56 -05:00
Igor Zinkovsky
b572abfcb3
feat(ext/cron) modify Deno.cron API to make handler arg last (#21225)
This PR changes the `Deno.cron` API:
* Marks the existing function as deprecated
* Introduces 2 new overloads, where the handler arg is always last:
```ts
Deno.cron(
  name: string,
  schedule: string,
  handler: () => Promise<void> | void,
)

Deno.cron(
  name: string,
  schedule: string,
  options?: { backoffSchedule?: number[]; signal?: AbortSignal },
  handler: () => Promise<void> | void,
)
```

This PR also fixes a bug, when other crons continue execution after one
of the crons was closed using `signal`.
2023-11-16 14:19:00 -08:00
Matt Mastracci
6b42cecc06
feat(ext/net): use rustls_tokio_stream (#21205)
Fixes #21121 and #19498

Migrates fully to rustls_tokio_stream. We no longer need to maintain our
own TlsStream implementation to properly support duplex.

This should fix a number of errors with TLS and websockets, HTTP and
"other" places where it's failing.
2023-11-15 16:12:46 -07:00
Bartek Iwańczuk
cf6673b23d
fix(ext/node): add APIs perf_hook.performance (#21192)
Required for Next.js.
2023-11-14 16:33:09 +05:30
Kenta Moriuchi
886652156e
fix(ext/web): webstorage has trap for symbol (#21090) 2023-11-14 07:01:15 +01:00
Bartek Iwańczuk
9b9ec44db7
Revert "fix(ext/console): fix inspecting iterators error. (#20720)" (#21191)
This reverts commit 0209f7b469.

Reverting because it causes failures on `main`:
https://github.com/denoland/deno/pull/20720#issuecomment-1809166755
2023-11-13 22:16:23 +00:00
Laurence Rowe
e5819777c3
refactor(ext/http): Use HttpRecord as response body to track until body completion (#20822)
Use HttpRecord as response body so requests can be tracked all the way
to response body completion.

This allows Request properties to be accessed while the response body is
streaming.

Graceful shutdown now awaits a future instead of async spinning waiting
for requests to finish.

On the minimal benchmark this refactor improves performance an
additional 2% over pooling alone for a net 3% increase over the previous
deno main branch.

Builds upon https://github.com/denoland/deno/pull/20809 and
https://github.com/denoland/deno/pull/20770.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-11-13 19:17:31 +00:00
Chen Su
0209f7b469
fix(ext/console): fix inspecting iterators error. (#20720)
Fixes #19776 and #20676.
2023-11-13 20:13:20 +01:00
Laurence Rowe
25950baed3
perf(ext/http): Object pooling for HttpRecord and HeaderMap (#20809)
Reuse existing existing allocations for HttpRecord and response
HeaderMap where possible.

At request end used allocations are returned to the pool and the pool
and the pool sized to 1/8th the current number of inflight requests.

For http1 hyper will reuse the response HeaderMap for the following
request on the connection.

Builds upon https://github.com/denoland/deno/pull/20770

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-11-13 10:32:34 -07:00
Laurence Rowe
542314a0be
refactor(ext/http): refer to HttpRecord directly using v8::External (#20770)
Makes the JavaScript Request use a v8:External opaque pointer to
directly refer to the Rust HttpRecord.

The HttpRecord is now reference counted. To avoid leaks the strong count
is checked at request completion.

Performance seems unchanged on the minimal benchmark. 118614 req/s this
branch vs 118564 req/s on main, but variance between runs on my laptop
is pretty high.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-11-13 07:04:49 -07:00
Divy Srivastava
1ef617e8f3
perf: lazy bootstrap options - first pass (#21164)
Move most runtime options to be lazily loaded. Constant options will be
covered in a different PR.

Towards https://github.com/denoland/deno/issues/21133
2023-11-13 04:52:59 +00:00
Kenta Moriuchi
39223f709b
feat(ext/web): add AbortSignal.any() (#21087)
Fixes #18944
2023-11-13 01:04:11 +01:00
Florian Schwalm
3a7abe6906
fix(ext/web): Prevent TextDecoderStream resource leak on stream cancellation (#21074)
This PR uses the new `cancel` method of `TransformStream` to properly
clean up the internal `TextDecoder` used in `TextDecoderStream` if the
stream is cancelled.

Fixes #13142

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-12 12:47:03 -07:00
Divy Srivastava
9f4a45561f
perf: snapshot runtime ops (#21127)
Closes https://github.com/denoland/deno/issues/21135

~1ms startup time improvement

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-11-11 17:01:48 +00:00
Matt Mastracci
56e76242f3
chore(ext/node): use libz-sys w/zlib-ng feature in node (#21158)
We only want one zlib dependency.

Zlib dependencies are reorganized so they use a hidden
`__vendored_zlib_ng` flag in cli that enables zlib-ng for both libz-sys
(used by ext/node) and flate2 (used by deno_web).
2023-11-11 07:20:12 -07:00
Jacob Hummer
b2e3389a6a
fix(node/http): export globalAgent (#21081)
Fixes #21080 
Fixes #18312

---------

Signed-off-by: Jacob Hummer <jcbhmr@outlook.com>
2023-11-11 10:13:30 +05:30
Divy Srivastava
df14835b83
fix(ext/node): implement process.geteuid (#21151)
Fixes #21097
2023-11-10 11:49:57 -07:00
Divy Srivastava
05704fbf78
chore: use pure rust secp256k1 crate (#21154)
Saves ~40s in fresh debug build
2023-11-10 22:59:01 +05:30
denobot
1ece7dfd90
chore: forward v1.38.1 release commit to main (#21144)
This is the release commit being forwarded back to main for 1.38.1

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-11-10 18:51:34 +05:30
Bartek Iwańczuk
612b7dfcc7
fix(node/child_process): properly normalize stdio for 'spawnSync' (#21103)
Closes https://github.com/denoland/deno/issues/20782
2023-11-10 05:59:39 +00:00
Matt Mastracci
9010b8df53
perf: remove knowledge of promise IDs from deno (#21132)
We can move all promise ID knowledge to deno_core, allowing us to better
experiment with promise implementation in deno_core.

`{un,}refOpPromise(promise)` is equivalent to
`{un,}refOp(promise[promiseIdSymbol])`
2023-11-09 13:57:26 -07:00
Divy Srivastava
c4029f6af2
fix(node): implement createPrivateKey (#20981)
Towards #18455
2023-11-09 23:26:59 +05:30
Divy Srivastava
ee7fd0a212
chore(ext/crypto): bump signature to 2.1 (#21125) 2023-11-09 16:15:46 +01:00
Matt Mastracci
f8d1d84c5a
chore(ext/web): migrate to deno_core typed externals (#21114)
Use our safer typed externals for the external required for resource
streams.
2023-11-08 20:46:13 +01:00
Aravind
e4593873a9
fix(ext/http): Throwing Error if the return value of Deno.serve handler is not a Response class (#21099)
---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-11-07 15:52:44 -07:00
David Sherret
7978bc5d1b
fix(node): cjs export analysis should probe for json files (#21113)
Closes #21064
2023-11-07 16:38:55 -05:00
David Sherret
9201198efd
fix(node): inspect ancestor directories when resolving cjs re-exports during analysis (#21104)
If a CJS re-export can't be resolved, it will check the ancestor
directories, which is more similar to what `require` does at runtime.
2023-11-07 09:56:06 -05:00
Gasman
837c870ff4
fix(node/http): socket.setTimeout (#20930)
Fixes #20923
2023-11-07 00:51:14 +01:00
Kenta Moriuchi
90189dd997
fix(ext): use String#toWellFormed in ext/webidl and ext/node (#21054)
Fixes #18802 

This PR adds `util.toUSVString` to node:util:

```js
import util from "node:util";
util.toUSVString("string\ud801"); // => "string\ufffd"
```
2023-11-06 22:18:28 +01:00
Luca Bruno
56a4c981f5
fix(ext/fetch): re-align return type in op_fetch docstring (#21098)
This adds a missing `cancelHandleRid` field in `op_fetch` return type,
see Rust side:

fdb4953ea4/ext/fetch/lib.rs (L183-L189)
2023-11-06 14:15:02 +01:00
Divy Srivastava
4530cd5f0d fix 2023-11-05 06:40:35 -08:00
Divy Srivastava
cbdc649975 fix lint 2023-11-05 06:40:35 -08:00
Divy Srivastava
5202f5460d chore(ext/crypto): upgrade ec crates 2023-11-05 06:40:35 -08:00
Divy Srivastava
46faf37ec0
chore(ext/ffi): use dlopen2 crate (#21093)
Closes #21046
2023-11-05 09:29:26 +00:00
Divy Srivastava
5a45892707
chore: bump deno_native_certs to 0.2 (#21092)
Towards #21046
2023-11-05 08:14:58 +00:00
David Sherret
e4c947dd2b
fix(node): use closest package.json to resolve package.json imports (#21075) 2023-11-04 16:41:51 +00:00
Divy Srivastava
efa1c1c964 chore(ext/crypto): bump curve25519-dalek to 4.1 2023-11-03 20:25:35 -07:00
Igor Zinkovsky
1d0856a4f1
feat(ext/kv): increase checks limit (#21055) 2023-11-02 11:57:11 -07:00
denobot
41877a0b37
1.38.0 (#21051)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-02 01:01:47 +00:00
Bartek Iwańczuk
24c3c96958
feat: granular --unstable-* flags (#20968)
This commit adds granular `--unstable-*` flags:
- "--unstable-broadcast-channel"
- "--unstable-ffi"
- "--unstable-fs"
- "--unstable-http"
- "--unstable-kv"
- "--unstable-net"
- "--unstable-worker-options"
- "--unstable-cron"

These flags are meant to replace a "catch-all" flag - "--unstable", that
gives a binary control whether unstable features are enabled or not. The
downside of this flag that allowing eg. Deno KV API also enables the FFI
API (though the latter is still gated with a permission).

These flags can also be specified in `deno.json` file under `unstable`
key.

Currently, "--unstable" flag works the same way - I will open a follow
up PR that will print a warning when using "--unstable" and suggest to use
concrete "--unstable-*" flag instead. We plan to phase out "--unstable"
completely in Deno 2.
2023-11-01 23:15:08 +01:00
Matt Mastracci
42c426e769
feat(ext/websocket): websockets over http2 (#21040)
Implements `WebSocket` over http/2. This requires a conformant http/2
server supporting the extended connect protocol.

Passes approximately 100 new WPT tests (mostly `?wpt_flags=h2` versions
of existing websockets APIs).

This is implemented as a fallback when http/1.1 fails, so a server that
supports both h1 and h2 WebSockets will still end up on the http/1.1
upgrade path.

The patch also cleas up the websockets handshake to split it up into
http, https+http1 and https+http2, making it a little less intertwined.

This uncovered a likely bug in the WPT test server:
https://github.com/web-platform-tests/wpt/issues/42896
2023-11-01 21:11:01 +00:00
Luca Casonato
d42f154312
feat: disposable Deno resources (#20845)
This commit implements Symbol.dispose and Symbol.asyncDispose for
the relevant resources.

Closes #20839

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-01 20:26:12 +01:00
Igor Zinkovsky
01d3e0f317
feat(cron) implement Deno.cron() (#21019)
This PR adds unstable `Deno.cron` API to trigger execution of cron jobs.

* State: All cron state is in memory. Cron jobs are scheduled according
to the cron schedule expression and the current time. No state is
persisted to disk.
* Time zone: Cron expressions specify time in UTC.
* Overlapping executions: not permitted. If the next scheduled execution
time occurs while the same cron job is still executing, the scheduled
execution is skipped.
* Retries: failed jobs are automatically retried until they succeed or
until retry threshold is reached. Retry policy can be optionally
specified using `options.backoffSchedule`.
2023-11-01 11:57:55 -07:00
Kenta Moriuchi
841f215fd4
fix(ext/node): adapt dynamic type checking to Node.js behavior (#21014) 2023-11-01 16:06:25 +09:00
Leo Kettmeir
39716183ac
feat(ext/web): EventSource (#14730)
Closes #10298

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-10-31 18:16:27 +01:00
Matt Mastracci
e4308aebc0
feat(ext/websocket): use rustls-tokio-stream instead of tokio-rustls (#20518)
Use new https://github.com/denoland/rustls-tokio-stream project instead
of tokio-rustls for direct websocket connections. This library was
written from the ground up to be more reliable and should help with
various bugs that may occur due to underlying bugs in the old library.

Believed to fix #20355, #18977, #20948
2023-10-31 09:34:45 -06:00
Divy Srivastava
edee8ab95d
chore: use deno_whoami (#21027)
Towards #20996 

`deno_whoami` is lightweight on unix and has zero framework dependency
on macOS. https://github.com/denoland/deno_whoami

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-10-31 12:38:39 +00:00
Divy Srivastava
ba6bd444b6
perf: use deno_native_certs crate (#18072)
Fixes #18071 

Replace `rustls_native_certs` which links to Security framework.
https://github.com/denoland/deno_native_certs uses dlopen to lazy load
when needed.
2023-10-31 12:55:46 +01:00
Divy Srivastava
f62e22a699
fix(ext/node): tty streams extends net socket (#21026)
Workaround the circular references issue by using a initializer function
to give tty stream class to `initStdin`.

Fixes https://github.com/denoland/deno/issues/21024
Fixes https://github.com/denoland/deno/issues/20611
Fixes https://github.com/denoland/deno/issues/20890
Fixes https://github.com/denoland/deno/issues/20336

`create-svelte` works now:
```
divy@mini /t/a> ~/gh/deno/target/debug/deno run -A --unstable --reload npm:create-svelte@latest sveltekit-deno

create-svelte version 5.1.1

┌  Welcome to SvelteKit!
│
◇  Which Svelte app template?
│  Skeleton project
│
◇  Add type checking with TypeScript?
│  Yes, using JavaScript with JSDoc comments
│
◇  Select additional options (use arrow keys/space bar)
│  none
│
└  Your project is ready!

✔ Type-checked JavaScript
  https://www.typescriptlang.org/tsconfig#checkJs

Install community-maintained integrations:
  https://github.com/svelte-add/svelte-add

Next steps:
  1: cd sveltekit-deno
  2: npm install
  3: git init && git add -A && git commit -m "Initial commit" (optional)
  4: npm run dev -- --open

To close the dev server, hit Ctrl-C

Stuck? Visit us at https://svelte.dev/chat
```

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-10-31 17:24:43 +05:30
Luca Casonato
2d9298f5f5
chore: update ext/kv to use denokv_* crates (#20986)
This commit updates the ext/kv module to use the denokv_* crates for
the protocol and the sqlite backend. This also fixes a couple of bugs in
the sqlite backend, and updates versionstamps to be updated less
linearly.
2023-10-31 11:13:57 +00:00
Matt Mastracci
b75f3b5ca0
feat(ext/websocket): split websocket read/write halves (#20579)
Fixes some UB when sending and receiving at the same time.
2023-10-30 11:49:19 -06:00
Divy Srivastava
09204107d8
fix: implement node:tty (#20892)
Fixes #21012
Closes https://github.com/denoland/deno/issues/20855
Fixes https://github.com/denoland/deno/issues/20890
Fixes https://github.com/denoland/deno/issues/20611
Fixes https://github.com/denoland/deno/issues/20336
Fixes `create-svelte` from https://github.com/denoland/deno/issues/17248

Fixes more reports here:
- https://github.com/denoland/deno/issues/6529#issuecomment-1432690559
- https://github.com/denoland/deno/issues/6529#issuecomment-1522059006
- https://github.com/denoland/deno/issues/6529#issuecomment-1695803570
2023-10-30 15:53:08 +00:00
Divy Srivastava
1acef755ca
chore: remove usage of chrono::Utc::now() (#20995)
Remove usage of Chrono's clock feature which pulls in iana-time-zone ->
core-foundation
2023-10-30 11:45:45 -04:00
Divy Srivastava
02cc37e054
chore: upgrade rsa to 0.9 (#21016) 2023-10-30 16:25:12 +01:00
Divy Srivastava
5b2d9fb8d4
fix(ext/ffi): use anybuffer for op_ffi_buf_copy_into (#21006)
Fixes https://github.com/denoland/deno/issues/21005
2023-10-28 10:02:57 +03:00
Divy Srivastava
4c6b986f17
chore(ext/crypto): upgrade to ring 0.17 (#20824)
Ref https://github.com/denoland/deno/issues/18071
2023-10-27 23:15:09 +02:00
Jared Flatow
33565e16ca
fix(ext/http): patch regression in variadic args to serve handler (#20796)
I'm not sure what was the purpose of trying to be so clever with the
args were (maybe an optimization?), but it breaks variadic args as
pointed out in #20054.

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-27 05:34:41 -06:00
David Sherret
9026f20b2d
fix(unstable/byonm): improve error messages (#20987)
This improves the error messages when a specifier can't be resolved from
a deno module into an npm package.
2023-10-26 21:22:15 -04:00
Bartek Iwańczuk
96ce9cdb17
refactor: op_sleep uses op2 macro (#20908)
Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-26 14:16:41 -06:00
Luca Casonato
08b99f3909
chore: update base64 crate (#20877) 2023-10-26 18:39:04 +02:00
Bartek Iwańczuk
093b3eee58
chore: update deno_core and port all remaining ops to op2 (#20954)
Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-25 13:43:38 +02:00
Jérôme Benoit
9df36b33c6
docs(event): fixlets to code comments (#20944) 2023-10-23 14:34:37 +02:00
sigmaSd
9f9c3d9048
fix(polyfill): correctly handle flag when its equal 0 (#20953)
Fixes https://github.com/denoland/deno/issues/20910
2023-10-22 08:02:55 +00:00
Bartek Iwańczuk
5095af7801
fix(ext/node): process.argv0 (#20925)
Fixes https://github.com/denoland/deno/issues/20924
2023-10-18 01:51:39 +02:00
David Sherret
cb70c4d0c4
fix(node): resolve file.d specifiers in npm packages (#20918)
Makes type checking octokit work.

Closes #20854
2023-10-17 00:26:38 +09:00
Marcos Casagrande
7599990a4f
perf(ext/streams): optimize streams (#20649)
This PR introduces several optimizations to streams

### Highlights:
- `ReadableStream` constructor: +20% iter/s.
- `WritableStream` constructor: +50% iter/s.
- `TransformStream` constructor: +30% iter/s.
- `ReadableStream` iterator (both 2 and 20 chunks): +42% and +25%
iter/s.
- `ReadableByteStream` iterator (both 2 and 20 chunks): +39% and +20%
iter/s.

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

benchmark                                      time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------------------------- -----------------------------
ReadableStream constructor                    294.52 ns/iter   3,395,392.9 (277.92 ns … 618.26 ns) 292.66 ns 353.87 ns 618.26 ns
WritableStream constructor                    235.51 ns/iter   4,246,065.3 (213.04 ns … 306.35 ns) 236.77 ns 279.08 ns 281.32 ns
TransformStream constructor                   672.52 ns/iter   1,486,938.7 (652.15 ns … 880.74 ns) 670.11 ns 880.74 ns 880.74 ns
ReadableStream - iterator (2 chunks)           10.44 µs/iter      95,757.9   (8.97 µs … 830.91 µs)  10.22 µs  14.74 µs  18.93 µs
ReadableStream - iterator (20 chunks)          21.93 µs/iter      45,593.4   (18.8 µs … 864.97 µs)  20.57 µs  57.15 µs 137.16 µs
ReadableStream - reader (2 chunks)              7.09 µs/iter     140,987.2     (7.03 µs … 7.18 µs)   7.13 µs   7.18 µs   7.18 µs
ReadableStream - reader (20 chunks)            18.41 µs/iter      54,324.2    (15.7 µs … 252.7 µs)  17.14 µs  68.88 µs  94.08 µs
ReadableByteStream - iterator (2 chunks)       11.06 µs/iter      90,375.1   (9.75 µs … 404.69 µs)  10.88 µs   16.6 µs  29.69 µs
ReadableByteStream - iterator (20 chunks)      26.71 µs/iter      37,435.0  (22.98 µs … 508.34 µs)  25.25 µs  85.28 µs 155.65 µs
ReadableByteStream - reader (2 chunks)          7.99 µs/iter     125,131.1     (7.92 µs … 8.13 µs)   8.01 µs   8.13 µs   8.13 µs
ReadableByteStream - reader (20 chunks)        23.46 µs/iter      42,618.5  (20.28 µs … 414.66 µs)  21.94 µs  90.52 µs 147.38 µs
```

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

benchmark                                      time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------------------------- -----------------------------
ReadableStream constructor                    235.48 ns/iter   4,246,584.3 (223.12 ns … 504.65 ns)  234.3 ns 290.84 ns 311.12 ns
WritableStream constructor                    156.31 ns/iter   6,397,537.3 (148.54 ns … 211.13 ns) 157.49 ns 199.82 ns 208.23 ns
TransformStream constructor                   471.29 ns/iter   2,121,815.3 (452.53 ns … 791.41 ns) 468.62 ns 540.36 ns 791.41 ns
ReadableStream - iterator (2 chunks)            7.32 µs/iter     136,705.4   (6.35 µs … 639.97 µs)    7.1 µs  12.12 µs  20.98 µs
ReadableStream - iterator (20 chunks)          17.48 µs/iter      57,195.1  (14.48 µs … 289.06 µs)  16.06 µs  76.98 µs 114.61 µs
ReadableStream - reader (2 chunks)              6.86 µs/iter     145,847.9      (6.8 µs … 6.97 µs)   6.88 µs   6.97 µs   6.97 µs
ReadableStream - reader (20 chunks)            16.88 µs/iter      59,227.7  (14.04 µs … 311.29 µs)  15.39 µs  74.95 µs  97.45 µs
ReadableByteStream - iterator (2 chunks)        7.94 µs/iter     125,881.2   (6.86 µs … 811.16 µs)   7.69 µs  11.43 µs   16.6 µs
ReadableByteStream - iterator (20 chunks)      22.23 µs/iter      44,978.2  (18.98 µs … 590.11 µs)  20.73 µs  45.13 µs  159.8 µs
ReadableByteStream - reader (2 chunks)           7.4 µs/iter     135,206.9     (7.36 µs … 7.42 µs)    7.4 µs   7.42 µs   7.42 µs
ReadableByteStream - reader (20 chunks)        21.03 µs/iter      47,555.6  (17.75 µs … 357.66 µs)  19.52 µs  98.69 µs  146.5 µs
```

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-10-13 14:30:09 +02:00
denobot
5da1bd802c
chore: forward v1.37.2 release commit to main (#20897)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-13 03:12:06 +00:00
Bartek Iwańczuk
c464cd7073
refactor: FeatureChecker integration in ext/ crates (#20797)
Towards https://github.com/denoland/deno/issues/20779.
2023-10-12 15:55:50 +00:00
Bartek Iwańczuk
cee221109a
fix(node/http2): fixes to support grpc (#20712)
This commit improves "node:http2" module implementation, by enabling
to use "options.createConnection" callback when starting an HTTP2
session.
This change enables to pass basic client-side test with "grpc-js/grpc"
package.
Smaller fixes like "Http2Session.unref()" and "Http2Session.setTimeout()"
were handled as well.

Fixes #16647
2023-10-12 14:03:19 +00:00
Leo Kettmeir
8ba1242a05
feat(WebSocketStream): rename connection to opened (#20878) 2023-10-11 07:31:05 +02:00
Luca Casonato
6450334f5b
feat(ext/web): cancel support for TransformStream (#20815) 2023-10-10 18:42:31 +09:00
Luca Casonato
2665ca103e
fix(ext/web): writability of ReadableStream.from (#20836)
Fixes a WPT in `URL` and `ReadableStream`.

Some unrelated WPT expectation changes due to WPT update.
2023-10-10 05:01:01 +02:00
Luca Casonato
ae81065c75
fix(ext/http): Deno.Server should not be thenable (#20723)
Otherwise you can not return `Deno.Server` from async functions.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-09 12:43:14 +09:00
Bartek Iwańczuk
2167a52d69
refactor: remove TimersPermissions::check_unstable (#20831)
This is dead code that was not used in any way.

Ref https://github.com/denoland/deno/pull/20797
2023-10-09 02:08:10 +02:00
Matt Mastracci
6cb5d8eb86
fix(ext/ffi): use anybuffer for op_ffi_ptr_of (#20820)
Fixes #20817
2023-10-08 14:02:07 +09:00
Aapo Alasuutari
effb5e1ce4
fix(node/buffer): utf8ToBytes should return a Uint8Array (#20769) 2023-10-08 11:09:50 +09:00
Bartek Iwańczuk
edeccef499
refactor: migrate more ops to op2 macro (#20808)
Getting closer...
2023-10-07 21:04:03 +05:30
Marcos Casagrande
ceecd8c495
perf(ext/web): optimize structuredClone without transferables (#20730)
This PR optimizes `structuredClone` when it's called without
transferables.

### Benchmarks

**main**
```
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
----------------------------------------------------------------------------------- -----------------------------
structuredClone object              1.64 µs/iter     611,086.0     (1.58 µs … 1.84 µs)   1.66 µs   1.84 µs   1.84 µs
structuredClone transferables       2.82 µs/iter     354,281.4     (2.78 µs … 2.92 µs)   2.84 µs   2.92 µs   2.92 µs
```

**this PR**

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

structuredClone object                 1 µs/iter     998,383.5    (971.28 ns … 1.2 µs)      1 µs    1.2 µs    1.2 µs
structuredClone transferables       2.82 µs/iter     355,087.5      (2.7 µs … 3.07 µs)   2.83 µs   3.07 µs   3.07 µs
```

```js
Deno.bench("structuredClone object", () => {
  structuredClone({ foo: "bar" });
});

Deno.bench("structuredClone transferables", () => {
  const buf = new Uint8Array([97]);
  structuredClone(buf, {
    transfer: [buf.buffer],
  });
});
```
2023-10-06 23:21:48 +02:00
Bartek Iwańczuk
f0608a5b91
refactor: migrate ext/node/ops to op2 (#20805) 2023-10-06 00:16:36 +02:00
David Sherret
820e93e3e7
refactor(npm): add referrer when resolving npm package sub path from deno module (#20800)
Adds a `referrer` parameter to this function instead of using a fake
one.
2023-10-05 20:18:29 +00:00
林炳权
7a01799f49
chore: update to Rust 1.73 (#20781) 2023-10-05 14:49:09 -04:00
Divy Srivastava
ab3c9d41e4
fix(ext/node): implement uv.errname (#20785)
Fixes https://github.com/denoland/deno/issues/20617
2023-10-05 18:27:20 +00:00
Marcos Casagrande
176bf9ba5f
fix(ext/formdata): support multiple headers in FormData (#20801)
Fixes https://github.com/denoland/deno/issues/20793
2023-10-05 19:28:44 +02:00
Matt Mastracci
1619932a65
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-05 15:35:21 +02:00
Bartek Iwańczuk
5d98a544b4
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-05 14:34:38 +02:00
David Sherret
1ff525e25b
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-04 23:05:12 -04:00
Divy Srivastava
1a81b2826d
refactor: rewrite websocket to use op2 macro (#20140)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-04 21:43:58 +00:00
Bartek Iwańczuk
a5568066b3
refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-04 21:42:17 +02:00
Yoshiya Hinosawa
da0b945804
feat(unstable): add unix domain socket support to Deno.serve (#20759) 2023-10-04 11:37:39 +09:00