Divy Srivastava
a401a79c75
fix(ext/node): fix missing privateKey.x in curve25519 JWK ( #27990 )
...
Fixes https://github.com/denoland/deno/issues/27972
2025-02-06 12:11:42 +05:30
Divy Srivastava
28faaee772
fix(ext/node): throw Session methods when database is closed ( #27968 )
2025-02-06 08:52:49 +05:30
Divy Srivastava
ece384c094
fix(ext/node): implement DatabaseSync#applyChangeset()
( #27967 )
...
https://nodejs.org/api/sqlite.html#databaseapplychangesetchangeset-options
```js
const sourceDb = new DatabaseSync(':memory:');
const targetDb = new DatabaseSync(':memory:');
sourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');
targetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');
const session = sourceDb.createSession();
const insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
insert.run(1, 'hello');
insert.run(2, 'world');
const changeset = session.changeset();
targetDb.applyChangeset(changeset);
// Now that the changeset has been applied, targetDb contains the same data as sourceDb.
```
2025-02-06 08:52:39 +05:30
Divy Srivastava
28834a89bb
fix(ext/node): implement SQLite Session API ( #27909 )
...
https://nodejs.org/api/sqlite.html#class-session
---------
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-02-04 21:59:13 +05:30
Divy Srivastava
c2832d70a1
fix(ext/sqlite): add sourceSQL
and expandedSQL
getters ( #27921 )
2025-02-04 17:38:41 +05:30
David Sherret
61faa32920
perf: node resolution cache ( #27838 )
...
This adds a cache for node resolution, which makes repeat lookups about
15x faster.
2025-02-03 20:25:10 -05:00
Divy Srivastava
b5c3f4f782
fix(ext/node): support read-only database in node:sqlite
( #27930 )
...
Implements the `readOnly` option for `DatabaseSync`.
Permissions:
`--allow-read=test.db --allow-write=test.db` => all works
`--allow-read=test.db` => only `readOnly` dbs work, cannot create new db
2025-02-03 16:41:45 +05:30
Divy Srivastava
3c56e6c7cd
fix(ext/node): enforce -RW perms on node:sqlite
( #27928 )
...
require RW permission on the database path except when using in-memory
mode.
2025-02-02 15:49:39 +05:30
Divy Srivastava
7d19668255
fix(ext/node): throw RangeError when sqlite INTEGER is too large ( #27907 )
...
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-02-01 13:19:53 +05:30
Divy Srivastava
1cbaee9f52
fix(ext/node): sqlite bind support bigint values ( #27890 )
2025-01-31 18:31:05 +05:30
Yoshiya Hinosawa
1cecc0a8b0
fix(ext/node): support proxy http request ( #27871 )
2025-01-31 21:46:54 +09:00
Divy Srivastava
057f257052
fix(ext/node): represent sqlite blob as Uint8Array ( #27889 )
2025-01-31 17:53:48 +05:30
Nathan Whitaker
bac8171c40
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-30 23:38:14 +00:00
snek
02ed300525
feat(node:http): add http information support ( #27381 )
...
Implements some client and server events to improve compat.
Fixes: https://github.com/denoland/deno/issues/27239
2025-01-28 17:37:53 +00:00
Divy Srivastava
aeac5a6338
feat(ext/node): implement node:sqlite
( #27308 )
...
Depends on:
- https://github.com/denoland/deno_core/pull/994
- https://github.com/denoland/deno_core/pull/993
- https://github.com/denoland/deno_core/issues/999
- https://github.com/denoland/deno_core/pull/1000
- https://github.com/denoland/deno_core/pull/1001
Closes https://github.com/denoland/deno/issues/24828

---------
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-01-28 19:30:03 +05:30
Nathan Whitaker
094e268002
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-27 23:35:51 -08:00
David Sherret
679902a108
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-27 15:23:20 -05:00
Divy Srivastava
533993efcf
fix(ext/node): implement X509Certificate#checkHost ( #27821 )
...
Fixes https://github.com/denoland/deno/issues/27619
2025-01-27 16:33:03 +05:30
Divy Srivastava
f678a17313
fix(ext/node): fix panic when invalid AES GCM key size ( #27818 )
...
Fixes https://github.com/denoland/deno/issues/27807
2025-01-27 16:32:25 +05:30
Divy Srivastava
1efc77331c
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-27 09:12:51 +05:30
Divy Srivastava
4f27d7cdc0
fix(ext/node): GCM auth tag check on DechiperIv#final ( #27733 )
2025-01-20 18:16:44 +05:30
Leo Kettmeir
054075730c
refactor: update deno_core and use more concrete errors ( #27620 )
...
waiting for https://github.com/denoland/deno_core/pull/1043
Fixes #27672
2025-01-17 09:41:52 -08:00
Bartek Iwańczuk
0050857f51
refactor: add 'deno_process' crate ( #27680 )
...
Untangled the whole `runtime/ops/process.rs` from `ext/node/` and moved
to a separate `ext/process` crate.
2025-01-17 13:30:14 +01:00
David Sherret
0b033140c0
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-14 10:01:05 -05:00
Leo Kettmeir
ea30e188a8
refactor: update deno_core for error refactor ( #26867 )
...
Closes #26171
---------
Co-authored-by: David Sherret <dsherret@gmail.com>
2025-01-08 14:52:32 -08:00
Divy Srivastava
fffa3804aa
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-08 22:09:55 +05:30
David Sherret
0457c38d4f
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-02 10:06:35 -05:00
Kenta Moriuchi
8fb073d7b4
chore: Happy New Year 2025 ( #27509 )
2024-12-31 19:12:39 +00:00
David Sherret
ac7b33a340
chore: cargo fmt - turn on group_imports=StdExternalCrate ( #26646 )
2024-12-31 12:13:39 -05:00
David Sherret
4638caa740
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`.
2024-12-31 11:29:07 -05:00
Bartek Iwańczuk
1cd36009b0
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>
2024-12-31 13:49:02 +01:00
Yoshiya Hinosawa
c45d0dadb3
fix(ext/node): add support of any length IV for aes-(128|256)-gcm ciphers ( #27476 )
2024-12-27 17:46:01 +09:00
Yoshiya Hinosawa
91150706d8
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
2024-12-26 13:24:28 +09:00
snek
ae74407412
chore: upgrade libc ( #27414 )
...
need to do this for quic and they deprecated this method in libc without
actually providing an alternative so :/
2024-12-18 14:47:21 +01:00
Divy Srivastava
50871b2aa3
fix: FastString v8_string() should error when cannot allocated ( #27375 )
...
Upgrades deno_core to 0.326.0
2024-12-16 13:51:49 +00:00
Satya Rohith
960776cd32
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>
2024-12-13 01:44:42 +01:00
David Sherret
f863a623c9
fix: improve auto-imports for npm packages ( #27224 )
...
Improves auto-imports when using `"nodeModulesDir": "auto"`
2024-12-04 12:05:34 -05:00
David Sherret
f161adf19e
perf(compile): read embedded files as static references when UTF-8 and reading as strings ( #27033 )
2024-11-27 21:28:41 -05:00
David Sherret
115a306656
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-26 14:38:24 -05: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