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

672 commits

Author SHA1 Message Date
Asher Gomez
1b001d1b18
fix(permissions): process URL in Deno.FfiPermissionDescriptor.path for revoke() and request() (#17094)
Previously, `Deno.permissions.[revoke|request]()` wouldn't correctly
process the `path: URL` when `name` was `ffi`. This change fixes that
behaviour and adds a new function, `formDescriptor()`, to ensure `URL`
arguments are consistently handled across
`Deno.permissions.[query|revoke|request]()`.
2023-01-03 21:50:14 +01:00
David Sherret
10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
Bartek Iwańczuk
bece1ce057
feat(unstable): Add Deno.Conn.ref()/unref() (#17170)
This commit adds "Deno.Conn.ref()" and "Deno.Conn.unref()" methods.

These methods can be used to make connection block or not block the
event loop from finishing. Refing/unrefing only influences "read" 
operations - ie. scheduling writes to a connection _do_ keep event 
loop alive.

Required for https://github.com/denoland/deno/issues/16710
2022-12-28 10:29:48 +01:00
Kamil Ogórek
7ce2b58bcf
feat(unstable): Add "Deno.osUptime()" API (#17179)
This PR adds support for `Deno.osUptime` which reports number of seconds
since os was booted. It will allow us to be compatible with Node's `os.uptime` -
https://nodejs.org/api/os.html#osuptime

Partially based on
https://docs.rs/uptime_lib/latest/src/uptime_lib/lib.rs.html
2022-12-27 00:16:12 +01:00
Kamil Ogórek
2a61b5fdd4
fix(ext/fetch): Guard against invalid URL before its used by reqwest (#17164) 2022-12-23 17:39:14 +01:00
Luca Casonato
8e947bb674
fix(ext/http): close stream on resp body error (#17126)
Previously, errored streaming response bodies did not cause the HTTP
stream to be aborted. It instead caused the stream to be closed gracefully,
which had the result that the client could not detect the difference
between a successful response and an errored response.

This commit fixes the issue by aborting the stream on error.
2022-12-20 08:46:45 +00:00
Leo Kettmeir
80955dfa61
fix: display URL in invalid URL error (#17128) 2022-12-19 20:58:02 +01:00
Luca Casonato
d1f6b51990
test(ext/fetch): fix test in release mode (#17125) 2022-12-19 15:18:14 +01:00
Luca Casonato
43b6390629
fix(ext/fetch): handle errors in req body stream (#17081)
Right now an error in a request body stream causes an uncatchable
global promise rejection. This PR fixes this to instead propagate the
error correctly into the promise returned from `fetch`.

It additionally fixes errored readable stream bodies being treated as
successfully completed bodies by Rust.
2022-12-19 12:49:00 +01:00
David Sherret
e9ecfdd20a
fix(runtime): Deno.memoryUsage().rss should return correct value (#17088)
This commit changes implementation of "Deno.memoryUsage()" to return
correct value for "rss" field. To do that we implement a specialized function
per os to retrieve this information.
2022-12-17 23:25:51 +01:00
David Sherret
9e9e8f1e38
fix: upgrade to TS 4.9.4 (#17048) 2022-12-14 13:00:51 -05:00
Leo Kettmeir
5d9bb8b4b0
feat: support createNew in Deno.writeFile (#17023) 2022-12-13 05:12:49 +01:00
Leo Kettmeir
a2ba573e77
fix: default to "inherit" for Deno.Command#spawn()'s stdout & stderr (#17025) 2022-12-13 05:12:19 +01:00
Bartek Iwańczuk
cb6700fa5a
unstable: remove Deno.spawn, Deno.spawnSync, Deno.spawnChild APIs (#16893)
This commit removes three unstable Deno APIs:
- "Deno.spawn()"
- "Deno.spawnSync()"
- "Deno.spawnChild()"

These APIs were replaced by a unified "Deno.Command" API.
2022-12-09 16:43:36 +01:00
David Sherret
f4385866f8
feat: upgrade to TypeScript 4.9.3 (#16973)
Updated from: https://github.com/denoland/TypeScript/pull/2
2022-12-07 12:59:59 -05:00
Luca Casonato
923370f18f
fix(ext/fetch): new Request should soft clone (#16869)
Previously the inner request object of the original and the new request
were the same, causing the requests to be entangled and mutable changes
to one to be visible to the other. This fixes that.
2022-12-06 09:39:04 +01:00
David Sherret
f4b8c2ea7d
chore: fix flaky netListenUnrefAndRef (#16892)
Closes #16890
2022-12-02 12:41:52 -05:00
Bartek Iwańczuk
4d07ed0efa
chore: rewrite tests and utils to use Deno.Command API (#16895)
Since "Deno.spawn()", "Deno.spawnSync()" and "Deno.spawnChild"
are getting deprecated, this commits rewrites all tests and utilities to
use "Deno.Command" API instead.
2022-12-02 14:43:17 +01:00
Leo Kettmeir
1dd4843b62
feat(unstable): rework Deno.Command (#16812)
Refactors the `Deno.Command` class to not handle any state, but only being an intermediary to calling its methods, and as such any methods and properties besides `output`, `outputSync` & `spawn` have been removed. Interracting with a `spawn`ed subprocess now works by using the methods and properties on the returned class of the `spawn` method.
2022-11-28 12:33:51 +01:00
Bartek Iwańczuk
0012484f4f
Revert "fix(ext/flash): graceful server startup/shutdown with unsettl… (#16839)
…ed promises in mind (#16616)"

This reverts commit fd023cf793.

There are reports saying that Vite is often hanging in 1.28.2 and this
is
the only PR that changed something with HTTP server. I think we should
hold off on trying to fix this and instead focus on #16787

CC @magurotuna
2022-11-27 04:50:14 +01:00
Yusuke Tanaka
fd023cf793
fix(ext/flash): graceful server startup/shutdown with unsettled promises in mind (#16616)
This PR resets the revert commit made by #16610, bringing back #16383
which attempts to fix the issue happening when we use the flash server
with `--watch` option enabled.
Also, some code changes are made to pass the regression test added in
#16610.
2022-11-24 18:38:09 +01:00
Bartek Iwańczuk
1ec357faf3
fix(inspector): ensure console methods provided by inspector are available (#16724) 2022-11-22 02:17:14 +01:00
Bartek Iwańczuk
5c7dc904fb
test: disable commandChildUnref flaky test (#16752) 2022-11-22 02:16:24 +01:00
Yoshiya Hinosawa
1d85c25205
fix(ext/webstorage): make web storages re-assignable (#16661) 2022-11-17 02:12:58 +09:00
Leo Kettmeir
52dc3ef1a4
feat(unstable): "Deno.Command()" API (#16516)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-13 14:00:24 -05:00
Yoshiya Hinosawa
336e96a114
fix(ext/flash): revert #16383 (graceful server startup/shutdown) (#16610)
#16383 made some of Node compat test cases flaky in deno_std (and when
it fails it causes segfaults).

See https://github.com/denoland/deno_std/issues/2882 for details
2022-11-13 17:35:28 +09:00
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
Yoshiya Hinosawa
9edcab524f
fix(ext/flash): revert #16284 and add test case (#16576) 2022-11-09 17:20:05 +09: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
Yoshiya Hinosawa
6fe9428805
fix(runtime): fix Deno.hostname on windows (#16530) 2022-11-04 04:00:53 +09:00
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
Divy Srivastava
e18950284f
Reland "perf(core): generate inlined wrappers for async ops" (#16455)
Reland https://github.com/denoland/deno/pull/16428
2022-10-28 16:50:17 +05:30
Divy Srivastava
115cc1e6ae
Revert "perf(core): generate inlined wrappers for async ops (#16428)" (#16443) 2022-10-27 16:58:27 +02:00
Divy Srivastava
02187966c1
perf(core): generate inlined wrappers for async ops (#16428)
V8's JIT can do a better job knowing the argument count and also enable
fast call path (in future).

This also lets us call async ops without `opAsync`:

```js
const { ops } = Deno.core;
await ops.op_void_async();
```

this patch: 4405286 ops/sec
main: 3508771 ops/sec
2022-10-27 19:10:48 +05:30
Colin Ihrig
37340e2386
chore(unstable): rename Deno.getUid() and Deno.getGid() (#16432)
This commit renames `Deno.getUid()` to `Deno.uid()` and renames
`Deno.getGid()` to `Deno.gid()`.
2022-10-26 16:37:48 -04:00
Luca Casonato
f4f1f4f0b6
feat(ext/net): reusePort for TCP on Linux (#16398) 2022-10-26 19:04:27 +00:00
Bartek Iwańczuk
ab0c33ebf8
feat: Stabilize Deno.consoleSize() API (#15933)
This commit stabilizes "Deno.consoleSize()" API. 

There is one change compared to previous unstable API,
in that the API doesn't accept any arguments. Console size
is established by querying syscalls for stdio streams at fd
0, 1 and 2.
2022-10-26 00:23:21 +02:00
Bartek Iwańczuk
1f6aeb430b
fix: listenTlsWithReuseAddr test (#16420) 2022-10-25 20:15:20 +02: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
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
Filip Skokan
b2d0f6e913
test(crypto): update crypto.getRandomValues calls (#16338)
[`crypto.getRandomValues`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)
does not return a Promise.
2022-10-18 14:00:26 +02:00
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
David Sherret
74be01273c
chore: upgrade internal deno_std to 0.160 (#16333) 2022-10-17 22:57:31 +00:00
Yoshiya Hinosawa
e41af14b2a
feat(unstable): add windowsRawArguments to SpawnOptions (#16319)
This change adds `windowsRawArguments` to `SpawnOptions`. The option enables
skipping the default quoting and escaping while creating the command on
windows.

The option works in a similar way as `windowsVerbatimArguments` in
child_process.spawn options in Node.js, and is necessary for simulating
it in `std/node`.

closes #8852
2022-10-17 19:51:25 +09:00
Marcos Casagrande
5252ff5dbd
fix(ext/cache): illegal constructor (#16205) 2022-10-16 23:03:17 +05:30
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