Commit graph

2806 commits

Author SHA1 Message Date
Satya Rohith
d1b0129034
WIP: implement JSStream to terminate TLS on a javascript stream
Issue: https://github.com/denoland/deno/issues/20594

We need to implement JSStreamSocket from nodejs in
deno for rustls to terminate TLS on a JavaScript stream.

c46b2b9da3/lib/internal/js_stream_socket.js (L49)

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-05-05 15:02:07 +05:30
James Bronder
8786d39d4b
fix(ext/node): use primordials in ext/node/polyfills/internal/options.ts (#29119)
Towards #24236. This PR replaces `Map` and `String` methods with their
primordial versions.
2025-05-02 10:08:43 +02:00
snek
bc1ced8260
refactor: allow lazy main module (#28929)
implement lazy(?) mode. an unconfigured jsruntime is created if
DENO_UNSTABLE_CONTROL_SOCK is present, and later passed into deno_runtime to be
configured and used.
2025-04-30 19:59:20 +00:00
Luca Casonato
1d6f665115
fix(ext/node): don't use user manipulated Response objects, use correct rawHeaders structure (#29105) 2025-04-30 18:23:53 +02:00
snek
78758f257b
feat: DENO_SERVE_ADDRESS duplicate option (#29109)
if `duplicate` is passed in DENO_SERVE_ADDRESS, use its value to create
a second listener instead of overriding the options the user passed.
2025-04-30 14:04:19 +00:00
denobot
61574bb9c9
2.3.0 (#29102)
Bumped versions for 2.3.0

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-30 09:49:31 +02:00
Nathan Whitaker
05574665b2
fix(ext/node): work correctly with wrapper Response objects, use correct rawHeaders structure (#29056)
Fixes https://github.com/denoland/deno/issues/28022

Basically drizzle-kit studio uses hono with the node-server adapter.
That creates wrapper objects for responses that forward property getters
to the underlying response (the one we provided). However, in deno.serve
we were assuming that the response was actually the same response we
initially gave and crashed when it wasn't. instead, just call the
property getters if we can't find the inner response.

The raw headers bug is that we were exposing the `rawHeaders` field on
`Incoming` as a `Headers` object, instead it's supposed to be a flat
array of the header keys + values. I.e. `["Content-Type:",
"application/json", "Host:", "http://localhost"]`
2025-04-30 00:14:29 +00:00
Nathan Whitaker
c22d17824b
perf(fs): don't canonicalize path when opening file if --allow-all is passed (#28716)
Fixes #28702.

Super artificial benchmark:

```ts
const perf = performance;

async function asyncOpen() {
  const start = perf.now();
  for (let i = 0; i < 100_000; i++) {
    const file = await Deno.open("./foo.txt");
    file.close();
  }
  const end = perf.now();
  console.log(end - start);
}

function syncOpen() {
  const start = perf.now();
  for (let i = 0; i < 100_000; i++) {
    const file = Deno.openSync("./foo.txt");
    file.close();
  }
  const end = perf.now();
  console.log(end - start);
}

if (Deno.args[0]?.trim() === "async") {
  await asyncOpen();
} else {
  syncOpen();
}
```

Results (average of 10 for each):

```
deno sync               1785.59
deno-this-pr sync       491.69
deno async              1839.71
deno-this-pr async      528.78
```

---------

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2025-04-29 23:16:24 +00:00
siaeyy
1a171f10df
fix(ext/node): handle "ttl" option in "dns" module (#27676)
Closes #27669

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-29 22:49:10 +00:00
JasperVanEsveld
7b28e76881
fix(compile): panic when compiled with --no-terminal flag (#28823)
When compiled with the `--no-terminal` flag under windows there are some
issues related to stdin, stdout and stderr.
This pull request fixes the panic when during bootstrap the terminal
type is requested.
Previously it would return the error if the terminal was not valid,
instead it now returns UNKNOWN.
2025-04-29 17:10:20 +00:00
James Bronder
a2c0157306
fix(ext/node): use primordials in ext/node/polyfills/internal/http.ts (#29082)
Towards #24236. This PR replaces `Date`, `Date` methods, and `Symbol`s
with their primordial versions.
2025-04-29 18:34:22 +02:00
snek
25b9abcdf8
feat: use new feature checker (#29091)
we need to be able to set the feature checker after creating the runtime
to support lazy init
2025-04-29 17:18:14 +02:00
Bartek Iwańczuk
4d1f47a915
feat: Allow access to NO_COLOR env var without --allow-env (#29090)
Since `Deno.noColor` exists, it makes sense to allow accessing
`NO_COLOR` env var without `--allow-env` permission.
2025-04-29 10:12:48 -04:00
Divy Srivastava
81a4f9e502
fix(ext/node): implement DatabaseSync#loadExtension (#29050)
Requires full `--allow-ffi`

Fixes https://github.com/denoland/deno/issues/29030
2025-04-29 12:30:21 +00:00
Yoshiya Hinosawa
d1f7969570
perf(ext/node): lazily listen to the abort signal of request object (#29071) 2025-04-29 20:44:09 +09:00
snek
2221cf3e7c
feat: deno_core 0.344.0 (#29089)
- new ops init api
  - fix op order
- remove deno_os_worker since extensions must now match the snapshot
exactly
- isatty test change
2025-04-29 13:15:08 +02:00
Divy Srivastava
e0813f2255
fix(ext/node): throw NotCapable on process.env accessor (#28280)
Fixes https://github.com/denoland/deno/issues/28125

Additionally "FORCE_COLOR" env var can now be accessed 
without `--allow-env` check.
---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-28 14:28:01 +00:00
snek
f360d61d64
fix: move otel logic into otel (#29073)
cleanup
229228ae0d
2025-04-28 15:09:15 +02:00
Bartek Iwańczuk
a33dae6a2a
feat: allow forcing in-memory SQLite dbs (#29026)
This commit adds two env vars:
- "DENO_CACHE_DB_MODE"
- "DENO_KV_DB_MODE"

Both of these env vars accept either "disk" or "memory" values and
control the modes of backing databases for Web Cache API and
"Deno.openKv()" API.

By default both APIs use disk backed DBs, but they can be changed to use
in-memory
DB, making them effectively ephemeral.
2025-04-28 09:06:38 +00:00
James Bronder
98cf8f402b
fix(ext/node): use primordials in ext/node/polyfills/internal/hide_stack_frames.ts (#29067) 2025-04-28 16:00:54 +09:00
Efe
943e3de3a4
fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_opendir.ts (#29063) 2025-04-28 15:56:39 +09:00
Yoshiya Hinosawa
1df61020f0
perf(ext/node): improve node:http createServer performance (#29069) 2025-04-28 14:05:41 +09:00
Yoshiya Hinosawa
84b192ee5d
fix(ext/node): fix deepStrictEqual(-0, 0) (#29060) 2025-04-27 22:19:36 +09:00
Luca Casonato
733ffd9dd9
fix(otel): recording metrics with more than 3 attributes (#28898)
We were calling `op_otel_metric_attribute3` with the wrong arguments.
2025-04-26 20:15:21 +02:00
Lach
ec8e683de9
fix(otel): support attributes on links and events (#28584) 2025-04-25 18:26:33 +02:00
ctrl+d
f9a024a748
feat(ext/net): add signal option to Deno.connect() (#27113)
Ref #26819

An optional **timeout** parameter has been added to the
**Deno.connect()** interface. This parameter allows specifying a timeout
(in milliseconds) within which the application must establish a
connection. If the timeout is exceeded without successfully connecting,
the operation is automatically aborted with an error. If the parameter
is not provided, the default behavior remains unchanged (no timeout).
Currently, the timeout functionality is implemented only for TCP
connections. Other connection types are not affected by this change.

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2025-04-25 20:25:50 +05:30
Divy Srivastava
6f4472c5dc
feat(ext/fetch): support localAddress option in custom HTTP client (#28781)
Fixes https://github.com/denoland/deno/issues/27376
Fixes https://github.com/denoland/deno/issues/23373

Example usage:

```js
const client = Deno.createHttpClient({
  localAddress: "127.0.0.2",
});
const response = await fetch("http://localhost:4545/local_addr", {
  client,
});
```
2025-04-25 18:03:24 +05:30
Lucas Wasilewski
9ed2fad9ed
feat(ext/http): Show that is also listening on localhost (#28171)
Closes #27722

This will show `Listening on http://0.0.0.0:8000 (http://localhost:8000)`

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-25 08:36:20 +00:00
ctrl+d
cf02f770aa
fix(ext/node): fix handling of abort signal in readFile (#29028)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2025-04-25 14:48:12 +09:00
denobot
6e86063c03
chore: forward v2.2.12 release commit to main (#29044)
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2025-04-24 20:22:57 -04:00
Dan
e612d572f8
fix(deno_os): allow running WebWorker without snapshots (#28975)
This addresses [#28680](https://github.com/denoland/deno/issues/28680)
where the esm modules are not found when instantiating a WebWorker with
snapshots disabled.

This is an alternative solution to another PR,
https://github.com/denoland/deno/pull/28693
2025-04-24 10:39:38 -07:00
snek
d843a93e65
fix: fix bugs with rendering of authority in serve urls (#29009)
- preserve authority from protocol
- reject some invalid combinations of request lines (e.g. `GET *`)
- modify rendering of OPTIONS and CONNECT so that they don't cause `new
URL` to raise.
2025-04-23 11:23:15 +02:00
Sebastien Guillemot
40c5dff82f
fix(ext/node): update node version in process object (#27044)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2025-04-23 10:55:32 +09:00
Jim Buzbee
1feb2b6421
fix(ext/node): honor flags with respect to reuseAddress when binding to a UDP socket (#28156)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2025-04-22 17:49:14 +09:00
denobot
9591c11633
chore: forward v2.2.11 release commit to main (#28958)
This is the release commit being forwarded back to main for 2.2.11

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-18 17:21:06 +02:00
David Sherret
16d305449d
feat(compile): support for ffi and node native addons (#28934)
This extracts out the shared libraries and `.node` native modules to a
temp file and opens them from there. **This means that this
implementation will not work in every scenario.** For example, a library
could require other files that only exist in the in-memory file system.
To solve that, we'll introduce
https://github.com/denoland/deno/issues/28918 later or adapt this
solution to solve more issues.

Additionally, this will not work when run on readonly file systems.
2025-04-17 16:01:12 -04:00
Luca Casonato
c12709196c
fix: support vsock in DENO_SERVE_ADDRESS (#28941) 2025-04-17 13:49:47 +02:00
Yoshiya Hinosawa
016b02d374
fix(ext/node): add assert property to test context object (#28904) 2025-04-17 14:32:48 +09:00
Leo Kettmeir
066a205d5f
feat(unstable/webgpu): add deviceStartCapture and deviceStopCapture (#28192)
This is achieved by adding a new `Deno.webgpu` namespace which will be
used for non-spec functionality, which for now will be marked as
unstable
2025-04-16 17:26:28 +00:00
Marvin Hagemeister
a5b407c390
chore: make node test-process-cpuUsage pass (#28912)
We used a different error message by referring to the first parameter as
`previousValue` instead of `prevValue`. Node uses `prevValue` in the
error message.
2025-04-16 08:28:18 +02:00
Bartek Iwańczuk
27651d3c77
refactor(ext/node): use Promise.withResolvers (#28917) 2025-04-15 17:33:53 -04:00
Divy Srivastava
5867988bae
fix(ext/node): Fix Writable.toWeb() (#28914)
Fixes https://github.com/denoland/deno/issues/28905
2025-04-15 20:10:48 +02:00
denobot
2e826dfc9d
chore: forward v2.2.10 release commit to main (#28897)
This is the release commit being forwarded back to main for 2.2.10

Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
Co-authored-by: Nathan Whitaker <nathan@deno.com>
2025-04-14 16:10:16 -07:00
Divy Srivastava
01b6da9d9b
fix(ext/node): upgrade node:stream (#28855)
Ref https://github.com/denoland/deno/issues/28836

This PR replaces the _stream.mjs bundle with a file-by-file port instead. A codemod transpiles Node.js internals to ESM. The codemod performs three tasks: translating CJS to ESM, remapping internal dependencies, and hoisting lazy requires as imports.

The process is fully automated through the `update_node_stream.ts` script, simplifying future internal updates. The script checks out Node.js from a specific tag defined in the `tests/node_compat/runner`.

Additionally, the update enables new tests in our Node test runner and adds features (like compose()) that were missing from the outdated bundle.

## Performance

There is a 140KB+ binary size increase on aarch64-apple-darwin and nop startup time stays the same.
2025-04-14 21:35:34 +05:30
Ryan Dahl
9c201aee7d
feat(serve): env var DENO_SERVE_ADDRESS for configuring default listen address (#28877) 2025-04-14 12:15:26 +00:00
Divy Srivastava
cc8b5217f3
fix(ext/node): querystring fallback to default decoder (#28838)
Enables the full `tests/node_compat/test/parallel/test-querystring.js`
test
2025-04-14 15:17:28 +05:30
Yoshiya Hinosawa
1dfd444901
fix(ext/node): add basic support of suite/describe in node:test (#28847) 2025-04-14 15:44:03 +09:00
Yoshiya Hinosawa
372705a4d7
fix(ext/node): export test as property of default export (#28881) 2025-04-14 14:19:22 +09:00
Nayeem Rahman
98b7554aaf
chore: forward v2.2.9 release commit to main (#28859) 2025-04-11 22:45:54 +00:00
snek
e73ed03373
fix: vsock nits (#28851) 2025-04-11 12:11:03 -07:00