0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-07 23:06:50 -05:00
Commit graph

681 commits

Author SHA1 Message Date
Divy Srivastava
4a2b8fc22d
fix(ext/node): expose sqlite changeset constants (#27992)
https://nodejs.org/api/sqlite.html#sqliteconstants
2025-02-06 13:08:40 +05:30
Yoshiya Hinosawa
78fceb4a33
fix(ext/node): fix twitter-api-v2 compatibility (#27971) 2025-02-06 16:35:55 +09:00
Divy Srivastava
441b1d307f
fix(ext/node): handle non-ws upgrade headers (#27931) 2025-02-04 17:35:48 +05:30
Divy Srivastava
f28bbcced5
fix(ext/node): expose brotli stream APIs (#27943)
Fixes https://github.com/denoland/deno/issues/27170
2025-02-04 07:47:02 +05:30
Divy Srivastava
7107c358a1
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-03 16:39:04 +05:30
Yoshiya Hinosawa
1cecc0a8b0
fix(ext/node): support proxy http request (#27871) 2025-01-31 21:46:54 +09:00
Divy Srivastava
08cc22105f
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-01-31 11:38:26 +05:30
Cyan
e6dda60d5c
feat: implement process.cpuUsage (Deno.cpuUsage) (#27217) 2025-01-30 17:23:05 +05:30
Divy Srivastava
79fa6028d1
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-29 20:49:43 +05:30
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


![image](https://github.com/user-attachments/assets/396fc8b7-30cb-411c-82bc-2e9e3e6bbb18)

---------

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
Yoshiya Hinosawa
0e47205ebe
fix(ext/node): do not apply socket-init-workaround to ipc socket (#27779)
This PR resolves 2 issues of Socket class of node compat (both are
related to playwright)

Currently `browser.launch()` of playwright is not working.
`browser.launch` opens PipeTransport (which is based on Pipe/IPC socket)
with the browser process. But that pipe doesn't start reading the data
because of the workaround #27662 (which pauses the socket at the
beginning if it's from playwright-core). This PR fixes this issue by
checking whether the given handle is `ipc` handle or not.

Another issue is that sock-init-workaround for TLS connection stopped
working at #27707 because of the changes of TLS socket initialization
steps. This change fixes the issue by correctly returning the function
in workaround path.

The added case `specs::npm::playwright_compat` checks both fixes with
actual playwright and playwright-core packages.

`browser.launch` issues
closes #16899
closes #27623 

`https.request` issue
closes #27658
2025-01-28 15:38:45 +09: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
a2d0872225
fix(ext/node): fix async variant of brotliDecompress (#27815)
Fixes https://github.com/denoland/deno/issues/27729
2025-01-27 09:13:47 +05:30
Divy Srivastava
802b9d6309
chore(ext/node): remove internal/streams/buffer_list.mjs (#27822)
This was never used internally and not supposed to be public either.
2025-01-27 09:13:06 +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
Yoshiya Hinosawa
2511458ac1
fix(ext/node): npm:mqtt compatibility (#27792) 2025-01-27 11:47:32 +09:00
Divy Srivastava
f3c0bbf926
fix(ext/node): reference error in zlib.crc32 (#27777)
Fixes https://github.com/denoland/deno/issues/27774
2025-01-22 14:31:17 +00:00
Yoshiya Hinosawa
773825aeb9
fix(ext/node): fix formatting of debug logs (#27772) 2025-01-22 20:13:13 +09:00
ZYSzys
4e0bf4b093
fix(ext/node): add FileHandle#sync (#27677) 2025-01-21 14:52:40 +09:00
Divy Srivastava
4f27d7cdc0
fix(ext/node): GCM auth tag check on DechiperIv#final (#27733) 2025-01-20 18:16:44 +05:30
Yoshiya Hinosawa
b55451b178
fix(ext/node): tls.connect regression (#27707)
The TLS start sequence has been broken since #26661 because of the way
how we wrap TCP handle to create TLS handle.

#26661 introduced happy-eyeballs algorithm and some connection could be
dropped because of happy-eyeball attempt timeout. The current
implementation doesn't consider that case and it could start TLS
handshake with timed out TCP connection. That caused #27652 .

This PR fixes it by changing the initialization steps. Now `wrapHandle`
of TLSSocket set up `afterConnectTls` callback in TCP handle, and
`afterConnect` of TCP handle calls it at `connect` event timing if it
exists. This avoids starting TLS session with timed out connection.

closes #27652
2025-01-18 00:10:26 +09: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
Yoshiya Hinosawa
339bc44c58
fix(ext/node): propagate socket error to client request object (#27678)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2025-01-17 12:30:00 +09:00
Masato Yoshioka
b22a50cb0c
fix(ext/node): add chown method to FileHandle class (#27638) 2025-01-15 17:15:07 +09:00
Bartek Iwańczuk
974e2f44b2
refactor: add 'deno_os' crate (#27655)
This commit creates "deno_os" extension crate and moves
numerous ops from "runtime/" crate to the new crate.
2025-01-14 17:29:36 +01:00
Yoshiya Hinosawa
c943f56949
fix(ext/node): fix playwright http client (#27662) 2025-01-15 01:00:55 +09:00
siaeyy
a1f50a7422
fix(node/fs): add utimes method to the FileHandle class (#27582) 2025-01-14 18:08:22 +09:00
Aaron Ang
9cb089f6db
fix(ext/node): add writev method to FileHandle (#27563)
Part of #25554
2025-01-14 18:01:14 +09:00
TateKennington
5a39f2f096
fix(node): Prevent node:child_process from always inheriting the parent environment (#27343) (#27340)
Fixes #27343

Currently the node:child_process polyfill is always passing the full
parent environment to all spawned subprocesses. In the case where
`options.env` is provided those keys are overridden but the rest of the
parent environment is still passed through.

On Node the behaviour is for child processes to only inherit the parent
environment when `options.env` isn't specified. When `options.env` is
specified the child process inherits only those keys.

This PR updates the internal node child_process polyfill so that the
`clearEnv` argument is set to true when spawning the subprocess to
prevent the parent environment always being inherited by default. It
also fixes an issue where `normalizeSpawnArguments` wasn't returning the
`env` option if `options.env` was unset.
2025-01-13 13:46:56 -08:00
Yoshiya Hinosawa
2091691164
fix(ext/node): apply @npmcli/agent workaround to npm-check-updates (#27639)
See the comment
https://github.com/denoland/deno/pull/25470#issuecomment-2435077722 for
the reason why we do this workaround to make `make-fetch-happen` work in
Deno

This PR applies the same workaround to `npm-check-updates` package.
`npm-check-updates` internally uses
[`npm-registry-fetch`](https://www.npmjs.com/package/npm-registry-fetch)
which uses
[`make-fetch-happen`](https://www.npmjs.com/package/make-fetch-happen)
(the problematic package) for making http request to npm registry.

The detection of `make-fetch-happen` doesn't work for
`npm-check-updates` because we use call stack at `net.Socket`
constructor to check if it's called from `make-fetch-happen`, but
`npm-check-updates` bundles its dependency and the check doesn't work.

This PR adds the check of `npm-check-updates` string in call stack in
net.Socket constructor to trigger the workaroud.

closes #27629
2025-01-13 18:11:26 +09:00
Rajhans Jadhao
1dd5bd667c
fix(ext/node): use primordials in ext/node/polyfills/_fs_common.ts (#27589)
Related to #24236
2025-01-10 13:51:50 +01:00
Yusuke Tanaka
1661ddd9ca
fix(ext/node): have process global available in Node context (#27562)
This commit makes `process` global always available in Node context.

`process` global was previously available explicitly in `deno_node`, but then
got removed in #25291 and made globally available regardless of whether it's in
Deno or Node context, so this commit does not have any effect on Deno CLI.
However, for users who want to use `deno_node` ext only, it makes sense to have
`process` available to simulate the Node environment individually.

This change may bring some negative performance impact. To measure how large the
impact would be, a very simple benchmark was performed whose results can be
found at https://github.com/magurotuna/process_global_bench.
2025-01-08 13:14:57 +09:00
Nikolay Karadzhov
8cda4cf53d
feat(node/fs): Add a chmod method to the FileHandle class (#27522)
Add the chmod method to the FileHandle class in node compat as part of
#25554
2025-01-07 14:58:14 +01:00
Kenta Moriuchi
8fb073d7b4
chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00: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
Divy Srivastava
5194222e02
fix(ext/node): convert brotli chunks with proper byte offset (#27455)
Fixes https://github.com/denoland/deno/issues/27029
Fixes https://github.com/denoland/deno/issues/26086
2024-12-28 12:44:37 +05:30
Divy Srivastava
6061f22abd
fix(ext/node): RangeError timingSafeEqual with different byteLength (#27470)
Fixes https://github.com/denoland/deno/issues/27214
2024-12-27 11:20:49 +05:30
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
Filip Stevanovic
23f7032d56
fix(ext/node): add truncate method to the FileHandle class (#27389) 2024-12-20 13:23:51 +09:00
Yoshiya Hinosawa
350d9dce41
fix(ext/node): do not exit worker thread when there is pending async op (#27378)
This change fixes the premature exit of worker threads when there are still
remaining pending ops.

This change reuses the idea of #22647 (unref'ing `op_worker_recv_message` in
worker threads if closeOnIdle specified) and uses
`web_worker.has_message_event_listener` check in the opposite way as
#22944. (Now we continue the worker when `has_message_event_listener` is
true instead of stopping it when `has_message_event_listener` is false.

closes #23061
closes #26154
2024-12-19 17:39:20 +09:00
Filip Stevanovic
8fc4796ed5
fix(ext/node): Fix fs.access/fs.promises.access with X_OK mode parameter on Windows (#27407)
- Fixes an issue on Windows where the `fs.constants.X_OK` flag caused
`fs.access` and `fs.promises.access` to incorrectly throw a "permission
denied" error
- Introduced formatting changes due to the formatting tool
- Fixed the issue by always removing the `X_OK` bit from the mode
variable m (not sure if it's necessary to check for the presence of it
in the `mode` param first?)
- Updated unit tests to handle the mentioned constant
- `X_OK` bit is ignored in the Node implementation and should behave
like `F_OK`

fs constants Node documentation:
https://nodejs.org/api/fs.html#fsconstants

fixes https://github.com/denoland/deno/issues/27405
2024-12-18 14:52:37 -08: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
Nathan Whitaker
44d76975d5
fix(node): update list of builtin node modules, add missing export to _http_common (#27294)
Fixes https://github.com/denoland/deno/issues/27289

We exported these but forgot to add them to the list of builtins used by
the resolver, so we weren't resolving bare imports of some modules (e.g.
`"_http_common"`)

Also adds a missing export of `HTTPParser` from `_http_common`
2024-12-09 13:01:09 -08:00
Bartek Iwańczuk
883abfa1bf
fix(ext/node): handle Float16Array in node:v8 module (#27285)
Closes https://github.com/denoland/deno/issues/26580
2024-12-09 19:04:47 +00:00
Yoshiya Hinosawa
07737b03bc
fix(ext/node): accept file descriptor in fs.readFile(Sync) (#27252)
closes #27123
2024-12-06 20:18:08 +09:00
Marvin Hagemeister
e8d731c05f
fix(node/worker_threads): data url not encoded properly with eval (#27184)
When using the `eval` option on Node's `worker_threads` the code is
passed as a `data:` URL. But we didn't encode the actual code for that,
which lead to syntax errors when including characters not allowed in an
URL.

Fixes a part of https://github.com/denoland/deno/issues/27167
2024-12-05 14:30:43 +01:00
Marvin Hagemeister
2fbc5fea83
fix(node/fs): support recursive option in readdir (#27179)
We didn't support the `recursive` option of
`fs.readdir()/fs.readdirSync()`.

Fixes https://github.com/denoland/deno/issues/27175
2024-12-03 10:28:20 +01:00
Marvin Hagemeister
39722f190a
fix(node/timers): error when passing id to clearTimeout/clearInterval (#27130)
As pointed out in https://github.com/denoland/deno/issues/27126 we used
a variable which could potentially be of type `number` instead of the
`Timeout` class instance. Ensure that we're always setting `_destroyed`
on the class instead instead.

Fixes https://github.com/denoland/deno/issues/27126
2024-11-28 15:11:51 +01:00