0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

801 commits

Author SHA1 Message Date
Divy Srivastava
38f0b41e7d
perf(web): optimize single pass utf8 decoding (#16593)
- [x] Avoid copying buffers.

https://encoding.spec.whatwg.org/#dom-textdecoder-decode

> Implementations are strongly encouraged to use an implementation
strategy that avoids this copy. When doing so they will have to make
sure that changes to input do not affect future calls to
[decode()](https://encoding.spec.whatwg.org/#dom-textdecoder-decode).

- [x] Special op to avoid string label deserialization and parsing.
(Ideally we should map labels to integers in JS)
- [x] Avoid webidl `Object.assign` when options is undefined.
2022-11-11 20:07:18 +05:30
Divy Srivastava
ff92febb38
fix(ext/flash): graceful server startup/shutdown (#16383)
Fixes https://github.com/denoland/deno/issues/16267

Co-authored-by: Yusuke Tanaka <yusuktan@maguro.dev>
2022-11-11 19:11:52 +05:30
Bartek Iwańczuk
8d5c0112fb
feat: don't require --unstable flag for npm programs (#16520)
This PR adds copies of several unstable APIs that are available
in "Deno[Deno.internal].nodeUnstable" namespace.

These copies do not perform unstable check (ie. don't require
"--unstable" flag to be present). Otherwise they work exactly
the same, including permission checks.

These APIs are not meant to be used by users directly and
can change at any time.

Copies of following APIs are available in that namespace:
- Deno.spawnChild
- Deno.spawn
- Deno.spawnSync
- Deno.serve
- Deno.upgradeHttpRaw
- Deno.listenDatagram
2022-11-10 22:03:28 +01:00
Bartek Iwańczuk
53e974b276
feat: remove --unstable flag requirement for npm: specifiers (#16473)
This commit makes "npm:" specifiers not require "--unstable" flag.
At the moment some APIs used by Node polyfills still require
"--unstable" which will be addressed in follow up PRs.
2022-11-10 17:57:10 +01:00
Marcos Casagrande
7bd2c607dd
fix(ext/response): make error, json, redirect enumerable (#16497) 2022-11-10 00:31:14 +01:00
Yoshiya Hinosawa
9edcab524f
fix(ext/flash): revert #16284 and add test case (#16576) 2022-11-09 17:20:05 +09:00
denobot
c08fcd96c1
chore: forward v1.27.2 release commit to main (#16572)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-09 00:27:51 +01:00
Bartek Iwańczuk
d0212198b6
refactor(ext/node): remove unwraps (#16559) 2022-11-08 03:16:24 +01:00
Bartek Iwańczuk
e7d7da85df
fix(npm): fix CJS resolution with local node_modules dir (#16547)
This commit fixes CJS resolution when there's a local "node_modules/"
directory.

Before this commit relative imports from CJS files where resolved
relative to
root directory of the package instead of relative to referrer file.
2022-11-06 00:58:21 +01:00
Luca Casonato
1410e4adea
fix(ext/http): flush chunk when streaming resource (#16536)
When streaming a resource in ext/http, with compression enabled, we
didn't flush individual chunks. This became very problematic when we
enabled `req.body` from `fetch` for FastStream recently.

This commit now correctly flushes each resource chunk after compression.
2022-11-04 18:59:07 +01:00
denobot
61fbfabe44
chore: forward v1.27.1 release commit to main (#16533)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-04 00:40:23 +01:00
David Sherret
77fb26e143
fix(npm): add console global for node environment (#16519)
This global is already isolated to node during type checking.

Closes #16518
2022-11-02 19:08:09 -04:00
Bartek Iwańczuk
f5cb26a82f
revert 9ea0ce6198 (#16501)
Closes https://github.com/denoland/deno/issues/16450
2022-11-01 16:06:06 +01:00
Divy Srivastava
d76014192d
fix(ext/websocket): make try_send ops infallible (#16454)
Fixes #16450
2022-10-31 12:22:49 +05:30
Kenta Moriuchi
59ac110edd
fix(core): fix APIs not to be affected by Promise.prototype.then modification (#16326) 2022-10-29 18:25:23 +09:00
Filip Skokan
ec09134d8a
fix(ext/crypto): fix HMAC jwk import "use" check (#16465) 2022-10-28 19:50:38 +05:30
denobot
b0fb8fa9dc
1.27.0 (#16442)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-27 17:13:26 +02:00
Luca Casonato
f4f1f4f0b6
feat(ext/net): reusePort for TCP on Linux (#16398) 2022-10-26 19:04:27 +00:00
Marcos Casagrande
de580cedd2
refactor(ext/streams): remove fake detached (#16431)
Removed "fake detached" logic since it's no longer needed after
[#16294](https://github.com/denoland/deno/pull/16294) landed
2022-10-26 20:40:26 +02:00
Kitson Kelly
a0d10efbb1
chore: improve built-in API documentation (#16158)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-26 15:53:48 +02:00
Divy Srivastava
6cd9343e8b
perf(ext/web): optimize transferArrayBuffer (#16294)
Avoid copying enqueued data + misc optimizations to skip webidl
converter.
2022-10-26 18:28:25 +05:30
Bartek Iwańczuk
af62e0833d
Revert "Revert "refactor(ext/net): clean up variadic network ops (#16… (#16422)
…392)" (#16417)"

This reverts commit 8e3f825c92.
2022-10-25 22:50:55 +02:00
Bartek Iwańczuk
8e3f825c92
Revert "refactor(ext/net): clean up variadic network ops (#16392)" (#16417)
Should fix https://github.com/denoland/deno_std/issues/2807
2022-10-25 20:32:51 +02:00
David Sherret
e203bd9c5a
fix: upgrade swc_ecma_parser to 0.122.19 - deno_ast 0.20 (#16406) 2022-10-25 11:55:57 -04:00
Marcos Casagrande
34fb380ed3
feat(ext/web): use ArrayBuffer.was_detached() (#16307)
This PR adds a way to reliably check if an ArrayBuffer was detached
2022-10-25 14:22:37 +02:00
Marcos Casagrande
ac5fcf626a
perf(ext/web): add op_encode_binary_string (#16352)
Add a new op to use in `reader.readAsBinaryString(blob)`.

```
File API binary string: 400b    35.12 µs/iter    (21.93 µs … 3.27 ms)  31.87 µs 131.95 µs 217.63 µs
File API binary string: 4kb     46.49 µs/iter    (29.36 µs … 4.42 ms)   42.5 µs 122.48 µs  155.1 µs
File API binary string: 2.2mb    4.17 ms/iter     (1.75 ms … 8.54 ms)   5.48 ms   7.39 ms   8.54 ms
```

**main**

```
benchmark                          time (avg)             (min … max)       p75       p99      p995
--------------------------------------------------------------------- -----------------------------
File API binary string: 400b    56.17 µs/iter  (43.09 µs … 784.52 µs)   49.6 µs 177.18 µs 241.23 µs
File API binary string: 4kb     277.2 µs/iter   (240.29 µs … 1.84 ms) 269.87 µs 649.79 µs 774.46 µs
File API binary string: 2.2mb  180.03 ms/iter (173.32 ms … 194.35 ms) 182.54 ms 194.35 ms 194.35 ms
```

It can also handle bigger files, when encoding a 200mb file, main
crashes with OOM

```
<--- Last few GCs --->

[132677:0x560504676550]     5012 ms: Scavenge 417.3 (434.6) -> 401.8 (434.6) MB, 0.1 / 0.0 ms  (average mu = 0.824, current mu = 0.825) allocation failure; 
[132677:0x560504676550]     5038 ms: Scavenge 417.3 (434.6) -> 401.8 (434.6) MB, 0.1 / 0.0 ms  (average mu = 0.824, current mu = 0.825) allocation failure; 
[132677:0x560504676550]     5064 ms: Scavenge 417.3 (434.6) -> 401.8 (434.6) MB, 0.1 / 0.0 ms  (average mu = 0.824, current mu = 0.825) allocation failure;
```
2022-10-24 20:27:22 +02:00
Andreu Botella
dbcbf53ab5
experiment(ext/web): Don't expose event classes during the bootstrap phase (#16213) 2022-10-24 16:14:17 +02:00
Luca Casonato
c061538417
refactor(ext/net): clean up variadic network ops (#16392)
Previously `op_net_listen`, `op_net_accept`, and various other ops in
ext/net where variadic on the transport. This created a lot of code
bloat. This commit updates the code to instead have separate ops for
each transport.
2022-10-24 14:55:39 +02:00
Marcos Casagrande
f38666f5a3
fix(ext/fetch): fix size_hint on response body resource (#16254) 2022-10-24 13:26:41 +02:00
Marcos Casagrande
b7d86b4bed
perf(ext/streams): fast path when consuming body of tee'd stream (#16329)
Add a fast path for consuming the body of cloned `Request`/`Response`,
which is very common specially when using `cache` API.
2022-10-24 13:13:20 +02:00
Gianluca Oldani
873a5ce2ed
feat(ext/net): add reuseAddress option for UDP (#13849)
This commit adds a `reuseAddress` option for UDP sockets. When this
option is enabled, one can listen on an address even though it is
already being listened on from a different process or thread. The new
socket will steal the address from the existing socket.

On Windows and Linux this uses the `SO_REUSEADDR` option, while on other
Unixes this is done with `SO_REUSEPORT`.

This behavior aligns with what libuv does.

TCP sockets still unconditionally set the `SO_REUSEADDR` flag - this
behavior matches Node.js and Go. This PR does not change this behaviour.

Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-10-24 09:05:07 +00:00
Luca Casonato
38213f1142
fix(ext/net): don't remove sockets on unix listen (#16394)
When listening on a UNIX socket path, Deno currently tries to unlink
this path prior to actually listening. The implementation of this
behaviour is VERY racy, involves 2 additional syscalls, and does not
match the behaviour of any other runtime (Node.js, Go, Rust, etc).

This commit removes this behaviour. If a user wants to listen on an
existing socket, they must now unlink the file themselves prior to
listening.

This change in behaviour only impacts --unstable APIs, so it is not
a breaking change.
2022-10-24 00:45:45 +02:00
Marcos Casagrande
0e1167d12d
perf(ext/web/encoding): avoid copy in decode (#16364) 2022-10-23 21:09:15 +02: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
Bartek Iwańczuk
869acee8fb
chore: upgrade rusty_v8 to 0.54.0 (#16368)
<!--
Before submitting a PR, please read http://deno.land/manual/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.
-->
2022-10-20 21:01:49 +02:00
Divy Srivastava
bfc1fb8d68
perf(serde_v8): serde_v8::StringOrBuffer return JS ArrayBuffer instead of Uint8Array (#16360)
Towards #16315
2022-10-20 16:03:57 +05:30
Aapo Alasuutari
e2be70b035
feat(ext/ffi): Make op_ffi_ptr_of fast (#16297)
Makes `op_ffi_ptr_of` fast. One of the tests changed from printing
`false` to `true` as the fast `&[u8]` slice path creates the slice with
a null pointer. Thus the `op_ffi_ptr_of` will now return a null pointer
value whereas previously it returned a dangling pointer value.
2022-10-20 09:37:37 +05:30
Aapo Alasuutari
722ea20e86
perf(ext/ffi): Fast UnsafePointerView read functions (#16351)
This PR makes pointer read methods of `Deno.UnsafePointerView` Fast API
compliant, with the exception of `getCString` which cannot be made fast
with current V8 Fast API.
2022-10-20 09:35:56 +05:30
Divy Srivastava
e3a3095481
perf(ext/websocket): optimize op_ws_next_event (#16325)
Towards https://github.com/denoland/deno/issues/16315
2022-10-19 17:20:41 +05:30
Divy Srivastava
743fcc0668
perf(ext/flash): optimize path response streams (#16284)
Regression caused by https://github.com/denoland/deno/pull/15591
2022-10-19 16:41:47 +05:30
Divy Srivastava
36307c45e9
perf(ext/websocket): optimize socket.send (#16320)
Towards #16315
2022-10-19 16:23:13 +05:30
Yusuke Tanaka
44a89dd6dc
fix(ext/net): return an error from startTls and serveHttp if the original connection is captured elsewhere (#16242)
This commit removes the calls to `expect()` on `std::rc::Rc`, which caused
Deno to panic under certain situations. We now return an error if `Rc`
is referenced by other variables.

Fixes #9360
Fixes #13345
Fixes #13926
Fixes #16241

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-18 11:28:27 +09:00
Bartek Iwańczuk
204c46dcc1
chore: forward v1.26.2 to main (#16331)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>

<!--
Before submitting a PR, please read http://deno.land/manual/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.
-->

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-10-17 23:11:16 +02:00
Marcos Casagrande
d0e78ca5c6
fix(ext/fetch): set accept-encoding: identity if range header is present (#16197)
https://fetch.spec.whatwg.org/#http-network-or-cache-fetch

> If httpRequest’s header list contains `Range`, then append
(`Accept-Encoding`, `identity`)
> to httpRequest’s header list.
> 
> This avoids a failure when handling content codings with a part of an
encoded response.
> Additionally, many servers mistakenly ignore `Range` headers if a
non-identity encoding is accepted.
2022-10-17 15:39:41 +02:00
Divy Srivastava
4c9dd33e27
perf(ext/web): optimize timer cancellation (#16316)
Towards #16315 

It created a bunch of Error objects and rejected the promise. This patch
changes `op_sleep` to resolve with `true` if it was cancelled.
2022-10-17 16:59:16 +05:30
Divy Srivastava
0dc2f02dfa
perf(ext/web): optimize op_cancel_handle (#16318)
Towards #16315
2022-10-17 16:12:05 +05:30
Marcos Casagrande
5252ff5dbd
fix(ext/cache): illegal constructor (#16205) 2022-10-16 23:03:17 +05:30
Bartek Iwańczuk
40009ebc94
fix(npm): disable loading native module for "fsevents" package (#16273)
Currently causes a hang in Vite, disable this one specific package
as remaining tests for NAPI in various modules work fine.
2022-10-16 15:03:38 +02:00
David Sherret
4ea4d3ad60
chore: fix windows-only clippy errors (#16289) 2022-10-15 13:56:54 +00:00
Aapo Alasuutari
75acec0aea
fix(ext/ffi): Fix UnsafeCallback ref'ing making Deno enter a live-loop (#16216)
Fixes #15136

Currently `UnsafeCallback` class' `ref()` and `unref()` methods rely on
the `event_loop_middleware` implementation in core. If even a single
`UnsafeCallback` is ref'ed, then the FFI event loop middleware will
always return `true` to signify that there may still be more work for
the event loop to do.

The middleware handling in core does not wait a moment to check again,
but will instead synchronously directly re-poll the event loop and
middlewares for more work. This becomes a live-loop.

This PR introduces a `Future` implementation for the `CallbackInfo`
struct that acts as the intermediary data storage between an
`UnsafeCallback` and the `libffi` C callback. Ref'ing a callback now
means calling an async op that binds to the `CallbackInfo` Future and
only resolves once the callback is unref'ed. The `libffi` C callback
will call the waker of this Future when it fires to make sure that the
main thread wakes up to receive the callback.
2022-10-15 19:19:46 +05:30
Aapo Alasuutari
9c7a5c0c61
fix(ext/websocket): panic on no next ws message from an already closed stream (#16004) 2022-10-15 11:08:09 +02:00
Filip Skokan
225d516466
fix(ext/crypto): correct HMAC get key length op (#16201)
fixes #16180

`HMAC`'s `get key length` `op` uses the hash function's block size, not
output size.

refs
https://github.com/cloudflare/workerd/issues/68#issuecomment-1271189657
2022-10-15 10:53:35 +05:30
Marcos Casagrande
e6e2898190
fix(ext/web/streams): enqueue to second branch before closing (#16269)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-10-14 09:51:39 +00:00
Marcos Casagrande
0d6dbc08be
fix(ext/fetch): throw TypeError on non-Uint8Array chunk (#16262) 2022-10-14 11:38:17 +02:00
Marcos Casagrande
50c7b89369
fix(ext/web/streams): resolve cancelPromise in ReadableStreamTee (#16266) 2022-10-14 11:29:01 +02:00
Aapo Alasuutari
17271532d4
fix(ext/ffi): Invalid 'function' return type check logic, remove U32x2 as unnecessary (#16259)
The return type checking for `"function"` type FFI values was incorrect
and presumed that functions were still being registered as objects
containing a "function" key.

While here, I also removed the whole return type checking logic as it
was needed for optionally creating BigInts on return when needed, but
serde_v8 does this automatically now (I think).
2022-10-13 17:36:52 +05:30
Xiao Xiao
ba3d0da6ab
chore(ext/web): fix typo (#16248)
implictly -> implicitly
assiging -> assigning
2022-10-12 07:47:15 +00:00
Marcos Casagrande
d47b17d37d
fix(ext/fetch): throw TypeError on read failure (#16219) 2022-10-12 09:23:33 +02:00
Marcos Casagrande
0cd05d7377
fix(ext/fetch): fix illegal header regex (#16236)
This PR fixes invalid header parsing which is flaky because `g` flag is
being used in the regex, which keeps track of `lastIndex`

```javascript
try {
  new Headers([["x", "\u0000x"]]);  // error
} catch(e) {}
new Headers([["x", "\u0000x"]]); // no error
```

This issue affects `Response` & `Request` constructors as well
2022-10-10 12:06:50 -04:00
sigmaSd
70ad6717df
fix sparse array inspection (#16204)
fix https://github.com/denoland/deno/issues/16202
2022-10-10 10:22:21 -04:00
Luca Casonato
1ab3691b09
feat(core): add Deno.core.writeAll(rid, chunk) (#16228)
This commit adds a new op_write_all to core that allows writing an
entire chunk in a single async op call. Internally this calls
`Resource::write_all`.

The `writableStreamForRid` has been moved to `06_streams.js` now, and
uses this new op. Various other code paths now also use this new op.

Closes #16227
2022-10-10 10:28:35 +02:00
Satya Rohith
4d6aed1b52
perf(ext/cache): set journal_mode=wal (#16231) 2022-10-10 13:05:57 +05:30
Luca Casonato
3b6b75bb46
feat(core): improve resource read & write traits (#16115)
This commit introduces two new buffer wrapper types to `deno_core`. The
main benefit of these new wrappers is that they can wrap a number of
different underlying buffer types. This allows for a more flexible read
and write API on resources that will require less copying of data
between different buffer representations.

- `BufView` is a read-only view onto a buffer. It can be backed by
`ZeroCopyBuf`, `Vec<u8>`, and `bytes::Bytes`.
- `BufViewMut` is a read-write view onto a buffer. It can be cheaply
converted into a `BufView`. It can be backed by `ZeroCopyBuf` or
`Vec<u8>`.

Both new buffer views have a cursor. This means that the start point of
the view can be constrained to write / read from just a slice of the
view. Only the start point of the slice can be adjusted. The end point
is fixed. To adjust the end point, the underlying buffer needs to be
truncated.

Readable resources have been changed to better cater to resources that
do not support BYOB reads. The basic `read` method now returns a
`BufView` instead of taking a `ZeroCopyBuf` to fill. This allows the
operation to return buffers that the resource has already allocated,
instead of forcing the caller to allocate the buffer. BYOB reads are
still very useful for resources that support them, so a new `read_byob`
method has been added that takes a `BufViewMut` to fill. `op_read`
attempts to use `read_byob` if the resource supports it, which falls
back to `read` and performs an additional copy if it does not. For
Rust->JS reads this change should have no impact, but for Rust->Rust
reads, this allows the caller to avoid an additional copy in many
scenarios. This combined with the support for `BufView` to be backed by
`bytes::Bytes` allows us to avoid one data copy when piping from a
`fetch` response into an `ext/http` response.

Writable resources have been changed to take a `BufView` instead of a
`ZeroCopyBuf` as an argument. This allows for less copying of data in
certain scenarios, as described above. Additionally a new
`Resource::write_all` method has been added that takes a `BufView` and
continually attempts to write the resource until the entire buffer has
been written. Certain resources like files can override this method to
provide a more efficient `write_all` implementation.
2022-10-09 14:49:25 +00:00
Divy Srivastava
a622c5df27
perf(ext/crypto): optimize getRandomValues (#16212) 2022-10-09 15:38:38 +05:30
Marcos Casagrande
cc3e2b9b1a
fix(ext/fetch): reject immediately on aborted signal (#16190)
Enabled the following test:

edc428e8e2/fetch/api/abort/general.any.js (L185-L201)
2022-10-08 16:08:47 -04:00
Marcos Casagrande
a5d55fe6ea
fix(ext/fetch): support empty formdata (#16165)
This PR adds support for empty `FormData` parsing in
`Response`/`Request`

```js
new Response(new FormData()).formData()
```

ref: https://github.com/web-platform-tests/wpt/issues/28607
2022-10-07 13:59:30 +02:00
Aapo Alasuutari
19e4e821d5
fix(ext/ffi): Fix usize and isize FFI callback parameters missing match arm (#16172)
Mea culpa. Back when I re-introduced parameter and return value types to
FFI callbacks I failed to properly account for the change in match arm
logic. As a result, usize and isize parameters in FFI callbacks
currently enter the branch meant for void only.

This PR changes the match arms to all be explicit, making sure that void
is the only arm marked unreachable and that it stays that way.
2022-10-07 10:20:18 +05:30
Colin Ihrig
c27234888f
fix(napi): move napi symbols file (#16179)
The current location was causing failures during v1.26.1 publication.

<!--
Before submitting a PR, please read http://deno.land/manual/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.
-->
2022-10-07 09:21:43 +05:30
Divy Srivastava
5a1ea586b4
refactor(napi): simplify napi_value interface (#16170) 2022-10-07 09:21:08 +05:30
denobot
afeacb8328
chore: forward v1.26.1 release commit to main (#16178)
This is the release commit being forwarded back to main for 1.26.1

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.26.1 && git checkout -b forward_v1.26.1 upstream/forward_v1.26.1
```

Don't need this PR? Close it.

cc @cjihrig

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-10-06 16:49:40 -04:00
Marcos Casagrande
b487027b45
refactor(ext/fetch): simplify parseContentDisposition (#16162)
Replaced `forEach`, `map`, `filter`, `map` with a single `for` loop
2022-10-05 12:31:36 -04:00
Divy Srivastava
0b016a7fb8
feat(npm): implement Node API (#13633)
This PR implements the NAPI for loading native modules into Deno. 

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-10-05 19:36:44 +05:30
Marcos Casagrande
3a3a848406
fix(ext/cache): prevent cache insert if body is not fully written (#16138) 2022-10-05 16:31:24 +05:30
ayame113
b5425ae2d3
fix(ext/flash): Avoid sending Content-Length when status code is 204 (#15901)
Currently Content-Length is sent when the status code is 204. However,
according to the spec, this should not be sent.
Modify the if statement below to prevent the Content-Length from being
sent.
2022-10-05 12:21:59 +05:30
Marcos Casagrande
569287b15b
perf(ext/fetch): consume body using ops (#16038)
This commit adds a fast path to `Request` and `Response` that
make consuming request bodies much faster when using `Body#text`,
`Body#arrayBuffer`, and `Body#blob`, if the body is a FastStream.
Because the response bodies for `fetch` are FastStream, this speeds up
consuming `fetch` response bodies significantly.
2022-10-04 15:48:50 +02:00
Filip Skokan
0d042d8e54
fix(ext/crypto): interoperable import/export (#16153)
This PR updates RSA key import/export to a state which is interoperable
with other implementations.

For RSA the only OID in and out is `rsaEncryption`.
For EC the only OID in and out is `id-ecpublickey` (fixed in #16152).

see https://github.com/w3c/webcrypto/issues/307#issuecomment-995813032
see https://github.com/w3c/webcrypto/issues/307
see https://github.com/w3c/webcrypto/pull/305
see https://github.com/nodejs/node/pull/42816
2022-10-04 17:37:59 +05:30
Filip Skokan
aa710aac98
fix(ext/crypto): ecdh spki key import/export roundtrip (#16152) 2022-10-04 17:09:41 +05:30
Filip Skokan
fd08b13dff
fix(ext/crypto): ECDH and X25519 non byte length and 0 length fixes (#16146) 2022-10-04 16:54:05 +05:30
Aurélien Bertron
8d20784f7a
fix(ext/crypto): deriveBits for ECDH not taking length into account (#16128)
Fixes #16047
2022-10-03 23:10:34 -07:00
Filip Skokan
7742ad77fa
fix(ext/crypto): curve25519 import export (#16140) 2022-10-03 23:06:25 -07:00
Bartek Iwańczuk
5b097fd7e5
fix(npm): better error is version is specified after subpath (#16131) 2022-10-03 19:10:53 +02:00
Marcos Casagrande
d13c88e70d
refactor(ext/fetch): avoid extra headers copy in .clone (#16130) 2022-10-03 13:34:13 +02:00
Satya Rohith
eacd6a7f29
chore(ext/cache): make helper functions public (#16117) 2022-10-03 10:52:54 +05:30
Marcos Casagrande
e2990be264
fix(ext/cache): close resource on error (#16129) 2022-10-03 09:48:59 +05:30
李瑞丰
b3444e0d3b
fix(ext/crypto): fix importKey error when leading zeroes (#16009)
Co-authored-by: Jason <m.jason.liu@outlook.com>
2022-10-03 09:37:25 +05:30
Marcos Casagrande
a55b194638
fix(ext/cache): acquire reader lock before async op (#16126) 2022-10-02 01:21:48 +02:00
Colin Ihrig
636b448f3c
fix(ext/crypto): use correct handle for public keys (#16099)
When storing public and private keys in the key store, use a different
handle for each key so that they can be looked up in the future.

Refs: https://github.com/denoland/deno/pull/14119
Refs: https://github.com/denoland/deno_std/issues/2631
2022-09-30 09:18:30 -04:00
Luca Casonato
20c7300412
refactor(ext/http): remove op_http_read (#16096)
We can use Resource::read_return & op_read instead. This allows HTTP
request bodies to participate in FastStream.

To make this work, `readableStreamForRid` required a change to allow non
auto-closing resources to be handled. This required some minor changes
in our FastStream paths in ext/http and ext/flash.
2022-09-30 07:54:12 +02:00
Luca Casonato
38f544538b
fix(runtime): no FastStream for unrefable streams (#16095) 2022-09-30 00:42:33 +02:00
Marcos Casagrande
927f4e2e83
fix(ext/fetch): Body#bodyUsed for static body (#16080)
This fixes a bug where `Body#bodyUsed` incorrectly returns `false`
for a body that has actually already been consumed, after `Body#body`
is called.
2022-09-29 17:38:04 +02:00
Agustin Casagrande
16bc9b16d2
refactor(ext/cache): remove extra headers iteration in cache.put (#16078) 2022-09-29 10:34:45 +05:30
denobot
d8827514ff
1.26.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-29 00:10:44 +02:00
Divy Srivastava
e2828ad762
fix(ext/flash): reregister socket on partial read on Windows (#16076) 2022-09-28 20:52:24 +02:00
Divy Srivastava
e64af6260a
feat(ext/flash): add reuseport option on Linux (#16022) 2022-09-28 23:16:29 +05:30
Satya Rohith
b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
Bartek Iwańczuk
212b7dd6da
feat: Add requesting API name to permission prompt (#15936)
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2022-09-27 22:36:33 +02:00
Satya Rohith
7a47321b09
fix(ext/fetch): blob url (#16057)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-09-27 22:07:46 +05:30
Divy Srivastava
f02f2425d5
feat(ext/crypto): add x25519 and Ed25519 CFRG curves (#14119) 2022-09-27 17:43:42 +05:30
Marcos Casagrande
c7dd842f84
perf(ext/fetch): use content-length in InnerBody.consume (#15925)
This fast path prevents repeated allocations when receiving a fetch body with a known size.

Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-09-26 20:27:50 +02:00
Bartek Iwańczuk
075bdfd621
fix(require): tryPackage uses optional chaining (#16020) 2022-09-26 17:39:03 +02:00
李瑞丰
a2262c11d7
fix(ext/console): fix error when logging a proxied Date (#16018) 2022-09-26 23:55:58 +09:00
Marcos Casagrande
b73cb7bf9c
perf(ext/console): break on iterableLimit & better sparse array handling (#15935) 2022-09-26 15:55:22 +09:00
Ikko Ashimine
9a9dd12253
chore(ext/crypto): fix typo in import_key.rs (#16012)
eliptic -> elliptic
2022-09-24 11:46:52 +05:30
David Sherret
1b04ff0782
chore: forward v1.25.4 release commit to main (#16001) 2022-09-22 15:58:43 -04:00
David Sherret
716005a0d4
feat(npm): add flag for creating and resolving npm packages to a local node_modules folder (#15971) 2022-09-22 11:17:02 -04:00
Aapo Alasuutari
707e9e3580
feat(ops): Automatic fast ops creation (#15527) 2022-09-22 10:05:24 +05:30
Bartek Iwańczuk
35fe9ee530
fix(flash): panic if response if undefined (#15964)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-09-20 22:08:15 +02:00
Vicary A
2929ec9ffa
fix(ext/webgpu): make GPUDevice.features SetLike (#15853) 2022-09-20 03:43:32 +02:00
Ben Noordhuis
b1b418b81a
chore: fix clippy warnings (#15944)
Stop allowing clippy::derive-partial-eq-without-eq and fix warnings
about deriving PartialEq without also deriving Eq.

In one case I removed the PartialEq because it a) wasn't necessary,
and b) sketchy because it was comparing floating point numbers.

IMO, that's a good argument for enforcing the lint rule, because it
would most likely have been caught during review if it had been enabled.
2022-09-19 10:25:03 +02:00
Yoshiya Hinosawa
d7b27ed63b
fix(ext/node): fix builtin module module (#15904) 2022-09-17 20:35:32 +09:00
Divy Srivastava
5fe660ecd7
perf(web): optimize encodeInto() (#15922) 2022-09-17 16:48:15 +05:30
Marcos Casagrande
513e934fa7
refactor(ext/node): use primordials (#15912) 2022-09-17 12:35:04 +05:30
Ryan Dahl
684841a18c
upgrade deps (#15914) 2022-09-16 19:11:30 -04:00
Colin Ihrig
ee208c1b20
chore: forward v1.25.3 release commit to main (#15919)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-09-15 16:24:06 -04:00
Colin Ihrig
19deec4494
fix(ops): add node.js env variable allowlist (#15893)
This commit allows the Node compatibility layer to skip
environment variable permission checks when --unstable
is passed and the variable name is one that Node uses.

Fixes: https://github.com/denoland/deno/issues/15890
2022-09-14 11:59:20 -04:00
Divy Srivastava
b26d0b8a03
fix(ext/flash): don't block requests (#15852) 2022-09-13 22:24:27 +05:30
David Sherret
73efed218f
refactor(npm): create general use NpmPackageResolver (#15882) 2022-09-13 11:59:01 -04:00
David Sherret
98454c1eb8
fix(npm): support cjs resolution of package subpath with package.json (#15855) 2022-09-12 15:47:54 -04:00
Andrew Johnston
6d8f6d5af0
perf(url): return early if url has no query string (#15856) 2022-09-11 08:40:06 +05:30
Divy Srivastava
a3df6bb344
perf(ext/flash): remove string->buffer cache (#15850) 2022-09-10 21:53:00 +05:30
David Sherret
3b0de03b59
fix(npm): remove export binding to match node (#15837) 2022-09-10 11:38:11 -04:00
Divy Srivastava
a54d5654a2
perf: optimize URL serialization (#15663) 2022-09-10 09:15:16 +05:30
denobot
3bce2af0eb
chore: forward v1.25.2 release commit to main (#15831)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2022-09-09 20:31:43 +09:00
Bartek Iwańczuk
6c179daff0
fix(npm): recursive translation of reexports, remove window global in node code (#15806)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-09-08 22:01:48 +02:00
Leo Kettmeir
93cbac69e8
chore: update url crate to 2.3.1 (#15818) 2022-09-08 19:04:59 +02:00
Divy Srivastava
027d4d433d
perf(ops): inline &[u8] arguments and enable fast API (#15731) 2022-09-07 16:21:47 +05:30
Divy Srivastava
d57f9d560d
fix(ext/flash): use utf8 length as Content-Length (#15793) 2022-09-07 16:21:30 +05:30
Arnau Orriols
8bdc3c2baf
feat(ext/ffi): Implement FFI fast-call trampoline with Dynasmrt (#15305) 2022-09-07 12:23:56 +05:30
Divy Srivastava
d2a408f452
perf(runtime): short-circuit queue_async_op for Poll::Ready (#15773) 2022-09-06 23:08:37 +05:30
Bartek Iwańczuk
f2448c5de2
fix(npm): conditional exports in npm: specifiers (#15778) 2022-09-06 12:56:34 +02:00
Bartek Iwańczuk
264ad49e18
refactor: cleanup Node compatibility code (#15766)
- move errors related to Node compat from cli/node/errors.rs to "ext/node" crate
- remove dependency on "node_resolver" crate
- make some of structures private to the "cli/node" module
2022-09-05 12:36:35 +02:00
Aapo Alasuutari
16dbf4adc3
feat(ext/ffi): Support bool FFI type (#15754) 2022-09-05 08:56:52 +05:30
Bartek Iwańczuk
e324151520
BREAKING(unstable): remove --compat mode (#15678)
This commit removes "compat" mode. We shipped support for "npm:" specifier
support in v1.25 and that is preferred way to interact with Node code that we
will iterate and improve upon.
2022-09-03 18:19:30 +02:00
Garcia
4ec213b0aa
fix(ext/timers): create primordial eval (#15110) 2022-09-02 17:55:44 +02:00
Jason
8178665bd1
fix(cli/repl): await Promise.any([])... (#15623) 2022-09-02 13:38:06 +02:00
Nayeem Rahman
a74b2ecf37
fix(repl): don't terminate on unhandled error events (#15548) 2022-09-02 12:43:39 +02:00
denobot
658d2cdff2
chore: forward v1.25.1 release commit to main (#15735)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-09-02 07:42:47 +02:00
Divy Srivastava
20c835407c
fix(ext/flash): retry write failures (#15591) 2022-09-01 18:58:34 +05:30
Divy Srivastava
0abf5a412b
perf(ext/web): flatten op arguments for text_encoding (#15723) 2022-09-01 16:21:13 +05:30
Bartek Iwańczuk
b8933b1b56
chore: upgrade httparse to 1.8 (#15699) 2022-08-31 11:24:38 +02:00
David Sherret
5f251b283b
fix(npm): prefer importing esm from esm (#15676) 2022-08-30 14:09:22 -04:00
Leo Kettmeir
f3a0e48d4e
fix(docs): add missing categories (#15684) 2022-08-30 13:16:56 +02:00
Danny Povolotski
5e0fa5dd88
fix(ext/websocket): fix closing of WebSocketStream with unread messages (#15632) 2022-08-30 03:43:17 +02:00
Bartek Iwańczuk
a938aaf36f
fix(ext/node): better error for importing ES module via require() call (#15671) 2022-08-29 19:48:27 +02:00
Bartek Iwańczuk
2851a98072
fix(npm): conditional exports with wildcards (#15652) 2022-08-29 19:15:20 +02:00
pk
829bbad13f
chore(ext/flash): typo in lib.rs (#15662)
'Syncrhonous' -> 'Synchronous'
2022-08-29 12:14:43 +05:30
Divy Srivastava
d8396225c4
perf: use fast api for op_now (#15643) 2022-08-28 12:21:49 +05:30
Satya Rohith
19fb9abe33
chore(ext/webstorage): upgrade rusqlite to 0.28.0 (#15638) 2022-08-27 19:48:59 +05:30
Yoshiya Hinosawa
9b324b1cf4
fix(ext/node): fix global in node env (#15622) 2022-08-26 23:39:05 +09:00