Commit graph

2674 commits

Author SHA1 Message Date
Divy Srivastava
19d69ef755 fix(ext/node): return Buffer from crypto cipher APIs (#28826)
Fixes https://github.com/denoland/deno/issues/28633
2025-04-11 17:51:17 -04:00
Arsh
5dd3af1049 fix(ext/node): alias shake-128 and shake-256 hash algorithms (#28451)
Fixes #28442

---------

Signed-off-by: Arsh <69170106+lilnasy@users.noreply.github.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-04-11 17:51:10 -04:00
Yoshiya Hinosawa
3f510d2f0e fix(ext/node): support input option in spawnSync (#28792) 2025-04-11 17:50:28 -04:00
Nathan Whitaker
d1b4fcd77c fix(node): add reset method to event loop delay histogram (#28788)
Fixes https://github.com/denoland/deno/issues/28767

Don't love the `RefCell`, but don't really see a (safe) way around it.
2025-04-11 17:50:06 -04:00
Asher Gomez
6aba04db80 fix(ext/node): use primordials in ext/node/polyfills/path/separator.ts (#28669) 2025-04-11 17:49:50 -04:00
Benjamin Swerdlow
53b44049b1 refactor(ext/node): export GlobalsStorage (#28683) 2025-04-07 14:29:15 -07:00
Asher Gomez
c79186da1c fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_lstat.ts (#28644)
Towards #24236
2025-04-07 14:27:57 -07:00
Asher Gomez
ffa716b712 fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_realpath.ts (#28652)
Towards #24236
2025-04-07 14:27:24 -07:00
Asher Gomez
0643220e2a fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_readv.ts (#28645)
Towards #24236
2025-04-07 14:27:13 -07:00
Divy Srivastava
e9b0416194 fix(ext/websocket): cancel in-flight handshake on close() (#28598)
Fixes https://github.com/denoland/deno/issues/25126

---------

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2025-04-07 14:27:03 -07:00
Yoshiya Hinosawa
e5dc4bed63 fix(ext/node): emit 'close' event on ServerResponse object when client aborted the request (#28601) 2025-04-07 14:24:49 -07:00
Divy Srivastava
bef35c3aa8 fix(ext/node): mkdir() parse file mode (#28609)
Fixes https://github.com/denoland/deno/issues/28604
2025-04-07 14:23:10 -07:00
Yoshiya Hinosawa
6fb04ff4b9 fix(ext/node): propagate 'close' event of IncomingMessage to Socket (#28582) 2025-04-07 14:23:05 -07:00
Adakite
d5502714db fix(ext/os): explicitly enable sysinfoapi feature on winapi dependency (#28568)
This pr explicitly enables the `sysinfoapi` feature flag on `winapi` in
`deno_os`, so that `deno_os` and other deno crates that rely on it can
be built independently outside of the workspace on Windows.
2025-04-07 11:11:05 -07:00
Jake Champion
5114710b98 fix: add stackTraceLimit to ErrorConstructor interface and removed ErrorWithStackTraceLimit interface (#28539)
Signed-off-by: Jake Champion <me@jakechampion.name>
2025-04-07 11:09:51 -07:00
Ryan Dahl
0ef51d0048 docs: randomUUID and getRandomValues (#28496) 2025-04-07 10:31:27 -07:00
Luke Edwards
04909976ff fix(ext/node): correct STATUS_CODES strings (#28489)
Matches Node.js `http.STATUS_CODES` values now. Deno is currently
exporting an enum directly, which 1) adds keys like `BadRequest` and 2)
ships the status-text strings as non-space-delimited values (eg,
`'BadRequest`` instead of `'Bad Request'`)

Signed-off-by: Luke Edwards <luke.edwards05@gmail.com>
2025-04-07 10:31:03 -07:00
Toma
a422ad2632 fix(ext/node): use primordials in ext/node/polyfills/path/_util.ts (#28432)
Towards https://github.com/denoland/deno/issues/24236
2025-04-07 10:29:38 -07:00
Muthuraj Ramalingakumar
2ddaafd762 fix(ext/node): node compatibility issue missing fd in createServer callback socket object (#27789) 2025-04-07 10:24:40 -07:00
Divy Srivastava
2a9d873dd8 fix(ext/node): decipherIv() range error on invalid final block length (#28215)
Fixes https://github.com/denoland/deno/issues/28208
2025-04-07 10:19:18 -07:00
Phil Hawksworth
f6321aacc5 docs: add examples for SubtleCrypto (#28068)
Adds examples for subtleCrypto
(https://docs.deno.com/api/web/~/SubtleCrypto)

- generateKey
- importKey
- exportKey
- sign
- verify
- digest
- encrypt
- decrypt
- deriveBits
- deriveKey
- wrapKey
- unwrapKey

---------

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-07 10:18:27 -07:00
Jo Franchetti
62511b35bf docs(canvas): Add examples to createImageBitmap jsdocs (#28055)
Adding examples to the JSDocs for createImageBitmap and
formatting/linting file

---------

Co-authored-by: Phil Hawksworth <phil@deno.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-07 10:18:18 -07:00
Jo Franchetti
811e375482 docs(console): update console documentation (#28196)
Signed-off-by: Jo Franchetti <jofranchetti@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-04-07 10:18:04 -07:00
Bartek Iwańczuk
84ebdad8a0 fix(ext/cache): add missing Cargo feature (#28178) 2025-04-07 10:08:11 -07:00
Rajhans Jadhao
9901cb2de8 fix(ext/node): use primordials in ext/node/polyfills/path/common.ts (#28164)
Related to https://github.com/denoland/deno/issues/24236
2025-04-07 10:08:11 -07:00
David Sherret
8ea9e55b86 refactor: better sys trait impls (#28140) 2025-04-07 10:08:11 -07:00
denobot
073e087979
2.1.10 (#28097)
Bumped versions for 2.1.10

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-02-13 12:03:17 +05:30
Divy Srivastava
f9995ee212 fix: do special file permission check for check_read_path (#27989)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-13 10:05:50 +05:30
Leo Kettmeir
93bfedc181
fix(streams): handle Resource stream error (#27975)
Fixes #27715
2025-02-12 10:10:22 +01:00
Jo Franchetti
c6422d3fd0
docs: adding examples and a see link to Websockets jdocs (#27957)
adding examples to websockets interfaces and a see link

---------

Co-authored-by: Phil Hawksworth <phil@deno.com>
2025-02-12 10:09:32 +01:00
Luca Casonato
daddfd9b11
fix(otel): custom span start + end times are fractional ms (#27995)
Previously they were treated as fractional seconds.
2025-02-12 10:05:26 +01:00
Yoshiya Hinosawa
e922da61c9
fix(ext/node): fix twitter-api-v2 compatibility (#27971) 2025-02-12 10:05:24 +01:00
Divy Srivastava
b14bed068c
fix(ext/node): fix missing privateKey.x in curve25519 JWK (#27990)
Fixes https://github.com/denoland/deno/issues/27972
2025-02-12 10:05:24 +01:00
snek
88f22dda3b
fix(ext/napi): napi_is_buffer tests for ArrayBufferView (#27956)
use correct type check

Fixes: https://github.com/denoland/deno/issues/27951
2025-02-12 10:03:37 +01:00
Divy Srivastava
83ef54f465
fix(ext/node): handle non-ws upgrade headers (#27931) 2025-02-12 10:03:32 +01:00
Yoshiya Hinosawa
491488628a
refactor(ext/fetch): do not share error instance (#27941) 2025-02-12 10:03:32 +01:00
Divy Srivastava
87f6fd18c6
fix(ext/node): expose brotli stream APIs (#27943)
Fixes https://github.com/denoland/deno/issues/27170
2025-02-12 10:03:32 +01:00
David Sherret
3c0df7a560
perf: node resolution cache (#27838)
This adds a cache for node resolution, which makes repeat lookups about
15x faster.
2025-02-12 10:03:32 +01:00
Divy Srivastava
4101cf4274
fix(ext/node): set process fields on own instance (#27927)
Ref https://github.com/denoland/deno/pull/27891#issuecomment-2626286689

```
% deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "versions",
  "stdin",
  "stdout",
  "stderr"
]

% target/debug/deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "release",
  "arch",
  "report",
  "title",
  "argv",
  "argv0",
  "chdir",
  "config",
  "cpuUsage",
  "cwd",
  "env",
  "execArgv",
  "exit",
  "abort",
  "reallyExit",
  "_exiting",
  "exitCode",
  "mainModule",
  "nextTick",
  "dlopen",
  "pid",
  "ppid",
  "platform",
  "setSourceMapsEnabled",
  "hrtime",
  "_kill",
  "kill",
  "memoryUsage",
  "stderr",
  "stdin",
  "stdout",
  "version",
  "versions",
  "emitWarning",
  "binding",
  "umask",
  "getgid",
  "getuid",
  "getegid",
  "geteuid",
  "getBuiltinModule",
  "_eval",
  "execPath",
  "uptime",
  "allowedNodeEnvironmentFlags",
  "features",
  "noDeprecation"
]
```
2025-02-12 10:03:12 +01:00
Yoshiya Hinosawa
55dd527341
fix(ext/node): support proxy http request (#27871) 2025-02-12 10:01:19 +01:00
Divy Srivastava
8d3a95170c
fix(ext/node): set process.env as own property (#27891)
Fixes `gcp-metadata@6.1.1`

```
% deno eval "import 'npm:gcp-metadata@6.1.1'" # main
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'GOOGLE_SDK_NODE_LOGGING')
    at Object.log (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/google-logging-utils/0.0.2/build/src/logging-utils.js:356:36)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:52:20)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:409:4)
    at Module._compile (node:module:745:34)
    at loadMaybeCjs (node:module:770:10)
    at Object.Module._extensions..js (node:module:755:12)
    at Module.load (node:module:662:32)
    at Function.Module._load (node:module:534:12)
    at Module.require (node:module:681:19)
    at require (node:module:812:16)

% target/debug/deno eval "import 'npm:gcp-metadata@6.1.1'" # this PR
```

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2025-02-12 10:01:19 +01:00
denobot
46e2f9a47e
2.1.9 (#27886)
Bumped versions for 2.1.9

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-01-31 01:21:43 +01:00
Nathan Whitaker
0f117bbd68
perf(crypto): use ring for asm implementations of sha256/sha512 (#27885)
Currently we are using the pure rust backend of `sha2`, which has subpar
performance compared to asm implementations. We already depend on
`ring`, so just use that instead of `sha2` for sha256/sha512 digests.

This also speeds up things like S3 uploads, which calculate sha digests
of the uploaded objects. On my local machine, this speeds up uploading a
100MB file (to a localhost s3 provider via`@aws-sdk/client-s3`) by about
2x

<details>

<summary>Benchmark:</summary>

```ts
import { createHmac } from "node:crypto";

for (
  const size of [1, 10, 100, 1_000, 10_000, 100_000, 1_000_000, 10_000_000]
) {
  const input = "a".repeat(size);
  Deno.bench({
    name: `sha256-${size}`,
    fn() {
      const _hash = createHmac("sha256", input).update(input).digest();
    },
  });
  Deno.bench({
    name: `sha512-${size}`,
    fn() {
      const _hash = createHmac("sha512", input).update(input).digest();
    },
  });
}
```

</details>

<details>

<summary>Results (arm64 macOS):</summary>

```
--- sha256-1 ---
../../deno/target/release/deno         2.527 µs    1.240 times faster
/Users/nathanwhit/.deno/bin/deno       3.132 µs    
--- sha512-1 ---
../../deno/target/release/deno         3.364 µs    1.071 times faster
/Users/nathanwhit/.deno/bin/deno       3.603 µs    
--- sha256-10 ---
../../deno/target/release/deno         3.060 µs    1.027 times faster
/Users/nathanwhit/.deno/bin/deno       3.144 µs    
--- sha512-10 ---
../../deno/target/release/deno         3.583 µs    1.047 times faster
/Users/nathanwhit/.deno/bin/deno       3.751 µs    
--- sha256-100 ---
../../deno/target/release/deno         3.695 µs    1.244 times faster
/Users/nathanwhit/.deno/bin/deno       4.598 µs    
--- sha512-100 ---
../../deno/target/release/deno         3.386 µs    1.188 times faster
/Users/nathanwhit/.deno/bin/deno       4.021 µs    
--- sha256-1000 ---
../../deno/target/release/deno         4.007 µs    3.230 times faster
/Users/nathanwhit/.deno/bin/deno      12.944 µs    
--- sha512-1000 ---
../../deno/target/release/deno         6.463 µs    1.466 times faster
/Users/nathanwhit/.deno/bin/deno       9.477 µs    
--- sha256-10000 ---
../../deno/target/release/deno        11.674 µs    6.981 times faster
/Users/nathanwhit/.deno/bin/deno      81.493 µs    
--- sha512-10000 ---
../../deno/target/release/deno        31.250 µs    1.740 times faster
/Users/nathanwhit/.deno/bin/deno      54.364 µs    
--- sha256-100000 ---
../../deno/target/release/deno        82.800 µs    9.393 times faster
/Users/nathanwhit/.deno/bin/deno     777.719 µs    
--- sha512-100000 ---
../../deno/target/release/deno       269.726 µs    1.851 times faster
/Users/nathanwhit/.deno/bin/deno     499.243 µs    
--- sha256-1000000 ---
../../deno/target/release/deno       808.662 µs    9.427 times faster
/Users/nathanwhit/.deno/bin/deno       7.623 ms    
--- sha512-1000000 ---
../../deno/target/release/deno         2.672 ms    1.795 times faster
/Users/nathanwhit/.deno/bin/deno       4.795 ms    
--- sha256-10000000 ---
../../deno/target/release/deno         7.823 ms    9.868 times faster
/Users/nathanwhit/.deno/bin/deno      77.201 ms    
--- sha512-10000000 ---
../../deno/target/release/deno        26.197 ms    1.846 times faster
/Users/nathanwhit/.deno/bin/deno      48.356 ms    
```

</details>

<details>

<summary>Results (x86_64 linux):</summary>

```
--- sha256-1 ---
/home/nathanwhit/.deno/bin/deno             10.726 µs    1.229 times faster
../../../deno/target/release-lite/deno      13.184 µs    
--- sha512-1 ---
/home/nathanwhit/.deno/bin/deno             13.177 µs    1.051 times faster
../../../deno/target/release-lite/deno      13.845 µs    
--- sha256-10 ---
/home/nathanwhit/.deno/bin/deno             13.156 µs    1.047 times faster
../../../deno/target/release-lite/deno      13.780 µs    
--- sha512-10 ---
/home/nathanwhit/.deno/bin/deno             14.386 µs    1.029 times faster
../../../deno/target/release-lite/deno      14.807 µs    
--- sha256-100 ---
/home/nathanwhit/.deno/bin/deno             14.580 µs    1.083 times faster
../../../deno/target/release-lite/deno      15.789 µs    
--- sha512-100 ---
/home/nathanwhit/.deno/bin/deno             13.477 µs    1.131 times faster
../../../deno/target/release-lite/deno      15.238 µs    
--- sha256-1000 ---
../../../deno/target/release-lite/deno      17.208 µs    1.116 times faster
/home/nathanwhit/.deno/bin/deno             19.198 µs    
--- sha512-1000 ---
../../../deno/target/release-lite/deno      21.168 µs    1.026 times faster
/home/nathanwhit/.deno/bin/deno             21.717 µs    
--- sha256-10000 ---
../../../deno/target/release-lite/deno      33.586 µs    1.990 times faster
/home/nathanwhit/.deno/bin/deno             66.837 µs    
--- sha512-10000 ---
../../../deno/target/release-lite/deno      53.338 µs    1.009 times faster
/home/nathanwhit/.deno/bin/deno             53.817 µs    
--- sha256-100000 ---
../../../deno/target/release-lite/deno     168.238 µs    3.063 times faster
/home/nathanwhit/.deno/bin/deno            515.354 µs    
--- sha512-100000 ---
../../../deno/target/release-lite/deno     383.311 µs    1.036 times faster
/home/nathanwhit/.deno/bin/deno            397.122 µs    
--- sha256-1000000 ---
../../../deno/target/release-lite/deno       1.474 ms    3.471 times faster
/home/nathanwhit/.deno/bin/deno              5.115 ms    
--- sha512-1000000 ---
../../../deno/target/release-lite/deno       3.658 ms    1.057 times faster
/home/nathanwhit/.deno/bin/deno              3.865 ms    
--- sha256-10000000 ---
../../../deno/target/release-lite/deno      16.438 ms    3.136 times faster
/home/nathanwhit/.deno/bin/deno             51.556 ms    
--- sha512-10000000 ---
../../../deno/target/release-lite/deno      37.128 ms    1.056 times faster
/home/nathanwhit/.deno/bin/deno             39.220 ms    
```

</details>
2025-01-31 00:39:11 +01:00
snek
b4b02576d0
fix(ext/node): add http information support (#27381)
Implements some client and server events to improve compat.
This change makes AWS SDKs more reliable and faster in Deno.

Fixes: https://github.com/denoland/deno/issues/27239
2025-01-30 23:28:55 +01:00
denobot
318646f767
2.1.8 (#27878)
Bumped versions for 2.1.8

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-01-30 19:19:27 +01:00
Divy Srivastava
ee4ae8bd6b
fix(ext/node): implement crypto.hash (#27858)
Implement
[`crypto.hash`](https://nodejs.org/api/crypto.html#cryptohashalgorithm-data-outputencoding)
- one-shot version of `createHash`

Fixes #24945
2025-01-30 15:34:58 +01:00
Phil Hawksworth
e710340080
docs: jsdocs for URL web API (#27850)
Adds references and examples to the documentation of the URL properties
which surface here:

https://docs.deno.com/api/web/~/URL

  `./tools/lint.js`
  `./tools/format.js`

---------

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2025-01-30 15:34:58 +01:00
David Sherret
5212dc37c5
fix(process/windows): correct command resolution when PATH env var not uppercase (#27846)
Closes #27768
2025-01-30 15:34:58 +01:00
Divy Srivastava
d58c70fbd1
fix(ext/node): clear tz cache when setting process.env.TZ (#27826) 2025-01-30 15:34:57 +01:00
Divy Srivastava
fc14bd93ff
fix(ext/crypto): fix jwk key_ops validation (#27827) 2025-01-30 15:34:57 +01:00