Bartek Iwańczuk
5095af7801
fix(ext/node): process.argv0 ( #20925 )
...
Fixes https://github.com/denoland/deno/issues/20924
2023-10-18 01:51:39 +02:00
David Sherret
cb70c4d0c4
fix(node): resolve file.d specifiers in npm packages ( #20918 )
...
Makes type checking octokit work.
Closes #20854
2023-10-17 00:26:38 +09:00
denobot
5da1bd802c
chore: forward v1.37.2 release commit to main ( #20897 )
...
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-13 03:12:06 +00:00
Bartek Iwańczuk
cee221109a
fix(node/http2): fixes to support grpc ( #20712 )
...
This commit improves "node:http2" module implementation, by enabling
to use "options.createConnection" callback when starting an HTTP2
session.
This change enables to pass basic client-side test with "grpc-js/grpc"
package.
Smaller fixes like "Http2Session.unref()" and "Http2Session.setTimeout()"
were handled as well.
Fixes #16647
2023-10-12 14:03:19 +00:00
Aapo Alasuutari
effb5e1ce4
fix(node/buffer): utf8ToBytes should return a Uint8Array ( #20769 )
2023-10-08 11:09:50 +09:00
Bartek Iwańczuk
edeccef499
refactor: migrate more ops to op2 macro ( #20808 )
...
Getting closer...
2023-10-07 21:04:03 +05:30
Bartek Iwańczuk
f0608a5b91
refactor: migrate ext/node/ops to op2 ( #20805 )
2023-10-06 00:16:36 +02:00
David Sherret
820e93e3e7
refactor(npm): add referrer when resolving npm package sub path from deno module ( #20800 )
...
Adds a `referrer` parameter to this function instead of using a fake
one.
2023-10-05 20:18:29 +00:00
林炳权
7a01799f49
chore: update to Rust 1.73 ( #20781 )
2023-10-05 14:49:09 -04:00
Divy Srivastava
ab3c9d41e4
fix(ext/node): implement uv.errname ( #20785 )
...
Fixes https://github.com/denoland/deno/issues/20617
2023-10-05 18:27:20 +00:00
David Sherret
1ff525e25b
refactor(node): combine node resolution code for resolving a package subpath from external code ( #20791 )
...
We had two methods that did the same functionality.
2023-10-04 23:05:12 -04:00
David Sherret
8c1677ecbc
refactor(npm): break up NpmModuleLoader
and move more methods into the managed CliNpmResolver
( #20777 )
...
Part of https://github.com/denoland/deno/issues/18967
2023-10-03 19:05:06 -04:00
Luca Casonato
d5b6c636b0
fix(ext/node): don't call undefined nextTick fn ( #20724 )
...
The `process` global is not defined in this file.
Fixes #20441
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-02 14:13:57 +02:00
Divy Srivastava
1cda3840ff
perf(node): use faster utf8 byte length in Buffer#from ( #20746 )
...
Use the `core.byteLength` op for string utf8 length calculation in
`node:buffer`
```
# This patch
file:///Users/divy/gh/deno/buffer.mjs
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------- -----------------------------
Buffer#from 272.11 ns/iter 3,675,029.3 (268.41 ns … 301.15 ns) 271.62 ns 295.5 ns 301.15 ns
# Deno 1.37.1
file:///Users/divy/gh/deno/buffer.mjs
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------- -----------------------------
Buffer#from 411.28 ns/iter 2,431,428.8 (393.82 ns … 439.92 ns) 418.85 ns 434.4 ns 439.92 ns
```
2023-09-30 20:04:40 +05:30
Rui He
74e4c7f80f
feat(node/os): Add availableParallelism
( #20745 )
2023-09-30 19:51:06 +05:30
David Sherret
d43e48c4e9
refactor(ext/node): remove dependency on deno_npm and deno_semver ( #20718 )
...
This is required from BYONM (bring your own node_modules).
Part of #18967
2023-09-28 22:43:45 +02:00
Chen Su
507f24c474
fix(ext/node): fix TypeError in Buffer.from with base64url encoding. ( #20705 )
...
For the following example, if I set the encoding to `base64url`, it'll
throw an unexpected TypeError:
```ts
import { Buffer } from "node:buffer";
Buffer.from("IntcImhlbGxvXCI6XCJoZGQvZStpXCJ9Ig", "base64url").toString();
// error: Uncaught TypeError: src.subarray is not a function
// const buf = Buffer.from(
// ^
// at blitBuffer (ext:deno_node/internal/buffer.mjs:1779:15)
// at Uint8Array.base64urlWrite (ext:deno_node/internal/buffer.mjs:691:10)
// at Object.write (ext:deno_node/internal/buffer.mjs:2195:11)
// at Uint8Array.write (ext:deno_node/internal/buffer.mjs:794:14)
// at fromString (ext:deno_node/internal/buffer.mjs:214:22)
// at _from (ext:deno_node/internal/buffer.mjs:119:12)
// at Function.from (ext:deno_node/internal/buffer.mjs:157:10)
// at file:///Users/foodieats/temp/buffer1.ts:3:20
```
The error caused by `base64urlWrite` function, it should call
`forgivingBase64UrlDecode` not `forgivingBase64UrlEncode`
Also fixed #20563 .
2023-09-27 07:54:19 -06:00
denobot
3b78981ffe
chore: forward v1.37.1 release commit to main ( #20706 )
...
This is the release commit being forwarded back to main for 1.37.1
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-09-27 09:13:48 +00:00
David Sherret
dcb00bb9b8
chore: slight cleanup in npm resolvers ( #20692 )
2023-09-26 16:42:39 -04:00
Bartek Iwańczuk
3c0d6de155
refactor: rewrite ext/node/crypto to op2 macro ( #20675 )
2023-09-26 12:07:04 +00:00
Aapo Alasuutari
cb9ab9c3ac
fix(ext/node): Fix invalid length variable reference in blitBuffer ( #20648 )
2023-09-24 13:48:23 +03:00
Mikhail
0e2637f851
fix(ext/node): simplified array.from + map ( #20653 )
...
`Array.from` has optional second argument. Calling `map` is not required
for this case.
2023-09-24 11:23:25 +02:00
Bartek Iwańczuk
99dd8097c3
refactor: rewrite ext/node/http2 to op2 macro ( #20629 )
2023-09-23 10:25:36 -06:00
Bartek Iwańczuk
1ad097c4bf
refactor: rewrite ops using i64/usize to op2 ( #20647 )
2023-09-23 14:04:47 +02:00
Divy Srivastava
75a724890d
fix(node): supported arguments to randomFillSync
( #20637 )
...
Fixes https://github.com/denoland/deno/issues/20634
2023-09-23 10:04:55 +02:00
Alessandro Scandone
15cfb67551
fix(node/package_json): Avoid panic when "exports" field is null ( #20588 )
...
Fixes #20558
Implementation: when package.json `exports` field is `null`, treat it as
if it was not set
2023-09-22 11:21:38 +02:00
Divy Srivastava
cf6f649829
fix(node): point process.version to Node 18.18.0 LTS ( #20597 )
...
Fixes https://github.com/denoland/deno/issues/20590
2023-09-21 06:44:37 +00:00
denobot
997aa604df
1.37.0 ( #20574 )
...
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-09-19 20:29:17 +00:00
Bartek Iwańczuk
bf07604113
feat: Add "deno jupyter" subcommand ( #20337 )
...
This commit adds "deno jupyter" subcommand which
provides a Deno kernel for Jupyter notebooks.
The implementation is mostly based on Deno's REPL and
reuses large parts of it (though there's some clean up that
needs to happen in follow up PRs). Not all functionality of
Jupyter kernel is implemented and some message type
are still not implemented (eg. "inspect_request") but
the kernel is fully working and provides all the capatibilities
that the Deno REPL has; including TypeScript transpilation
and npm packages support.
Closes https://github.com/denoland/deno/issues/13016
---------
Co-authored-by: Adam Powers <apowers@ato.ms>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-16 02:42:09 +02:00
Bartek Iwańczuk
5a1505db67
feat(ext/node): http2.connect() API ( #19671 )
...
This commit improves compatibility of "node:http2" module by polyfilling
"connect" method and "ClientHttp2Session" class. Basic operations like
streaming, header and trailer handling are working correctly.
Refing/unrefing is still a TODO and "npm:grpc-js/grpc" is not yet working
correctly.
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-15 21:51:25 +02:00
Bartek Iwańczuk
bbb348aa33
refactor: rewrite ext/node to op2 ( #20489 )
2023-09-14 08:29:44 +02:00
Matt Mastracci
81d50e1b66
chore: bump deno_core and cargo update ( #20480 )
...
Bump deno_core, pulling in new rusty_v8. Requires some op2/deprecation
fixes.
2023-09-13 22:01:31 +00:00
Bartek Iwańczuk
aaff69db3f
perf(node/net): optimize socket reads for 'npm:ws' package ( #20449 )
...
Fixes performance regression introduced by
https://github.com/denoland/deno/pull/20223 and
https://github.com/denoland/deno/pull/20314 . It's enough to have one
"shared" buffer per socket
and no locking mechanism is required.
2023-09-11 20:38:57 +02:00
Curran McConnell
a9cc4631ca
fix(ext/node/ops/zlib/brotli): Allow decompressing more than 4096 bytes ( #20301 )
...
Fixes https://github.com/denoland/deno/issues/19816
In that issue, I suggest switching over the other brotli functionality
to the Rust API provided by the `brotli` crate. Here, I only do that
with the `brotli_decompress` function to fix the bug with buffers longer
than 4096 bytes.
2023-09-08 09:11:33 +05:30
Aapo Alasuutari
9d6584c16f
perf(ext/node): Optimise Buffer string operations ( #20158 )
...
Extracted from https://github.com/denoland/deno/pull/17815
Optimise Buffer's string operations, most significantly when dealing
with ASCII and UTF-16. Base64 and HEX encodings are affected to much
lesser degrees.
## Performance
### String length 15
With very small strings we're at break-even or sometimes even lose a tad
bit of performance from creating a `DataView` that ends up not paying
for itself.
**This PR:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 1.15 µs/iter 871,388.6 (728.78 ns … 1.56 µs) 1.23 µs 1.56 µs 1.56 µs
Buffer.from base64 string 1.63 µs/iter 612,790.9 (1.31 µs … 1.96 µs) 1.77 µs 1.96 µs 1.96 µs
Buffer.from utf16 string 1.41 µs/iter 707,396.3 (915.24 ns … 1.93 µs) 1.61 µs 1.93 µs 1.93 µs
Buffer.from hex string 1.87 µs/iter 535,357.9 (1.56 µs … 2.19 µs) 2 µs 2.19 µs 2.19 µs
Buffer.toString ascii string 154.58 ns/iter 6,469,162.8 (149.69 ns … 198 ns) 154.51 ns 182.89 ns 191.91 ns
Buffer.toString base64 string 161.65 ns/iter 6,186,189.6 (150.91 ns … 181.15 ns) 165.18 ns 171.87 ns 174.94 ns
Buffer.toString utf16 string 292.74 ns/iter 3,415,959.8 (285.43 ns … 312.47 ns) 295.25 ns 310.47 ns 312.47 ns
Buffer.toString hex string 89.61 ns/iter 11,159,315.6 (81.09 ns … 123.77 ns) 91.09 ns 113.62 ns 119.28 ns
```
**Main:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 1.26 µs/iter 794,875.8 (1.07 µs … 1.46 µs) 1.31 µs 1.46 µs 1.46 µs
Buffer.from base64 string 1.65 µs/iter 607,853.3 (1.38 µs … 2.01 µs) 1.69 µs 2.01 µs 2.01 µs
Buffer.from utf16 string 1.34 µs/iter 744,894.6 (1.09 µs … 1.55 µs) 1.45 µs 1.55 µs 1.55 µs
Buffer.from hex string 2.01 µs/iter 496,345.8 (1.54 µs … 2.6 µs) 2.26 µs 2.6 µs 2.6 µs
Buffer.toString ascii string 150.16 ns/iter 6,659,630.5 (144.99 ns … 166.68 ns) 152.4 ns 157.26 ns 159.14 ns
Buffer.toString base64 string 164.73 ns/iter 6,070,692.0 (158.77 ns … 185.63 ns) 168.48 ns 175.74 ns 176.68 ns
Buffer.toString utf16 string 150.61 ns/iter 6,639,864.0 (148.2 ns … 168.29 ns) 150.93 ns 157.21 ns 168.15 ns
Buffer.toString hex string 94.21 ns/iter 10,614,972.9 (86.21 ns … 98.75 ns) 95.43 ns 97.99 ns 98.21 ns
```
### String length 1500
With moderate lengths we already see great upsides for `Buffer.from()`
with ASCII and UTF-16.
**This PR:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 5.79 µs/iter 172,562.6 (4.72 µs … 4.71 ms) 5.04 µs 10.3 µs 11.67 µs
Buffer.from base64 string 5.08 µs/iter 196,678.9 (4.97 µs … 5.76 µs) 5.08 µs 5.76 µs 5.76 µs
Buffer.from utf16 string 9.68 µs/iter 103,316.5 (7.14 µs … 3.44 ms) 10.32 µs 13.42 µs 15.21 µs
Buffer.from hex string 53.7 µs/iter 18,620.2 (49.37 µs … 2.2 ms) 54.74 µs 72.2 µs 81.07 µs
Buffer.toString ascii string 6.63 µs/iter 150,761.3 (5.59 µs … 1.11 ms) 6.08 µs 15.68 µs 24.77 µs
Buffer.toString base64 string 460.57 ns/iter 2,171,224.4 (448.33 ns … 511.73 ns) 465.05 ns 495.54 ns 511.73 ns
Buffer.toString utf16 string 6.52 µs/iter 153,287.0 (6.47 µs … 6.66 µs) 6.53 µs 6.66 µs 6.66 µs
Buffer.toString hex string 3.68 µs/iter 271,965.4 (3.64 µs … 3.82 µs) 3.68 µs 3.82 µs 3.82 µs
```
**Main:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 11.46 µs/iter 87,298.1 (8.53 µs … 834.1 µs) 9.61 µs 83.31 µs 87.3 µs
Buffer.from base64 string 5.4 µs/iter 185,027.8 (5.07 µs … 7.49 µs) 5.44 µs 7.49 µs 7.49 µs
Buffer.from utf16 string 20.3 µs/iter 49,270.8 (13.55 µs … 649.11 µs) 18.8 µs 113.93 µs 125.17 µs
Buffer.from hex string 52.03 µs/iter 19,218.9 (48.74 µs … 2.59 ms) 52.84 µs 67.05 µs 73.56 µs
Buffer.toString ascii string 6.46 µs/iter 154,822.5 (6.32 µs … 6.69 µs) 6.52 µs 6.69 µs 6.69 µs
Buffer.toString base64 string 440.19 ns/iter 2,271,764.6 (427 ns … 490.77 ns) 444.74 ns 484.64 ns 490.77 ns
Buffer.toString utf16 string 6.89 µs/iter 145,106.7 (6.81 µs … 7.24 µs) 6.91 µs 7.24 µs 7.24 µs
Buffer.toString hex string 3.66 µs/iter 273,456.5 (3.6 µs … 4.02 µs) 3.64 µs 4.02 µs 4.02 µs
```
### String length 2^20
With massive lengths we the difference in ASCII and UTF-16 parsing
performance is enormous.
**This PR:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 4.1 ms/iter 243.7 (2.64 ms … 6.74 ms) 4.43 ms 6.26 ms 6.74 ms
Buffer.from base64 string 3.74 ms/iter 267.6 (2.91 ms … 4.92 ms) 3.96 ms 4.31 ms 4.92 ms
Buffer.from utf16 string 7.72 ms/iter 129.5 (5.91 ms … 11.03 ms) 7.97 ms 11.03 ms 11.03 ms
Buffer.from hex string 35.72 ms/iter 28.0 (34.71 ms … 38.42 ms) 35.93 ms 38.42 ms 38.42 ms
Buffer.toString ascii string 78.92 ms/iter 12.7 (42.72 ms … 94.13 ms) 91.64 ms 94.13 ms 94.13 ms
Buffer.toString base64 string 833.62 µs/iter 1,199.6 (638.05 µs … 5.97 ms) 826.86 µs 2.45 ms 2.48 ms
Buffer.toString utf16 string 79.35 ms/iter 12.6 (69.72 ms … 88.9 ms) 86.66 ms 88.9 ms 88.9 ms
Buffer.toString hex string 31.04 ms/iter 32.2 (4.3 ms … 46.9 ms) 37.21 ms 46.9 ms 46.9 ms
```
**Main:**
```
benchmark time (avg) iter/s (min … max) p75 p99 p995
-------------------------------------------------------------------------------------------------------------------- -----------------------------
Buffer.from ascii string 18.66 ms/iter 53.6 (15.61 ms … 23.26 ms) 20.62 ms 23.26 ms 23.26 ms
Buffer.from base64 string 4.7 ms/iter 212.9 (2.94 ms … 9.07 ms) 4.65 ms 9.06 ms 9.07 ms
Buffer.from utf16 string 33.49 ms/iter 29.9 (31.24 ms … 35.67 ms) 34.08 ms 35.67 ms 35.67 ms
Buffer.from hex string 39.38 ms/iter 25.4 (38.66 ms … 42.36 ms) 39.58 ms 42.36 ms 42.36 ms
Buffer.toString ascii string 77.68 ms/iter 12.9 (67.46 ms … 95.68 ms) 84.71 ms 95.68 ms 95.68 ms
Buffer.toString base64 string 825.53 µs/iter 1,211.3 (655.38 µs … 6.69 ms) 816.62 µs 3.07 ms 3.13 ms
Buffer.toString utf16 string 76.54 ms/iter 13.1 (66.9 ms … 85.26 ms) 83.63 ms 85.26 ms 85.26 ms
Buffer.toString hex string 38.56 ms/iter 25.9 (33.83 ms … 46.56 ms) 45.33 ms 46.56 ms 46.56 ms
```
2023-09-07 14:41:16 -06:00
Matt Mastracci
9226207c01
chore(ext/node): port some ops to op2 ( #20400 )
2023-09-07 10:56:02 -06:00
David Sherret
3fc19dab47
feat: support import attributes ( #20342 )
2023-09-07 09:09:16 -04:00
Divy Srivastava
9befa566ec
fix(ext/node): implement AES GCM cipher ( #20368 )
...
Adds support for AES-GCM 128/256 bit keys in `node:crypto` and
`setAAD()`, `setAuthTag()` and `getAuthTag()`
Uses https://github.com/littledivy/aead-gcm-stream
Fixes https://github.com/denoland/deno/issues/19836
https://github.com/denoland/deno/issues/20353
2023-09-06 11:01:50 +05:30
zuisong
4a561f12db
fix(node/child_process): don't crash on undefined/null value of an env var ( #20378 )
...
Fixes #20373
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-05 12:42:35 +02:00
Fabian
2cc7c8432f
fix(node): Bump hardcoded version to latest ( #20366 )
...
When trying to run
```
deno run -A --unstable npm:astro dev
```
in my Astro project it fails with:
```
Node.js v18.12.1 is not supported by Astro!
Please upgrade Node.js to a supported version: ">=18.14.1"
```
My current version is:
```
~ ❯ node --version
v20.5.1
```
Bumping the version to the latest stable Release of node in
`ext/node/polyfills/_process/process.ts` fixes this.
I don't know if this causes any conflicts, so please feel free to
correct me here.
2023-09-04 12:33:15 +02:00
Bartek Iwańczuk
2b191c6e9d
chore: forward v1.36.4 to main ( #20352 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-09-01 18:08:58 +00:00
Jakub Jirutka
3436f65e20
fix(ext/node): remove unnecessary and incorrect type priority_t ( #20276 )
...
`getpriority` and `setpriority` on musl libc accepts `int` / `c_int` /
`i32` as the first argument, not `u32`.
Since the `PRIO_PROCESS` constant is imported from the same crate (libc)
as the `getpriority` and `setpriority` functions, this type cast seems
to be completely unnecessary here.
It was introduced in aa8078b688
by
@crowlKats.
Relevant sources:
-
835661543d/src/unix/linux_like/linux/musl/mod.rs (L739-L740)
- https://git.musl-libc.org/cgit/musl/tree/src/misc/setpriority.c
- https://git.musl-libc.org/cgit/musl/tree/src/misc/getpriority.c
Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-09-01 11:21:23 +02:00
Bartek Iwańczuk
2929313652
fix(node/http): don't leak resources on destroyed request ( #20040 )
...
Closes https://github.com/denoland/deno/issues/19828
2023-08-29 12:13:58 +00:00
Yoshiya Hinosawa
fb7092fb43
fix(ext/node): fix argv[1] in Worker ( #20305 )
2023-08-29 12:18:25 +09:00
Matt Mastracci
7adaf613bf
fix(ext/node): shared global buffer unlock correctness fix ( #20314 )
...
The fix for #20188 was not entirely correct -- we were unlocking the
global buffer incorrectly. This PR introduces a lock state that ensures
we only unlock a lock we have taken out.
2023-08-28 15:28:39 -06:00
osddeitf
c2547ba039
fix(node/http): correctly send Content-length
header instead of Transfer-Encoding: chunked
( #20127 )
...
Fix #20063 .
2023-08-28 09:32:54 +02:00
林炳权
2080669943
chore: update to Rust 1.72 ( #20258 )
...
<!--
Before submitting a PR, please read https://deno.com/manual/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.
-->
As the title.
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-26 22:04:12 -06:00
Divy Srivastava
1cb547d885
fix(node): propagate create cipher errors ( #20280 )
...
Fixes https://github.com/denoland/deno/issues/19002
2023-08-26 10:45:37 +05:30
VlkrS
37de5e8623
feat(node): use i32 for priority_t on MacOS and {Free,Open}BSD ( #20286 )
...
Reference from the FreeBSD port
3afa24c6e3/www/deno/files/patch-ext_node_ops_os.rs
2023-08-25 16:46:19 +00:00
denobot
3a2d284c96
chore: forward v1.36.3 release commit to main ( #20270 )
...
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-24 17:53:01 +00:00