Commit Graph

2513 Commits

Author SHA1 Message Date
Toby Ealden
c5a7f98d82
fix(ext/node): handle http2 server ending stream (#26235)
Closes #24845
2024-10-15 23:35:10 +05:30
Divy Srivastava
c7153838ec
fix(ext/node): implement TCP.setNoDelay (#26263)
Fixes https://github.com/denoland/deno/issues/26177

The significant delay was caused by Nagel's algorithm + delayed ACKs in
Linux kernels. Here's the [kernel
patch](https://lwn.net/Articles/502585/) which added 40ms
`tcp_default_delack_min`

```
$ deno run -A pg-bench.mjs # main
Tue Oct 15 2024 12:27:22 GMT+0530 (India Standard Time): 42ms

$ target/release/deno run -A pg-bench.mjs # this patch
Tue Oct 15 2024 12:28:02 GMT+0530 (India Standard Time): 1ms
```

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

import pg from 'pg'
const { Client } = pg
const client = new Client({
    connectionString: 'postgresql://postgres:postgres@127.0.0.1:5432/postgres'
})
await client.connect()

async function fetch() {
    const startPerf = performance.now();
    const res = await client.query(`select
        $1::int as int,
        $2 as string,
        $3::timestamp with time zone as timestamp,
        $4 as null,
        $5::bool as boolean,
        $6::bytea as bytea,
        $7::jsonb as json
      `, [
        1337,
        'wat',
        new Date().toISOString(),
        null,
        false,
        Buffer.from('awesome'),
        JSON.stringify([{ some: 'json' }, { array: 'object' }])
    ])
    console.log(`${new Date()}: ${Math.round(performance.now() - startPerf)}ms`)
}

for(;;) await fetch();
```
2024-10-15 14:47:12 +05:30
David Sherret
7f3747f2ef
perf(http): avoid clone getting request method and url (#26250) 2024-10-14 23:25:47 -04:00
David Sherret
4c9eee3ebe
perf(http): cache webidl.converters lookups in ext/fetch/23_response.js (#26256) 2024-10-14 23:25:18 -04:00
Leo Kettmeir
ee7d450143
refactor(ext/ffi): use concrete error types (#26170) 2024-10-14 15:05:49 -07:00
Mohammad Sulaiman
8dbe77dd29
fix(console/ext/repl): support using parseFloat() (#25900)
Fixes #21428

Co-authored-by: tannal <tannal2409@gmail.com>
2024-10-14 15:04:18 -07:00
Leo Kettmeir
48cbf85add
refactor(ext/url): use concrete error types (#26172) 2024-10-14 14:15:31 -07:00
Leo Kettmeir
cb385d9e4a
refactor(ext/webstorage): use concrete error types (#26173) 2024-10-14 13:53:17 -07:00
Divy Srivastava
dfbf03eee7
perf: use fast calls for microtask ops (#26236)
Updates deno_core to 0.312.0
2024-10-14 12:31:51 +00:00
Divy Srivastava
bbad7c5922
fix(ext/node): compute pem length (upper bound) for key exports (#26231)
Fixes https://github.com/denoland/deno/issues/26188
2024-10-14 14:24:26 +05:30
Divy Srivastava
68b388a93a
fix(ext/node): allow writing to tty columns (#26201)
Behave similar to Node.js where modifying `stdout.columns` doesn't
really resize the terminal. Ref
https://github.com/nodejs/node/issues/17529

Fixes https://github.com/denoland/deno/issues/26196
2024-10-14 14:00:02 +05:30
Divy Srivastava
7c3da2ec1c
fix(ext/webgpu): allow GL backend on Windows (#26206)
It should be supported according to
[this](https://github.com/gfx-rs/wgpu?tab=readme-ov-file#supported-platforms).

Fixes https://github.com/denoland/deno/issues/26144
2024-10-14 11:10:27 +05:30
Leo Kettmeir
64c304a452
refactor(ext/tls): use concrete error types (#26174) 2024-10-12 16:53:38 -07:00
Leo Kettmeir
2ac699fe6e
refactor(ext/cron): use concrete error type (#26135) 2024-10-12 14:23:49 -07:00
Nathan Whitaker
4f89225f76
fix(node/util): export styleText from node:util (#26194)
Fixes #26184.

It was added but not publicly exported.
2024-10-12 19:36:23 +00:00
Leo Kettmeir
8b2c6fc2d2
refactor(ext/canvas): use concrete error type (#26111) 2024-10-12 10:00:35 -07:00
Leo Kettmeir
938a8ebe34
refactor(ext/cache): use concrete error type (#26109) 2024-10-12 09:15:10 -07:00
Leo Kettmeir
3df8f16500
refactor(ext/broadcastchannel): use concrete error type (#26105) 2024-10-12 08:20:17 -07:00
Marvin Hagemeister
9117a9a43c
fix(node): make process.stdout.isTTY writable (#26130)
Fixes https://github.com/denoland/deno/issues/26123
2024-10-11 19:14:10 +02:00
denobot
a62c7e036a
2.0.0 (#26063)
Bumped versions for 2.0.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-08 07:37:28 -07:00
Satya Rohith
ff4e682ff9
fix(ext/node): internal buffer length in readSync (#26064)
Closes https://github.com/denoland/deno/issues/26054
2024-10-08 10:41:32 +00:00
Marvin Hagemeister
2d488e4bfb
fix(console): missing cause property on non-error objects (#26061)
Fixes https://github.com/denoland/deno/issues/26047
2024-10-08 12:10:19 +02:00
Leo Kettmeir
9a92603a14
fix(ext/webstorage): make getOwnPropertyDescriptor with symbol return undefined (#13348)
Closes #13347
2024-10-07 07:59:27 -07:00
Divy Srivastava
39a2034967
feat(ext/crypto): X448 support (#26043)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-10-07 12:04:40 +01:00
David Sherret
2de4faa483
refactor: improve node permission checks (#26028)
Does less work when requesting permissions with `-A`
2024-10-04 20:55:41 +01:00
Nathan Whitaker
dd8cbf5e29
fix(node): fix worker_threads issues blocking Angular support (#26024)
Fixes #22995. Fixes #23000.

There were a handful of bugs here causing the hang (each with a
corresponding minimized test):

- We were canceling recv futures when `receiveMessageOnPort` was called,
but this caused the "receive loop" in the message port to exit. This was
due to the fact that `CancelHandle`s are never reset (i.e., once you
`cancel` a `CancelHandle`, it remains cancelled). That meant that after
`receieveMessageOnPort` was called, the subsequent calls to
`op_message_port_recv_message` would throw `Interrupted` exceptions, and
we would exit the loop.

The cancellation, however, isn't actually necessary.
`op_message_port_recv_message` only borrows the underlying port for long
enough to poll the receiver, so the borrow there could never overlap
with `op_message_port_recv_message_sync`.

- Calling `MessagePort.unref()` caused the "receive loop" in the message
port to exit. This was because we were setting
`messageEventListenerCount` to 0 on unref. Not only does that break the
counter when multiple `MessagePort`s are present in the same thread, but
we also exited the "receive loop" whenever the listener count was 0. I
assume this was to prevent the recv promise from keeping the event loop
open.

Instead of this, I chose to just unref the recv promise as needed to
control the event loop.

- The last bug causing the hang (which was a doozy to debug) ended up
being an unfortunate interaction between how we implement our
messageport "receive loop" and a pattern found in `npm:piscina` (which
angular uses). The gist of it is that piscina uses an atomic wait loop
along with `receiveMessageOnPort` in its worker threads, and as the
worker is getting started, the following incredibly convoluted series of
events occurs:
   1. Parent sends a MessagePort `p` to worker
   2. Parent sends a message `m` to the port `p`
3. Parent notifies the worker with `Atomics.notify` that a new message
is available
   4. Worker receives message, adds "message" listener to port `p`
   5. Adding the listener triggers `MessagePort.start()` on `p`
6. Receive loop in MessagePort.start receives the message `m`, but then
hits an await point and yields (before dispatching the "message" event)
7. Worker continues execution, starts the atomic wait loop, and
immediately receives the existing notification from the parent that a
message is available
8. Worker attempts to receive the new message `m` with
`receiveMessageOnPort`, but this returns `undefined` because the receive
loop already took the message in 6
9. Atomic wait loop continues to next iteration, waiting for the next
message with `Atomic.wait`
10. `Atomic.wait` blocks the worker thread, which prevents the receive
loop from continuing and dispatching the "message" event for the
received message
11. The parent waits for the worker to respond to the first message, and
waits
12. The thread can't make any more progress, and the whole process hangs

The fix I've chosen here (which I don't particularly love, but it works)
is to just delay the `MessagePort.start` call until the end of the event
loop turn, so that the atomic wait loop receives the message first. This
prevents the hang.

---

Those were the main issues causing the hang. There ended up being a few
other small bugs as well, namely `exit` being emitted multiple times,
and not patching up the message port when it's received by
`receiveMessageOnPort`.
2024-10-04 09:26:32 -07:00
Divy Srivastava
e54809f2d5
fix(ext/crypto): fix identity test for x25519 derive bits (#26011) 2024-10-03 16:46:48 +05:30
Leo Kettmeir
1837aed79b
Revert "fix(urlpattern): fallback to empty string for undefined group values" (#25961) 2024-10-02 09:02:46 -07:00
denobot
55c2a88099
chore: release deno_* crates (#25987)
Testing once again if the crates are being properly released.

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02 14:27:34 +00:00
denobot
2d3e0284d9
chore: release deno_* crates (#25976)
Test run before Deno 2.0 release to make sure that the publishing
process passes correctly.

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02 14:44:04 +02:00
Satya Rohith
32c1278736
feat(ext/node): buffer.transcode() (#25972)
Closes https://github.com/denoland/deno/issues/25911
2024-10-02 08:23:14 +00:00
Divy Srivastava
620e6b43a6
fix(ext/node): remove unimplemented promiseHook stubs (#25979)
`temporalio` sdk [will try to
use](faa64225a7/packages/worker/src/workflow/vm-shared.ts (L199-L202))
promiseHook if it is found. This patch removes the unimplemented stubs.

```ts
    if (promiseHooks) {
      // Node >=16.14 only
      this.stopPromiseHook = promiseHooks.createHook({
        init: (promise: Promise<unknown>, parent: Promise<unknown>) => {
```

Fixes https://github.com/denoland/deno/issues/25977
2024-10-02 12:52:05 +05:30
Ian Bull
41a70898ad
refactor(ext): align error messages (#25914)
Aligns the error messages in the ext folder to be in-line with the Deno
style guide.

https://github.com/denoland/deno/issues/25269

<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/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.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
2024-10-01 14:26:06 -04:00
David Sherret
5faf769ac6
refactor: extract out sloppy imports resolution from CLI crate (#25920)
This is slow progress towards creating a `deno_resolver`  crate.

Waiting on:

* https://github.com/denoland/deno/pull/25918
* https://github.com/denoland/deno/pull/25916
2024-09-28 19:17:48 -04:00
David Sherret
1bb47805d6
refactor: move NpmCacheDir to deno_cache_dir (#25916)
Part of the ongoing work to move more of Deno's resolution out of the
CLI crate (for use in Wasm and other things)

Includes:

* https://github.com/denoland/deno_cache_dir/pull/60
2024-09-28 08:50:16 -04:00
David Sherret
fc739dc5eb
refactor: use deno_path_util (#25918) 2024-09-28 07:55:01 -04:00
Nathan Whitaker
fbddd5a2eb
fix(node): Pass NPM_PROCESS_STATE to subprocesses via temp file instead of env var (#25896)
Fixes https://github.com/denoland/deno/issues/25401. Fixes
https://github.com/denoland/deno/issues/25841. Fixes
https://github.com/denoland/deno/issues/25891.
2024-09-27 12:35:37 -07:00
Luca Casonato
3134abefa4
BREAKING(ext/net): improved error code accuracy (#25383)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-27 14:07:20 +00:00
Asher Gomez
88a4f8dd97
chore: update simd-json (#25897) 2024-09-27 14:57:27 +10:00
Divy Srivastava
121d9697a1
fix(ext/node): fix process.stdin.pause() (#25864)
Fixes https://github.com/denoland/deno/issues/25844
2024-09-26 08:47:29 +05:30
Divy Srivastava
7d7e541724
fix(ext/node): Fix vm sandbox object panic (#24985) 2024-09-24 15:47:13 +05:30
David Sherret
33f169beb9
chore: add code generation for @types/deno (#25545) 2024-09-23 19:18:52 +00:00
Divy Srivastava
bfdca5bc7a
feat(ext/crypto): import and export p521 keys (#25789)
Towards https://github.com/denoland/deno/issues/13449
2024-09-23 19:40:36 +05:30
carles escrig royo
8f32a1577e
fix(ext/web): don't ignore capture in EventTarget.removeEventListener (#25788) 2024-09-23 11:19:59 +02:00
Volker Schlecht
37cedefb4d
fix(ext/node): stub cpu_info() for OpenBSD (#25807)
Add an implementation of cpu_info() for OpenBSD, that returns a
correctly-sized array. Since Rust's libc bindings for OpenBSD do not
contain all symbols necessary for a full implementation and it is not
planned to add them, this solution at least avoids problems with code
that relies on cpu_info() purely for the size of the returned array to
derive the number of available CPUs.

This addresses https://github.com/denoland/deno/issues/25621
2024-09-23 09:08:16 +05:30
Divy Srivastava
0cb00a6e89
BREAKING(webgpu/unstable): move width and height options to UnsafeWindowSurface constructor (#24200)
Fixes https://github.com/denoland/deno/issues/23508

`width` and `height` are required to configure the wgpu surface because
Deno is headless and depends on user to create a window. The options
were non-standard extension of `GPUCanvasConfiguration#configure`.

This PR adds a required options parameter with the `width` and `height`
options to `Deno.UnsafeWindowSurface` constructor.

```typescript
// Old, non-standard extension of GPUCanvasConfiguration
const surface = new Deno.UnsafeWindowSurface("x11", displayHandle, windowHandle);

const context  = surface.getContext();
context.configure({ width: 600, height: 800, /* ... */ });
```

```typescript
// New
const surface = new Deno.UnsafeWindowSurface({
  system: "x11",
  windowHandle,
  displayHandle,
  width: 600,
  height: 800,
});

const context  = surface.getContext();
context.configure({ /* ... */ });
```
2024-09-22 09:10:54 +05:30
Nathan Whitaker
9be8dce0c7
fix(node): Include "node" condition during CJS re-export analysis (#25785)
Fixes #25777.

We were missing the "node" condition, so we were resolving to the wrong
conditional export, causing our analysis to be incorrect.
2024-09-21 16:10:38 -07:00
Nathan Whitaker
4b022103a1
chore: Revert child_process close ordering change (#25781)
From
https://github.com/denoland/deno/commit/18b89d948dcb849c4dc577478794c3d5fb23b59

May have caused the recent flakiness of
parallel/test-child-process-ipc-next-tick.js
2024-09-20 23:46:42 +00:00
carles escrig royo
88a469e823
perf(ext/web): optimize performance.measure() (#25774)
This PR optimizes the case when `performance.measure()` needs to find
the startMark by name. It is a simple change on `findMostRecent` fn to
avoiding copying and reversing the complete entries list.

Adds minor missing tests for:
- `clearMarks()`, general
- `clearMeasures()`, general
- `measure()`, case when the startMarks name exists more than once

### Benchmarks

#### main

```
    CPU | AMD Ryzen 7 PRO 6850U with Radeon Graphics
Runtime | Deno 2.0.0-rc.4 (x86_64-unknown-linux-gnu)

benchmark              time/iter (avg)        iter/s      (min … max)           p75      p99     p995
---------------------- ----------------------------- --------------------- --------------------------
worst case measure()            2.1 ms         486.9 (  1.7 ms …   2.4 ms)   2.2 ms   2.4 ms   2.4 ms
```

#### this PR

```
    CPU | AMD Ryzen 7 PRO 6850U with Radeon Graphics
Runtime | Deno 2.0.0-rc.4 (x86_64-unknown-linux-gnu)

benchmark              time/iter (avg)        iter/s      (min … max)           p75      p99     p995
---------------------- ----------------------------- --------------------- --------------------------
worst case measure()          966.3 µs         1,035 (876.9 µs …   1.1 ms)   1.0 ms   1.1 ms   1.1 ms
```

```ts
Deno.bench("worst case measure()", (b) => {
  performance.mark('start');

  for (let i = 0; i < 1e5; i += 1) {
    performance.mark(crypto.randomUUID());
  }

  b.start();

  performance.measure('total', 'start');

  b.end();

  performance.clearMarks();
  performance.clearMeasures();
});
```
2024-09-20 16:24:59 -07:00
Divy Srivastava
92fc702cec
fix(ext/crypto): ensure EC public keys are exported uncompressed (#25766)
Fixes https://github.com/denoland/deno/issues/18050
2024-09-20 20:59:05 +05:30
Divy Srivastava
a92ebd95a1
fix(ext/crypto): reject empty usages in SubtleCrypto#importKey (#25759)
Fixes https://github.com/denoland/deno/issues/19051
2024-09-20 18:02:28 +05:30
snek
a01dce3a25
fix: cjs resolution cases (#25739)
Fixes cjs modules being loaded as esm.
2024-09-19 21:10:34 -07:00
Nathan Whitaker
f1ba266613
fix(node): Don't error out if we fail to statically analyze CJS re-export (#25748)
Fixes rsbuild running in deno.

You can look at the test to see what was failing, the gist is that we
were trying to statically analyze the re-exports of a CJS script, and if
we couldn't find the source for the re-exported file we would fail.

Instead, we should just treat these as if they were too dynamic to
analyze, and let it fail (or succeed) at runtime. This aligns with
node's behavior.
2024-09-19 18:37:36 -07:00
Divy Srivastava
e97f00f6f6
fix(ext/node): support x509 certificates in createPublicKey (#25731)
Fixes https://github.com/denoland/deno/issues/25681
2024-09-19 19:12:23 +05:30
Luca Casonato
159ac45a85
fix(ext/console): more precision in console.time (#25723) 2024-09-19 14:41:05 +02:00
Sean McArthur
68065351df
fix(ext/fetch): fix lowercase http_proxy classified as https (#25686)
While investigating something else, I noticed this typo which treated
`http_proxy` as `Filter::Https`.
2024-09-19 08:03:07 +00:00
Ian Bull
d420829908
refactor(ext/kv): align error messages (#25500)
Towards https://github.com/denoland/deno/issues/25269
2024-09-19 13:20:09 +05:30
Ian Bull
3035cdddb8
refactor(ext/webidl): align error messages (#25625)
Towards https://github.com/denoland/deno/issues/25269
2024-09-19 13:03:32 +05:30
Ian Bull
486cb18fc5
refactor(ext/webgpu): align error messages (#25719)
Aligns the error messages in the ext/webgpu folder to be in-line with
the Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-19 09:14:54 +02:00
Yoshiya Hinosawa
f460188e58
fix(ext/node): don't throw error for unsupported signal binding on windows (#25699) 2024-09-19 12:22:01 +09:00
Ian Bull
282c4c262d
refactor(ext): align error messages (#25496)
Aligns the error messages in the ext/http and a few messages in the
ext/fetch folder to be in-line with the Deno style guide.

This change-set also removes some unnecessary checks in the 00_serve.ts.
These options were recently removed, so it doesn't make sense to check
for them anymore.

https://github.com/denoland/deno/issues/25269
2024-09-18 18:19:45 -07:00
Luca Casonato
7a41a93997
fix(ext/http): gracefully handle Response.error responses (#25712)
Fixes #14371
2024-09-18 21:14:40 +02:00
Luca Casonato
ab1e391e1d
feat(ext/node): add rootCertificates to node:tls (#25707)
Closes https://github.com/denoland/deno/issues/25604

Signed-off-by: Satya Rohith <me@satyarohith.com>
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-09-18 21:14:26 +02:00
David Sherret
3dd83fdbdb
Revert "feat(fmt): sort type-only named import/exports last" (#25705)
Reverts #25690

This was not an issue with the ts compiler anymore. Discussion here:
https://github.com/dprint/dprint-plugin-typescript/pull/664#issuecomment-2357000053
2024-09-18 13:54:52 +00:00
Ian Bull
97b8c9be38
refactor(ext/websocket): align error messages (#25622)
Aligns the error messages in the ext/websocket folder to be in-line with
the Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-17 15:32:12 -07:00
Divy Srivastava
063f427ddf
fix(ext/node): stub inspector/promises (#25635)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-09-17 22:57:19 +05:30
David Sherret
a14e9f55b4
feat(fmt): sort type-only named import/exports last (#25690)
Closes #22583
2024-09-17 18:26:23 +01:00
Bartek Iwańczuk
aaf2bf4bfb
chore: upgrade deno_core (#25674)
No functional changes, just removes dead code.
2024-09-17 01:13:34 +00:00
David Sherret
62e952559f
refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)
This makes the permission system more versatile.
2024-09-16 21:39:37 +01:00
Luca Casonato
8fa92228bb
fix(types): simplify mtls related types (#25658)
Instead of two overloads for `Deno.connectTls` and
`Deno.createHttpClient`, there is now just one.
2024-09-16 14:35:55 +02:00
Luca Casonato
74069add3f
fix(runtime): don't error child.output() on consumed stream (#25657)
This fixes the fast path for `readableStreamCollectIntoUint8Array` to
only trigger if the readable stream has not yet been disturbed -
because otherwise we may not be able to close it if the
read errors.
2024-09-16 14:23:40 +02:00
Luca Casonato
81c9e0ba25
fix(ext/crypto): support md4 digest algorithm (#25656)
Fixes #25646
2024-09-16 11:04:40 +00:00
Divy Srivastava
db6fc12b9e
fix(ext/node): add vm.constants (#25630) 2024-09-15 08:15:28 +05:30
Divy Srivastava
4655172c0b
fix(ext/node): export process.allowedNodeEnvironmentFlags (#25629) 2024-09-15 08:15:19 +05:30
Divy Srivastava
ccd1ca8a8b
fix(ext/node): add stubs for node:trace_events (#25628) 2024-09-15 08:15:09 +05:30
Marvin Hagemeister
597f2d8d4d
feat: print Listening on messages on stderr instead of stdout (#25491)
Fixes https://github.com/denoland/deno/issues/25114

---------

Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
2024-09-14 23:30:06 +02:00
snek
2c0bf6fd65
fix(ext/node): attach console stream properties (#25617)
`kBindStreamsLazy` should be called with `process` during init, but it
never was.
2024-09-13 17:28:35 -07:00
Jake Abed
d162733db2
fix(ext/node): use primordials in ext/node/polyfills/wasi.ts (#25608)
Toward #24236
2024-09-13 22:31:07 +05:30
Nathan Whitaker
7477c2d706
feat(serve): Support second parameter in deno serve (#25606)
Closes #24099
2024-09-12 23:32:28 +00:00
Bartek Iwańczuk
71d5d47ca9
feat(ext/node): export 'promises' symbol from 'node:timers' (#25589) 2024-09-12 20:30:49 +00:00
Nathan Whitaker
18b89d948d
fix(ext/node): Implement detached option in child_process (#25218)
Fixes https://github.com/denoland/deno/issues/25193.
2024-09-12 19:24:58 +00:00
Yoshiya Hinosawa
3f15e30062
fix(ext/node): fix Decipheriv when autoPadding disabled (#25598)
This change fixes Decipheriv behavior when autoPadding disabled and enabled.

By this change, the example given in
https://github.com/denoland/deno/issues/20924#issuecomment-2345931295
works in the same way as Node.

closes #20924
2024-09-13 01:13:56 +09:00
Asher Gomez
9e8f84214f
refactor: cleanup unstable checks for WebGPU, FFI and FS APIs (#25586)
Continuation of work in #25488.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-12 12:27:16 +00:00
MujahedSafaa
4983f763d4
fix(ext/console): prevent duplicate error printing when the cause is assigned (#25327)
This commit fixes the error format when the cause is assigned
separately, ensuring that the cause is only printed once instead of
twice.

The fix addresses issue
[#21651](https://github.com/denoland/deno/issues/21651).
2024-09-12 05:02:32 -07:00
Bartek Iwańczuk
46d5f38a0f
fix(ext/node): export request and response clases from http2 module (#25592)
Closes https://github.com/denoland/deno/issues/20612
Closes https://github.com/denoland/deno/issues/23326

This makes `qwik` work.
2024-09-12 02:03:57 +00:00
Bartek Iwańczuk
f794781ffb
feat(ext/node): expose ES modules for _ modules (#25588)
Exposes following modules:
- `"node:_http_agent"`
- `"node:_http_common"`
- `"node:_http_outgoing"`
- `"node:_http_server"`
- `"node:_stream_duplex"`
- `"node:_stream_passthrough"`
- `"node:_stream_readable"`
- `"node:_stream_transform"`
- `"node:_stream_writable"`
- `"node:_tls_common"`
- `"node:_tls_wrap"`
2024-09-12 00:52:08 +00:00
Asher Gomez
8476bbff9a
feat: stabilize Deno.createHttpClient() (#25569)
Closes #25518
2024-09-12 10:46:48 +10:00
Bartek Iwańczuk
3a3837545c
feat(ext/node): export missing symbols from domain, puncode, repl, tls (#25585) 2024-09-12 02:25:46 +02:00
Bartek Iwańczuk
3f6605d123
feat(ext/node): export missing constants from 'zlib' module (#25584)
That puts us at 99.5% compatibility for this module.
2024-09-12 01:12:10 +02:00
Bartek Iwańczuk
05bd547238
feat(ext/node): export more symbols from streams and timers/promises (#25582) 2024-09-12 01:02:50 +02:00
Yoshiya Hinosawa
aae3a6bcb4
fix(ext/node): fix Cipheriv#update(string, undefined) (#25571) 2024-09-11 19:24:17 +09:00
Yoshiya Hinosawa
200145a09a
fix(ext/node): avoid showing UNKNOWN error from TCP handle (#25550) 2024-09-11 19:19:02 +09:00
Yoshiya Hinosawa
8bdd364dd5
fix(ext/node): add FileHandle#writeFile (#25555)
This PR adds `writeFile` methods of `FileHandle` class
https://nodejs.org/api/fs.html#filehandlewritefiledata-options
2024-09-11 11:08:40 +02:00
Jake Abed
87bc47b3bf
fix(ext/node): use primordials in ext/node/polyfills/console.ts (#25572)
Contributing toward #24236

- Swapped `Object.assign` for `ObjectAssign` primordial.
- Removed referencing TODO comment.

Please disregard if no longer desired.
2024-09-11 17:55:58 +10:00
Yoshiya Hinosawa
ef2d98fe11
fix(ext/node): validate input lengths in Cipheriv and Decipheriv (#25570)
addresses the first part of #25279
2024-09-11 13:27:07 +09:00
Nathan Whitaker
1521adf5ed
fix(ext/node): Add missing node:fs and node:constants exports (#25568)
Just a bunch of random fs constants
2024-09-11 00:37:23 +00:00
Nathan Whitaker
acd62786c2
fix(ext/node): Add missing node:path exports (#25567)
Apparently `path/posix` and `path/win32` have circular exports. I do not
know why.

Additionally there's a deprecated function `_makeLong` which is just
`toNamespacedPath`
2024-09-11 00:00:08 +00:00
Asher Gomez
4865ae13e1
BREAKING(net): remove Deno.[Tls]Listener.prototype.rid (#25556)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-11 01:14:50 +02:00
Asher Gomez
ace1202227
BREAKING(net): remove Deno.ConnectTlsOptions.{certChain,certFile,privateKey} and Deno.ListenTlsOptions.certChain,certFile,keyFile} (#25525)
Towards #22079
2024-09-10 21:55:42 +00:00
Nathan Whitaker
be0ba6d84f
fix(ext/node): Rewrite node:v8 serialize/deserialize (#25439)
Closes #20613.

Reimplements the serialization on top of the v8 APIs instead of
deno_core. Implements `v8.Serializer`, `v8.DefaultSerializer`,
`v8.Deserializer`, and `v8.DefaultSerializer`.
2024-09-10 21:50:21 +00:00
Kenta Moriuchi
e522f4b65a
BREAKING(temporal/unstable): Remove obsoleted Temporal APIs part 2 (#25505)
Mainly I removed `Temporal.Calendar` and `Temporal.TimeZone` and
replaced them to APIs that handle calendar and timezone as strings.
https://github.com/tc39/proposal-temporal/pull/2925

Related #24836
2024-09-10 21:36:43 +00:00
Asher Gomez
a69b1e699e
BREAKING(fs): remove Deno.FsFile.prototype.rid (#25499)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-11 07:19:34 +10:00
snek
f9007d3386
feat: require(esm) (#25501)
implement require(esm) using `op_import_sync` from deno_core.

possible future changes:
- cts and mts
- replace Deno.core.evalContext to optimize esm syntax detection

Fixes: https://github.com/denoland/deno/issues/25487
2024-09-10 20:12:36 +00:00
snek
ee3829a778
fix: linux canonicalization checks (#24641)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/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.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
2024-09-10 12:35:41 -07:00
Luca Casonato
7bfcb4dd10
feat(cli): use NotCapable error for permission errors (#25431)
Closes #7394

---------

Co-authored-by: snek <snek@deno.com>
2024-09-10 11:12:24 -07:00
Divy Srivastava
c4d088863e
fix(inspector): Fix panic when re-entering runtime ops (#25537)
Mark `op_require_break_on_next_statement` as reentrant and properly
release borrow on the `OpState`. This fixes `BorrowMut` assertions when
running with inspector + op metrics.

Fixes https://github.com/denoland/deno/issues/25515
2024-09-10 08:14:26 +05:30
Bartek Iwańczuk
4af98fa82f
build: remove --unstable flags from CI (#25548)
This commit removes usages of deprecated `--unstable` flag
from the CI scripts.
2024-09-10 03:10:20 +02:00
Asher Gomez
a445ebd74f
BREAKING(fs): remove Deno.fsync[Sync]() (#25448)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-09 22:39:56 +00:00
Asher Gomez
aadcf3346c
BREAKING(io): remove Deno.{Reader,Writer}[Sync] and Deno.Closer (#25524) 2024-09-10 07:07:12 +10:00
Satya Rohith
5126ccb842
fix(ext/node): Stream should be instance of EventEmitter (#25527)
Closes https://github.com/denoland/deno/issues/25526
2024-09-09 15:06:56 +02:00
Asher Gomez
39f2704bd7
BREAKING(fs): remove Deno.fdatasync[Sync]() (#25520) 2024-09-09 21:09:57 +10:00
Yoshiya Hinosawa
ce1d668929
fix(ext/node): delay accept() call 2 ticks in net.Server#listen (#25481)
A workaround for the issue #25480

`Deno.Listener` can't be closed synchronously after `accept()` is
called. This PR delays the `accept` call 2 ticks (The listener callback
is called 1 tick later. So the 1 tick delay is not enough), and makes
`net.Server` capable of being closed synchronously.

This unblocks `npm:detect-port` and `npm:portfinder`

closes #18301 
closes #25175
2024-09-08 12:22:18 +09:00
Asher Gomez
a9ed06b832
BREAKING(net): remove Deno.{Conn,TlsConn,TcpConn,UnixConn}.prototype.rid (#25446)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-06 23:01:36 +00:00
Asher Gomez
5bac4075c3
chore: soft-remove Deno.{stdin,stderr,stdout}.rid (#25479)
Towards #22079
2024-09-07 08:37:35 +10:00
Nathan Whitaker
51f5f5789b
feat(add): Add npm packages to package.json if present (#25477)
Closes https://github.com/denoland/deno/issues/25321

Ended up being a larger refactoring, since we're now juggling
(potentially) two config files in the same `add`, instead of choosing
one. I don't love the shape of the code, but I think it's good enough

Some smaller side improvements:
- `deno remove` supports `jsonc`
- `deno install --dev` will be a really simple change
- if `deno remove` removes the last import/dependency in the
`imports`/`dependencies`/`devDependencies` field, it removes the field
instead of leaving an empty object
2024-09-06 17:18:13 +00:00
Kenta Moriuchi
f0a3d20642
fix(runtime): use more null proto objects again (#25040)
proceed with #23921

This PR is a preparation for
https://github.com/denoland/deno_lint/pull/1307

---------

Signed-off-by: Kenta Moriuchi <moriken@kimamass.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-09-06 12:52:59 +02:00
Marvin Hagemeister
73ab32c551
fix: invalid ipv6 hostname on deno serve (#25482)
This PR fixes an invalid URL being printed when running `deno serve`

Before: invalid URL

```sh
$ deno serve --host localhost
deno serve: Listening on http://::1:8000/
```

After: valid URL

```sh
$ deno serve --host localhost
deno serve: Listening on http://[::1]:8000/
```
2024-09-06 09:22:52 +00:00
Asher Gomez
dcf155516b
BREAKING(fs): disallow new Deno.FsFile() (#25478)
Towards #22079
2024-09-06 18:28:42 +10:00
Asher Gomez
7937ae3f2f
chore(net): soft-remove Deno.serveHttp() (#25451)
Towards #22079

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-06 08:15:00 +10:00
Yoshiya Hinosawa
dda6328745
fix(ext/node): stub process.cpuUsage() (#25462)
closes #23401
2024-09-05 21:21:29 +09:00
Asher Gomez
7d95c5c062
BREAKING(fs): remove Deno.funlock[Sync]() (#25442)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-05 11:23:37 +00:00
Asher Gomez
c73b4a0877
BREAKING(fs): remove Deno.seek[Sync]() (#25449)
Towards #22079
2024-09-05 20:37:28 +10:00
Luca Casonato
49e3ee010c
feat(ext/node): add abort helpers, process & streams fix (#25262)
This commit adds:

- `addAbortListener` in `node:events`
- `aborted` in `node:util`
- `execPath` and `execvArgs` named export from `node:process`
- `getDefaultHighWaterMark` from `node:stream`

The `execPath` is very hacky - because module namespaces can not have
real getters, `execPath` is an object with a `toString()` method that on
call returns the actual `execPath`, and replaces the `execPath` binding
with the string. This is done so that we don't require the `execPath`
permission on startup.
2024-09-05 09:22:52 +02:00
Ian Bull
17b5e98b82
refactor(ext/cron): align error messages (#25300)
Aligns the error messages in the cron extension to be in-line with the
Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-05 08:27:58 +02:00
Asher Gomez
713ed065e7
BREAKING(fs): remove Deno.File (#25447)
Towards #22079
2024-09-05 16:22:47 +10:00
Ian Bull
0450c12df5
refactor(ext/crypto): align error messages (#25440)
Aligns the error messages in the ext/crypto folder to be in-line with
the Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-05 08:20:27 +02:00
Yoshiya Hinosawa
e799c2857c
fix(ext/http): do not set localhost to hostname unnecessarily (#24777)
This commit changes when to cause the hostname substition of `0.0.0.0` ->
`localhost`.

Currently we substitute `localhost` to the hostname on windows before
calling `options.onListen`, which prevents the users to do more advanced
thing using hostname string like
https://github.com/denoland/std/issues/5558. This PR changes it not to
substitute it when the user provide `onListen` callback.

closes #24776
unblocks https://github.com/denoland/std/issues/5558
2024-09-05 14:13:06 +09:00
Yoshiya Hinosawa
186f7484da
fix(ext/node): close upgraded socket when the underlying http connection is closed (#25387)
This change fixes the handling of upgraded socket from `node:http` module.

In `op_node_http_fetch_response_upgrade`, we create DuplexStream paired
with `hyper::upgrade::Upgraded`. When the connection is closed from the
server, the read result from `Upgraded` becomes 0. However because we
don't close the paired DuplexStream at that point, the Socket object in
JS side keeps alive even after the server closed. That caused the issue
#20179

This change fixes it by closing the paired DuplexStream when the
`Upgraded` stream returns 0 read result.

closes #20179
2024-09-05 13:30:18 +09:00
denobot
e27a19c02c
chore: forward v1.46.3 release commit to main (#25425)
This is the release commit being forwarded back to main for 1.46.3
2024-09-04 17:16:24 +00:00
David Sherret
c6d1b0a1cc
fix(byonm): resolve npm deps of jsr deps (#25399)
This allows using npm deps of jsr deps without having to add them to the
root package.json.

Works by taking the package requirement and scanning the
`node_modules/.deno` directory for the best matching package, so it
relies on deno's node_modules structure.

Additionally to make the transition from package.json to deno.json
easier, Deno now:

1. Installs npm deps in a deno.json at the same time as installing npm
deps from a package.json.
2. Uses the alias in the import map for `node_modules/<alias>` for
better package.json compatiblity.
2024-09-04 14:00:44 +00:00
Satya Rohith
334c842392
chore(ext/fetch): remove op_fetch_response_upgrade (#25421) 2024-09-04 18:10:28 +05:30
Luca Casonato
b333dccee8
feat(cli): give access to process global everywhere (#25291) 2024-09-04 11:04:06 +02:00
Asher Gomez
3d36cbd056
BREAKING(fs): remove Deno.ftruncate[Sync]() (#25412)
Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04 08:53:43 +00:00
Ian Bull
cb454351d4
refactor(ext): align error messages (#25310) 2024-09-04 09:23:19 +02:00
Ian Bull
ce6b675102
refactor(ext/fetch): align error messages (#25374)
Aligns the error messages in the ext/fetch folder to be in-line with the
Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-04 09:05:29 +02:00
Asher Gomez
7079acd74d
chore: update WPT (#25250)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-09-03 23:15:34 -07:00
Asher Gomez
b72d1a7256
BREAKING(fs): remove Deno.fstat[Sync]() (#25351)
Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04 01:28:15 +00:00
David Sherret
b8ed6f8221
fix(task): correct name for scoped npm package binaries (#25390)
This is for when not using a node_modules directory or when using auto
install for a node_modules dir.
2024-09-03 13:56:39 +00:00
Asher Gomez
03d8e474d7
BREAKING(io): remove Deno.copy() (#25345)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-03 10:46:13 +00:00
Luca Casonato
5cf97f539b
BREAKING(permissions): remove --allow-hrtime (#25367)
Remove `--allow-hrtime` and `--deny-hrtime`. We are doing this because
it is already possible to get access to high resolution timers through
workers and SharedArrayBuffer.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-03 11:24:25 +02:00
Asher Gomez
9bf10aa1e0
chore(fs): remove Deno.flock[Sync]() (#25350)
Towards #22079
2024-09-03 18:39:37 +10:00
Asher Gomez
45c1737531
BREAKING(io): remove Deno.iter[Sync]() (#25346)
Towards #22079
2024-09-03 18:35:54 +10:00
Kenta Moriuchi
9e6f41df66
BREAKING(ext/web): remove remaining web types for compatibility (#25334) 2024-09-02 18:35:10 +02:00
Asher Gomez
bc51eca700
BREAKING: remove deno bundle (#25339)
`deno bundle` now produces:
```
error: ⚠️ `deno bundle` was removed in Deno 2.

See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
```

`deno bundle --help` now produces:
```
⚠️ `deno bundle` was removed in Deno 2.

See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations

Usage: deno bundle [OPTIONS]

Options:
  -q, --quiet     Suppress diagnostic output
      --unstable  Enable all unstable features and APIs. Instead of using this flag, consider enabling individual unstable features
                    To view the list of individual unstable feature flags, run this command again with --help=unstable
```
2024-09-02 17:27:37 +02:00
Ian Bull
977f8137f3
refactor(ext/console): align error messages (#25301)
Aligns the error messages in the console extension to be in-line with
the Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-02 16:28:17 +02:00
David Sherret
a3bd1ba26d
fix(BREAKING): make dns record types have consistent naming (#25357)
Closes https://github.com/denoland/deno/issues/15207
2024-09-02 11:19:08 +00:00
Asher Gomez
b536ed1a74
chore(fs): remove Deno.futime[Sync]() (#25252) 2024-08-31 13:13:23 +10:00
Asher Gomez
a527b3a5de
chore(net): remove Deno.shutdown() (#25253) 2024-08-31 09:46:02 +10:00
Caleb Lloyd
4639ae655e
fix(ext/node): session close during stream setup (#25170)
Signed-off-by: Caleb Lloyd <caleblloyd@gmail.com>
2024-08-30 23:16:17 +05:30
Nathan Whitaker
86d5b919d8
feat(config): Node modules option for 2.0 (#25299) 2024-08-29 15:57:43 -07:00