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

2021 commits

Author SHA1 Message Date
Luca Casonato
ed13d36e4b
fix(ext/node): add crypto and zlib constants (#24151) 2024-06-09 02:02:47 +02:00
Bartek Iwańczuk
3f3bb6a829
fix(ext/net): make node:http2 work with DENO_FUTURE=1 (#24144) 2024-06-09 01:54:26 +02:00
Luca Casonato
585ba28d47
fix(ext/websocket): correctly order messages when sending blobs (#24133)
Previously the asynchronous read of the blob would not block sends that
are started later. We now do this, but in such a way as to not regress
performance in the common case of not using `Blob`.
2024-06-08 18:36:43 +02:00
Luca Casonato
c1f23c5788
fix(ext/node): lossy UTF-8 read node_modules files (#24140)
Previously various reads of files in `node_modules` would error on
invalid UTF-8. These were cases involving:

- reading package.json from Rust
- reading package.json from JS
- reading CommonJS files from JS
- reading CommonJS files from Rust (for ESM translation)
- reading ESM files from Rust
2024-06-08 18:36:13 +02:00
Bartek Iwańczuk
9dc0e33e67
fix: upgrade deno_core (#24128)
Includes https://github.com/denoland/deno_core/pull/770 necessary
for https://github.com/denoland/deno/pull/24101.

Also includes https://github.com/denoland/deno_core/pull/769 that
fixes https://github.com/denoland/deno/issues/24098 and
https://github.com/denoland/deno/issues/24069 and
https://github.com/denoland/deno/issues/24089.
2024-06-07 17:47:15 +00:00
Divy Srivastava
3735a1a542
fix(ext/node): support stdin child_process IPC & fd stdout/stderr (#24106)
Add supports for "ipc" and fd options in child_process spawn API.

Internal changes: Adds a hidden rid and "ipc_for_internal_use" option to
Deno.Command. Used by `node:child_process`

Example:
```js
const out = fs.openSync("./logfile.txt", 'a')
const proc = spawn(process.execPath, ["./main.mjs", "child"], {
  stdio: ["ipc", out, "inherit"]
});
```

Ref #16753
2024-06-07 22:51:32 +05:30
Satya Rohith
708a619693
chore(ext/node): remove dead op (#24131) 2024-06-07 18:50:43 +05:30
David Sherret
386d5c8310
refactor: remove PermissionsContainer in deno_runtime (#24119)
Also removes permissions being passed in for node resolution. It was
completely useless because we only checked it for reading package.json
files, but Deno reading package.json files for resolution is perfectly
fine.

My guess is this is also a perf improvement because Deno is doing less
work.
2024-06-06 23:37:53 -04:00
denobot
4d531bf229
chore: forward v1.44.1 release commit to main (#24115)
This is the release commit being forwarded back to main for 1.44.1

Co-authored-by: devsnek <devsnek@users.noreply.github.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-06-06 03:23:10 +00:00
Ryan Dahl
c7894447eb
chore: upgrade trust-dns-resolver and friends (#24108)
To avoid duplicate winreg crate in #24056

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-06-05 23:39:39 +02:00
Bartek Iwańczuk
eb218c0f33
chore: upgrade dlint to 0.60.0 (#24041)
Factoring out `dlint` upgrade from
https://github.com/denoland/deno/pull/24034 as it
requires us to change the lint step on mac to use ARM runners.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-06-05 01:09:29 +02:00
ud2
29a075de2b
chore(ext/web): use Error.captureStackTrace in DOMException constructor (#23986)
This makes `DOMException`'s `stack` property behave the same as native
errors' – `stack` is now an own accessor property on every instance, and
the getter calls `Error.prepareStackTrace`.

Upgrades `deno_core` to 0.284.0.
---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-06-05 01:09:13 +02:00
Luca Casonato
d625b296d0
chore(ext/webgpu): clean up buffer_get_map_async (#24087) 2024-06-04 12:44:17 +02:00
Oliver Medhurst
13924fdb1b
fix(console): add missing AssertionError to js (#22358)
Previously it did not exist, so `assert` would crash the wrong way if it
failed.

Signed-off-by: CanadaHonk <honk@goose.icu>
2024-06-03 12:01:43 +02:00
Kenta Moriuchi
eda43c46de
fix: validate integer values in Deno.exitCode setter (#24068) 2024-06-02 21:29:01 -04:00
Divy Srivastava
f3ffffc682
fix(cron): enable chrono now feature (#24047) 2024-05-30 05:58:06 +00:00
denobot
9e2971d40f
1.44.0 (#24045)
Bumped versions for 1.44.0

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-05-30 04:49:23 +00:00
Aapo Alasuutari
d67ee9a08b
BREAKING(ffi/unstable): use BigInt representation in turbocall (#23983)
Built ontop of #23981, this sets FFI
turbocalls (Fast Call API) to use the BigInt representation.
2024-05-30 08:00:11 +05:30
Luke Edwards
13723f267e
feat: Add Deno.exitCode API (#23609)
This commits adds the ability to set a would-be exit code 
for the Deno process without forcing an immediate exit, 
through the new `Deno.exitCode` API.

- **Implements `Deno.exitCode` getter and setter**: Adds support for
setting
and retrieving a would-be exit code via `Deno.exitCode`.
This allows for asynchronous cleanup before process termination 
without immediately exiting.
- **Ensures type safety**: The setter for `Deno.exitCode` validates that
the provided value is a number, throwing a TypeError if not, to ensure
that
only valid exit codes are set.

Closes to #23605

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 23:16:27 +00:00
Divy Srivastava
a947c6fbf7
fix(ext/node): windows cancel stdin read in line mode (#23969)
This patch fixes stdin read hanging on user input when switching tty
mode on Windows

Fixes #21111

On Windows, when switching from line to raw mode:
- Cancel ongoing console read by writing a return keypress to its input
buffer. This blocks the main thread until any ongoing read has been
cancelled to prevent interference with the screen state.
- On the read thread, restore the cursor position to where it was before
writing the enter, undoing its effect on the screen state.
- Restart reading and notify the main thread.
2024-05-29 22:23:04 +05:30
Satya Rohith
4f9b23b366
fix(ext/node): don't encode buffer data as utf8 in http2 (#24016) 2024-05-29 11:34:34 +05:30
Bartek Iwańczuk
7d8a8a0461
fix(ext/http): flush gzip streaming response (#23991)
This commit changes `gzip` compression in `Deno.serve` API to flush data
after each write. There's a slight performance regression, but provided
test shows a scenario that was not possible before.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-05-28 22:46:04 +02:00
Marvin Hagemeister
8c9d1ba1d7
fix(ext/node/fs): position argument not applied (#24009)
We didn't honour the `position` options of `fd.read` and `fd.write`
because we checked if the buffer is of type `Buffer` instead of just
`Uint8Array`. Node does the latter. In doing so I noticed that the file
handle id was written to a public property which it definitely shouldn't
be. This was probably a typo.

Fixes https://github.com/denoland/deno/issues/23707
2024-05-28 14:30:31 +02:00
Marvin Hagemeister
a0ddf73058
fix(ext/node): add throwIfNoEntry option in fs.lstatSync (#24006)
We didn't support the `throwIfNoEntry` option for Node's `fs.lstatSync`
method. Note that the async variant doesn't have this option.

Fixes https://github.com/denoland/deno/issues/23996
2024-05-28 12:24:54 +02:00
Divy Srivastava
53606de634
BREAKING(ffi/unstable): always return u64 as bigint (#23981)
The mixed `number | bigint` representation was useful optimization for
pointers. Now, pointers are represented as V8 externals. As part of the
FFI stabilization effort we want to make `bigint` the only
representation for `u64` and `i64`.

BigInt representation performance is almost on par with mixed
representation with the added benefit that its less confusing and users
don't need manual checks and conversions for doing operations on the
value.

```
cpu: AMD Ryzen 5 7530U with Radeon Graphics
runtime: deno 1.43.6+92a8d09 (x86_64-unknown-linux-gnu)

file:///home/divy/gh/ffi/main.ts
benchmark                 time (avg)        iter/s             (min … max)       p75       p99      p995
-------------------------------------------------------------------------- -----------------------------
nop                        4.01 ns/iter 249,533,690.5     (3.97 ns … 10.8 ns) 3.97 ns 4.36 ns 9.03 ns
ret bigint                 7.74 ns/iter 129,127,186.8    (7.72 ns … 10.46 ns) 7.72 ns 8.11 ns 8.82 ns
ret i32                    7.81 ns/iter 128,087,100.5    (7.77 ns … 12.72 ns) 7.78 ns 8.57 ns 9.75 ns
ret bigint (add op)       15.02 ns/iter  66,588,253.2   (14.64 ns … 24.99 ns) 14.76 ns 19.13 ns 19.44 ns
ret i32    (add op)       12.02 ns/iter  83,209,131.8   (11.95 ns … 18.18 ns) 11.98 ns 13.11 ns 14.5 ns
```
2024-05-28 09:31:09 +05:30
charlotte ✨
506c275053
fix(ext/fs): truncate files when a ReadableStream is passed to writeFile (#23330)
Closes #19697. This fixes a bug where the writeFile API can create
partially-overwritten files which may lead to invalid / corrupt files or
data leakage. It also aligns the behavior of writing a ReadableStream
and writing a Uint8Array to the disk.
2024-05-28 00:14:35 +02:00
Milly
35e5159c8d
fix(ext/web): ReadableStream.from() allows Iterable instead of IterableIterator (#23903)
`createAsyncFromSyncIterator(x)` which is used in
`ReadableStream.from()` expects `x` as `Iterable` but, previous
implements specify `Iterator` or `IterableIterator`. If it was
`IterableIterator`, it would work, but if it was `Iterator`, an
exception will occur.

Tests have been merged into WPT.
https://github.com/web-platform-tests/wpt/pull/46365

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-27 21:29:54 +00:00
Marvin Hagemeister
8806eac634
fix(node): set default http server response code 200 (#23977)
Node sets the default HTTP response status code to 200 on the
`ServerResponse`. We initialised it as `undefined` before which caused a
problem with 11ty's dev server.

Thanks to @vrugtehagel for reporting this issue and finding the correct
fix as well 🎉

Fixes https://github.com/denoland/deno/issues/23970
2024-05-26 09:32:46 +02:00
Alex Gleason
f8975a8ecb
fix(ext/websocket): change default idleTimeout to 30s (#23985)
Change the default server websocket `idleTimeout` to 30s to work with common Nginx setups which have a default timeout of 60 seconds
2024-05-26 10:46:05 +05:30
Volker Schlecht
20dad295e2
feat(ext/webgpu): byow support for {Free,Open}BSD (#23832)
Both ports for the BSDs include patches to the same effect.
2024-05-23 10:43:23 -07:00
Satya Rohith
e450c6b7cb
fix(ext/node): return cancelled flag in get_response_body_chunk op (#23962)
The flag lets us exit from read loop without throwing an error when
the stream is cancelled.

This fixes gRPC cancellation example.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 23:01:20 +05:30
Bartek Iwańczuk
0b8deca08b
chore: update denokv_* crates (#23949)
Co-authored-by: losfair <zhy20000919@hotmail.com>
2024-05-23 16:35:16 +02:00
Divy Srivastava
aeafb7b39e
fix(ext/node): add stubs for perf_hooks.PerformaceObserver (#23958)
Fixes https://github.com/denoland/deno/issues/23943
2024-05-23 04:59:20 -07:00
Felipe Baltor
fa1ba256d2
refactor: remove custom utc_now in favor of chrono::Utc:now feature (#23888)
This PR removes the use of the custom `utc_now` function in favor of the
`chrono` implementation. It resolves #22864.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 13:59:11 +02:00
Milly
fa27350977
fix(ext/web): ReadableStream.from() ignores null Symbol.asyncIterator (#23910)
If `@@asyncIterator` is `null` or `undefined`, it should ignores and
fallback to `@@iterator`.

Tests have been merged into WPT.
https://github.com/web-platform-tests/wpt/pull/46374

The proposal of `ReadableStream.from` uses TC39 [GetIterator][] and
[GetMethod][] within it.
GetMethod treats null as undefined.
So if `@@asyncIterator` is `null` it should be ignored and fallback to
`@@iterator`.

[GetIterator]: https://tc39.es/ecma262/#sec-getiterator
[GetMethod]: https://tc39.es/ecma262/#sec-getmethod

```bash
> deno eval "ReadableStream.from({ [Symbol.asyncIterator]: null, [Symbol.iterator]: () => ({ next: () => ({ done: true }) }) }).pipeTo(new WritableStream())"
error: Uncaught (in promise) TypeError: obj[SymbolAsyncIterator] is not a function
ReadableStream.from({ [Symbol.asyncIterator]: null, [Symbol.iterator]: () => ({ next: () => ({ done: true }) }) }).pipeTo(new WritableStream())
               ^
    at getIterator (ext:deno_web/06_streams.js:5105:38)
    at Function.from (ext:deno_web/06_streams.js:5207:22)
    at file:///D:/work/js/deno/tests/wpt/suite/$deno$eval:1:16
```

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-23 13:55:07 +02:00
Asher Gomez
8a636d0600
feat(ext/fetch): Request.bytes() and Response.bytes() (#23823)
Closes #23790
2024-05-23 00:27:58 +00:00
Asher Gomez
4908d45758
feat(ext/fs): stabilize Deno.FsFile.unlock[Sync]() and Deno.FsFile.lock[Sync]() (#23754)
Related #22230
CC @dyedgreen
2024-05-23 09:17:00 +10:00
Luca Casonato
971f09abe4
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users
tampering with the global `Object` prototype.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 00:03:35 +02:00
Asher Gomez
6c167c64d6
feat(ext/fs): stabilize Deno.FsFile.syncData[Sync]() and Deno.FsFile.sync[Sync]() (#23733)
Closes #22230
2024-05-22 21:59:51 +00:00
Leo Kettmeir
7ab7a14db7
refactor(docs): use @experimental instead of @tags unstable (#23884) 2024-05-22 04:31:51 -07:00
Bartek Iwańczuk
fabd9a214b
chore: forward v1.43.6 release commit to main (#23936)
Bumped versions for 1.43.6

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-22 01:35:04 +00:00
snek
8f2d171404
feat(node): buffer isUtf8/isAscii (#23928)
Fixes: https://github.com/denoland/deno/issues/23657

Implements `isUtf8` and `isAscii` as ops.
2024-05-21 15:50:59 -07:00
Matt Mastracci
625d09937a
fix(ext/web): fix potential leak of unread buffers (#23923)
Because the buffers are `MaybeUninit<V8Slice<u8>`, and the owner of the
`BoundedBufferChannel` is not obligated to read each and every bit of
data, we may find that some buffers were not automatically dropped if
unread by the time the `BoundedBufferChannelInner` is dropped.

Possible repro:

```
Deno.serve(() => new Response(new ReadableStream({ start(controller) { controller.enqueue(new Uint8Array(100_000_000))  } })));
```

```bash
while true; do curl localhost:8000 | dd count=1; done
```
2024-05-21 17:45:33 +00:00
David Sherret
3d6ba1eaf1
perf: analyze cjs re-exports in parallel (#23894) 2024-05-21 10:35:51 -04:00
chirsz
529356cc12
fix(ext/webgpu): Allow depthClearValue to be undefined when depthLoadOp is not "clear" (#23850) 2024-05-20 13:47:04 -07:00
Marvin Hagemeister
eb97f110db
fix(node): stub findSourceMap for ava (#23899)
This stubs `findSourceMap` in `node:module` by always returning
`undefined` as if it never found a source map. This unblocks the `ava`
test runner.

Fixes https://github.com/denoland/deno/issues/18666
2024-05-20 16:42:42 +02:00
Marvin Hagemeister
fb3f82b9ea
fix(node): track SIG* listeners in process.listeners (#23890)
Some npm libraries like `signal-exit` rely on the length of the listener
array returned by `process.listeners("SIGNT")` to be correct to
function. We weren't tracking `SIG*` events there, which broke those npm
libraries.

Fixes https://github.com/denoland/deno/issues/22892
2024-05-20 15:24:13 +02:00
Marvin Hagemeister
d7709daaa0
fix(node): patch MessagePort in worker_thread message (#23871)
Our `MessagePort` to Node's `MessagePort` conversion logic was missing
the case where a `MessagePort` is sent _inside_ the message. This broke
`tinypool` which is used by `vitest` as it relies on some node specific
methods on `MessagePort`.

Fixes https://github.com/denoland/deno/issues/23854 , Fixes
https://github.com/denoland/deno/pull/23871
2024-05-20 15:01:40 +02:00
Bedis Nbiba
927cbb5ecd
fix: handle signal 0 in process.kill (#23473)
the last commit had a regression, where it removed this branch, I
haven't tested the code but I think it should work

---------

Signed-off-by: Bedis Nbiba <bedisnbiba@gmail.com>
2024-05-19 14:52:03 -04:00
David Sherret
a2dbcf9e0a
perf: analyze cjs exports and emit typescript in parallel (#23856) 2024-05-18 11:42:03 -04:00