Yoshiya Hinosawa
55dd527341
fix(ext/node): support proxy http request ( #27871 )
2025-02-12 10:01:19 +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
Nathan Whitaker
b8e2a73ce7
fix(ext/node): implement aes-128-ctr
, aes-192-ctr
, and aes-256-ctr
( #27630 )
...
Fixes https://github.com/denoland/deno/issues/24864
Need to add some tests, also unsure about the right counter size (went
with 128 bit to be safe)
---------
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2025-01-30 15:34:57 +01:00
David Sherret
55b19e3e7a
perf(node_resolver): reduce url to/from path conversions ( #27839 )
...
Extracted out of https://github.com/denoland/deno/pull/27838/files
Reduces some allocations by accepting either a pathbuf or url for the
referrer for resolution and returning either a pathbuf or url at the
end, which the caller can then convert into to their preferred state.
This is about 4% faster when still converting the final result to a url
and 6% faster when keeping the result as a path in a benchmark I ran.
2025-01-30 15:34:56 +01:00
Divy Srivastava
6fe2341897
fix(ext/node): implement X509Certificate#checkHost ( #27821 )
...
Fixes https://github.com/denoland/deno/issues/27619
2025-01-30 15:34:56 +01:00
Divy Srivastava
2b27d342d8
fix(ext/node): fix panic when invalid AES GCM key size ( #27818 )
...
Fixes https://github.com/denoland/deno/issues/27807
2025-01-30 15:34:56 +01:00
Divy Srivastava
b3c7ee4504
fix(ext/node): scrypt panic when log_n
> 64 ( #27816 )
...
Throws an error instead of panic. Ref
https://github.com/denoland/deno/issues/27716
2025-01-30 15:34:55 +01:00
Divy Srivastava
a4003a5292
fix(ext/node): GCM auth tag check on DechiperIv#final ( #27733 )
...
(cherry picked from commit 4f27d7cdc0
)
2025-01-22 00:24:22 +01:00
Leo Kettmeir
4fe353c961
refactor: update deno_core and use more concrete errors ( #27620 )
...
waiting for https://github.com/denoland/deno_core/pull/1043
Fixes #27672
(cherry picked from commit 054075730c
)
2025-01-22 00:24:19 +01:00
Bartek Iwańczuk
b197dcf4e9
refactor: add 'deno_process' crate ( #27680 )
...
Untangled the whole `runtime/ops/process.rs` from `ext/node/` and moved
to a separate `ext/process` crate.
(cherry picked from commit 0050857f51
)
2025-01-22 00:24:16 +01:00
David Sherret
1bd66b09cc
refactor: move CliNpmResolver
to deno_resolver::npm::NpmResolver
( #27659 )
...
As title. After this PR all npm resolution will be out of the CLI crate.
2025-01-16 23:32:11 +01:00
Leo Kettmeir
5064e9051b
refactor: update deno_core for error refactor ( #26867 )
...
Closes #26171
---------
Co-authored-by: David Sherret <dsherret@gmail.com>
2025-01-09 15:19:21 -05:00
Divy Srivastava
fa2c8e08d8
fix(ext/node): Fix os.cpus()
on Linux ( #27592 )
...
Populate `speed` using current scaling frequency and fix times
multiplier.
Fixes https://github.com/denoland/deno/issues/27555
<table>
<tr>
<th>Node.js</th>
<th>Deno</th>
</tr>
<tr>
<td>
```
> os.cpus()
[
{
model: 'AMD Ryzen 5 7530U with Radeon Graphics',
speed: 1396,
times: {
user: 1769930,
nice: 20,
sys: 525630,
idle: 41325700,
irq: 110060
}
},
```
</td>
<td>
```
> os.cpus()
[
{
model: "AMD Ryzen 5 7530U with Radeon Graphics",
speed: 1630,
times: [Object: null prototype] {
user: 1795620,
nice: 20,
sys: 537840,
idle: 41589390,
irq: 111230
}
},
```
</td>
</tr>
</table>
2025-01-09 15:19:20 -05:00
David Sherret
330d72a715
refactor: remove use of home crate ( #27516 )
...
The two places mentioned in the issue are now consolidated.
Closes https://github.com/denoland/deno/issues/24385
2025-01-09 15:19:17 -05:00
Kenta Moriuchi
a39c83170f
chore: Happy New Year 2025 ( #27509 )
2025-01-09 15:19:16 -05:00
David Sherret
0bbb302318
chore: cargo fmt - turn on group_imports=StdExternalCrate ( #26646 )
2025-01-09 15:19:15 -05:00
David Sherret
118fd69988
refactor: do not use deno_fs::FileSystem
everywhere ( #27508 )
...
This changes the cli to mostly use `std::fs` via `sys_traits` instead of
the implemention of `deno_fs::FileSystem`.
2025-01-09 15:19:15 -05:00
Bartek Iwańczuk
787646d486
fix(ext/node): support private key export in JWK format ( #27325 )
...
Closes https://github.com/denoland/deno/issues/26643
---------
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-01-09 15:19:15 -05:00
Yoshiya Hinosawa
13c240c41d
fix(ext/node): add support of any length IV for aes-(128|256)-gcm ciphers ( #27476 )
2025-01-09 15:19:14 -05:00
Yoshiya Hinosawa
1aefb16fd4
fix(ext/node): make getCiphers return supported ciphers ( #27466 )
...
Currently we only supports 7 ciphers (`aes-(128|192|256)-ecb` and
`aes-(128|256)-(cbc|gcm)`) in `node:crypto`, but `crypto.getCiphers`
returns other supported cipher names. That confuses `npm:openpgp`
package and causes https://github.com/denoland/deno/issues/26875 .
This PR makes `getCiphers` return actually supported cipher names.
With this change, the example given in #26875 can create private and
public key files.
closes #26875
2025-01-09 15:19:13 -05:00
snek
e482c77a31
chore: upgrade libc ( #27414 )
...
need to do this for quic and they deprecated this method in libc without
actually providing an alternative so :/
2025-01-09 15:19:10 -05:00
Divy Srivastava
2e0c4a38d6
fix: FastString v8_string() should error when cannot allocated ( #27375 )
...
Upgrades deno_core to 0.326.0
2025-01-09 15:19:08 -05:00
Satya Rohith
793869173e
fix(ext/node): support createConnection option in node:http.request() ( #25470 )
...
This commit changes "node:http" module to add support
for the "createConnection" option when the "request()"
API is called.
Closes https://github.com/denoland/deno/issues/19507
---------
Signed-off-by: Yoshiya Hinosawa <stibium121@gmail.com>
Signed-off-by: Satya Rohith <me@satyarohith.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2025-01-09 15:19:07 -05:00
David Sherret
a34839e9d0
fix: improve auto-imports for npm packages ( #27224 )
...
Improves auto-imports when using `"nodeModulesDir": "auto"`
2024-12-05 23:03:54 +01:00
David Sherret
fdba58ce59
perf(compile): read embedded files as static references when UTF-8 and reading as strings ( #27033 )
2024-11-28 15:47:29 +01:00
David Sherret
8cd9fa6aae
fix(node): correct resolution of dynamic import of esm from cjs ( #27071 )
...
Ensures a dynamic import in a CJS file will consider the referrer as an import for node resolution.
Also adds fixes (adds) support for `"resolution-mode"` in TypeScript.
2024-11-28 15:47:26 +01:00
Leo Kettmeir
cf49599359
feat: permission stack traces in ops ( #26938 )
...
This commit improves permission prompts by adding an option
to print a full trace of where the permissions is being requested.
Due to big performance hint of stack trace collection, this is only
enabled when `DENO_TRACE_PERMISSIONS` env var is present.
Closes https://github.com/denoland/deno/issues/20756
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 21:24:04 +00:00
Divy Srivastava
069bc15030
feat(ext/node): perf_hooks.monitorEventLoopDelay() ( #26905 )
...
Fixes https://github.com/denoland/deno/issues/20961
Depends on https://github.com/denoland/deno_core/pull/965 and
https://github.com/denoland/deno_core/pull/966
2024-11-19 16:49:25 +05:30
David Sherret
48b94c0995
refactor: use boxed_error in some places ( #26887 )
2024-11-15 23:22:50 -05:00
David Sherret
617350e79c
refactor(resolver): move more resolution code into deno_resolver ( #26873 )
...
Follow-up to cjs refactor.
This moves most of the resolution code into the deno_resolver crate.
Still pending is the npm resolution code.
2024-11-14 15:24:25 -05:00
David Sherret
f091d1ad69
feat(node): stabilize detecting if CJS via "type": "commonjs"
in a package.json ( #26439 )
...
This will respect `"type": "commonjs"` in a package.json to determine if
`.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to
be ESM it will be loaded as ESM though.
2024-11-13 15:10:09 +00:00
Divy Srivastava
6a4c6d83ba
fix(ext/node): zlib.crc32() ( #26856 )
...
Fixes https://github.com/denoland/deno/issues/26845
2024-11-13 20:07:45 +05:30
Leo Kettmeir
1cab4f07a3
refactor: use concrete error type for remaining ops ( #26746 )
2024-11-06 16:57:57 -08:00
snek
700f54a13c
fix(ext/node): better inspector support ( #26471 )
...
implement local inspector
future changes:
- wire up InspectorServer to enable open/close/url
- wire up connectToMainThread
Fixes https://github.com/denoland/deno/issues/25004
2024-11-06 14:08:26 +00:00
Leo Kettmeir
fe9f0ee593
refactor(runtime/permissions): use concrete error types ( #26464 )
2024-11-04 09:17:21 -08:00
David Sherret
826e42a5b5
fix: improved support for cjs and cts modules ( #26558 )
...
* cts support
* better cjs/cts type checking
* deno compile cjs/cts support
* More efficient detect cjs (going towards stabilization)
* Determination of whether .js, .ts, .jsx, or .tsx is cjs or esm is only
done after loading
* Support `import x = require(...);`
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-01 12:27:00 -04:00
Divy Srivastava
4774eab64d
chore: upgrade to rust 1.82 and LLVM 19 ( #26615 )
...
Upgrade to rust 1.82 and LLVM 19 . Removes one webusb test because
`requestAdapter` not working on new ubuntu 24 runners
2024-11-01 16:13:02 +05:30
Nathan Whitaker
6c6bbeb974
fix(node): Implement os.userInfo
properly, add missing toPrimitive
( #24702 )
...
Fixes the implementation of `os.userInfo`, and adds a missing
`toPrimitive` for `tmpdir`. This allows us to enable the corresponding
node_compat test.
2024-10-31 22:18:33 -07:00
Nathan Whitaker
6d44952d4d
fix(ext/node): resolve exports even if parent module filename isn't present ( #26553 )
...
Fixes https://github.com/denoland/deno/issues/26505
I'm not exactly sure how this case comes about (I tried to write tests
for it but couldn't manage to reproduce it), but what happens is the
parent filename ends up null, and we bail out of resolving the specifier
in package exports.
I've checked, and in node the parent filename is also null (so that's
not a bug on our part), but node continues to resolve even in that case.
So this PR should match node's behavior more closely than we currently
do.
2024-10-31 10:02:31 -07:00
Divy Srivastava
8bfd134da6
fix: clamp smi in fast calls by default ( #26506 )
...
Fixes https://github.com/denoland/deno/issues/26480
Ref
d2945fb65b
2024-10-31 10:10:07 +05:30
David Sherret
a8846eb70f
fix: remove permission check in op_require_node_module_paths ( #26645 )
2024-10-30 20:43:22 +00:00
Volker Schlecht
efb5e912e5
fix(ext/node): compatibility with {Free,Open}BSD ( #26604 )
...
Ports for both BSDs contain patches to the same effect.
See
https://github.com/freebsd/freebsd-ports/blob/main/www/deno/files/patch-ext_node_ops_fs.rs
and
8644910cae/lang/deno/patches/patch-ext_node_ops_fs_rs
2024-10-29 19:40:32 +05:30
Leo Kettmeir
c71e020668
refactor(ext/node): use concrete error types ( #26419 )
2024-10-24 10:45:17 -07:00
Nathan Whitaker
27df42f659
fix(ext/node): cancel pending ipc writes on channel close ( #26504 )
...
Fixes the issue described in
https://github.com/denoland/deno/issues/23882#issuecomment-2423316362 .
The parent was starting to send a message right before the process would
exit, and the channel closed in the middle of the write. Unlike with
reads, we weren't cancelling the pending writes, which resulted in a
`Broken pipe` error surfacing to the user.
2024-10-24 04:50:35 +00:00
Yoshiya Hinosawa
285635daa6
fix(ext/node): map ERROR_INVALID_NAME
to ENOENT
on windows ( #26475 )
...
In libuv on windows, `ERROR_INVALID_NAME` is mapped to `ENOENT`, but it
is mapped to `EINVAL` in our compat implementation, which causes the
issue #24899 .
ref:
d4ab6fbba4/src/win/error.c (L138)
closes #24899
closes #26411
closes #23635
closes #21165
closes #19067
2024-10-23 11:28:04 +09:00
Leo Kettmeir
6c4ef11f04
refactor(ext/fetch): use concrete error types ( #26220 )
2024-10-19 01:20:58 +00:00
Nathan Whitaker
1bccf45ecb
fix(ext/node): properly map reparse point error in readlink ( #26375 )
2024-10-18 10:11:06 -07:00
Toby Ealden
c5a7f98d82
fix(ext/node): handle http2 server ending stream ( #26235 )
...
Closes #24845
2024-10-15 23:35:10 +05:30
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