1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
Commit graph

371 commits

Author SHA1 Message Date
Divy Srivastava
f4b11db072
fix(ext/node): Add "module" to builtinsModule (#23242)
Fixes https://github.com/denoland/deno/issues/22731
2024-04-05 11:38:00 +00:00
Satya Rohith
aa08155fd1
refactor(ext/node): remove worker_threads dependency on ext:runtime (#23206) 2024-04-03 21:39:53 +02:00
Bartek Iwańczuk
778b0b8eb5
fix(ext/node): polyfill node:domain module (#23088)
Closes https://github.com/denoland/deno/issues/16852

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-04-03 21:37:10 +02:00
Satya Rohith
86bc7a4381
fix(ext/node): patch MessagePort if provided as workerData (#23198)
MessagePort if directly assigned to workerData property instead of
embedding it in an object then it is not patched to a NodeMessagePort.
This commit fixes the bug.
2024-04-03 11:12:16 +00:00
Nathan Whitaker
219a27dde5
fix(ext/node): Support returning tokens and option defaults in node:util.parseArgs (#23192)
Fixes #23179.
Fixes #22454.

Enables passing `{tokens: true}` to `parseArgs` and setting default
values for options.

With this PR, the observable framework works with deno out of the box
(no unstable flags needed).

The existing code was basically copied straight from node, so this PR
mostly just updates that (out of date) vendored code. Also fixes some
issues with error exports (before this PR, in certain error cases we
were attempting to construct error classes that weren't actually in
scope).

The last change (in the second commit) adds a small hack so that we
actually exercise the `test-parse-args.js` node_compat test, previously
it was reported as passing though it should have failed. That test now
passes.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-02 16:20:48 -07:00
Alex Yang
8eb2b6c61f
feat: improve AsyncLocalStorage api (#23175)
Fixes: https://github.com/denoland/deno/issues/23174
2024-04-02 22:53:29 +00:00
Asher Gomez
29085895c9
chore: move tools/node_compat to tests/node_compat/runner (#23025)
The `tools/node_compat/node` submodule has been moved to
`tests/node_compat/runner/suite` and the remaining files within
`tools/node_compat` to `tests/node_compat/runner`.

Most of the changes are of the header within `tests/node_compat/test`
files. The `setup` and `test` tasks within `tests/node_comapt` execute
successfully.

Towards #22525
CC @mmastrac
2024-04-03 09:24:55 +11:00
Satya Rohith
4d66ec91c1
fix(ext/node): MessagePort works (#22999)
Closes https://github.com/denoland/deno/issues/22951
Closes https://github.com/denoland/deno/issues/23001

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-02 17:06:09 +05:30
Nathan Whitaker
7ad76fd453
fix(ext/node): Add fs.readv, fs.readvSync (#23166)
Part of #18218.

Implements `fs.readv` and `fs.readvSync` and enables the corresponding
`node_compat` tests.
2024-04-01 20:42:49 -07:00
Divy Srivastava
bca0fe1cde
fix(ext/node): support stdin: "inherit" in node:child_process (#23110)
Fixes https://github.com/denoland/deno/issues/23051
2024-03-28 19:44:42 +05:30
Divy Srivastava
de0b230078
fix(ext/node): use tty stdin from ext/io (#23044)
Fixes https://github.com/denoland/deno/issues/23043
2024-03-28 04:25:05 +01:00
Divy Srivastava
ec9342f95a
fix(ext/node): handle null in stdio array (#23048)
Fixes https://github.com/denoland/deno/issues/23045
2024-03-24 06:55:53 +01:00
Matt Mastracci
08ec6e5831
perf: warm expensive init code at snapshot time (#22714)
Slightly different approach to similar changes in #22386

Note that this doesn't use a warmup script -- we are actually just doing
more work at snapshot time.
2024-03-22 20:49:07 +00:00
Divy Srivastava
43be97923f
fix(ext/node): handle KeyObject in prepareAsymmetricKey (#23026)
Fixes https://github.com/denoland/deno/issues/20938
2024-03-22 19:28:28 +05:30
Divy Srivastava
22eec2b3cf
fix(ext/node): add crypto.subtle (#23027)
Alias for `crypto.webcrypto.subtle`.
https://nodejs.org/api/crypto.html#cryptosubtle
2024-03-22 18:56:36 +05:30
Divy Srivastava
eb9d473974
fix(ext/node): add crypto.getRandomValues (#23028)
Alias for `crypto.webcrypto.getRandomValues`
2024-03-22 18:56:20 +05:30
Eric Long
976fa489fb
feat(ext/node): add riscv64 in process.arch (#23016)
Rust triple for riscv64 is riscv64gc. Although there are no official
builds for architectures other than x86_64 and aarch64, Arch Linux
RISC-V has managed to package Deno on riscv64:
https://github.com/felixonmars/archriscv-packages/blob/master/deno/riscv64.patch

Ref: https://github.com/denoland/deno/issues/18702
2024-03-21 19:06:42 +05:30
Divy Srivastava
1f60b8af97
fix(ext/node): ECDH.publicKey() point encoding (#23013) 2024-03-21 14:11:54 +05:30
Satya Rohith
fb0744f4e1
fix(ext/node): spread args in setImmediate (#22998)
Closes https://github.com/denoland/deno/issues/22997

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-20 07:52:50 +00:00
Divy Srivastava
724cdcec7b
fix(ext/node): implement EventEmitterAsyncResource (#22994)
Fixes #22729
2024-03-20 11:20:18 +05:30
Divy Srivastava
5b2f689f08
fix(ext/node): FsWatcher ref and unref (#22987)
Fixes https://github.com/denoland/deno/issues/22973

---------

Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-03-20 11:19:53 +05:30
Satya Rohith
737adbe1b0
fix(ext/node): add process.setSourceMapsEnabled noop (#22993)
Closes https://github.com/denoland/deno/issues/22992
2024-03-20 05:26:41 +00:00
mash-graz
0d43a63636
fix(ext/node): worker_threads ESM handling (#22841)
Fixes #22840
Fixes #22964
2024-03-20 09:12:22 +05:30
Divy Srivastava
bd6938ac70
fix(node): implement v8 serialize and deserialize (#22975)
Fixes https://github.com/denoland/deno/issues/22971
2024-03-18 13:48:55 +05:30
Satya Rohith
becdad531f
fix(ext/node): support public key point encoding in ECDH.generateKeys() (#22976)
Towards https://github.com/denoland/deno/issues/22921

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-18 13:20:10 +05:30
Divy Srivastava
9c5ddf7c69
fix(ext/node): pass normalized watchFile handler to StatWatcher (#22940)
Fixes https://github.com/denoland/deno/issues/22939
2024-03-16 09:44:47 +05:30
Nathan Whitaker
ebbc897b69
fix(ext/node): Reimplement StringDecoder to match node's behavior (#22933)
Fixes #22158.

Basically reimplements the whole `StringDecoder` with a much more direct
translation (read like one-to-one) of node's current logic. The old
implementation was closer to node's super old impl and it was too hard
to keep the code structure while matching the behavior of their new
logic.

This adds support for UTF-16LE, ascii, and latin1. 

This also enables the node_compat test, which now passes without
modification.
2024-03-15 17:24:13 -07:00
Divy Srivastava
9c348a0acd
fix(ext/node): support spki format in createPublicKey (#22918) 2024-03-14 14:39:46 +01:00
Divy Srivastava
cf3c6f9b08
fix(ext/node): crypto.getCipherInfo() (#22916)
Stub implementation of getCipherInfo(). Good enough for most cases.

Note: We do not support all OpenSSL ciphers (likely never will)

Fixes https://github.com/denoland/deno/issues/21805
2024-03-14 19:00:29 +05:30
David Sherret
bc782cee98
fix(node): resolve types via package.json for directory import (#22878)
Does a package resolve when resolving types for a directory (copying the
behaviour that typescript does).
2024-03-13 22:37:56 -04:00
Satya Rohith
bbc211906d
fix(ext/node): make worker ids sequential (#22884) 2024-03-13 19:52:53 +00:00
Satya Rohith
0fd8f549e2
fix(ext/node): allow automatic worker_thread termination (#22647)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-03-13 17:22:25 +00:00
Nayeem Rahman
f377fce640
feat(node): implement fs.statfs() (#22862) 2024-03-13 10:57:59 +00:00
Asher Gomez
5cfa03ceca
fix(ext/node): initial crypto.createPublicKey() support (#22509)
Closes #21807

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-13 08:17:23 +00:00
Divy Srivastava
4a88695563
fix(ext/node): flush brotli decompression stream (#22856)
Fixes https://github.com/denoland/deno/issues/22259

The decompressed input size was not restored because of improper
flushing of the CBrotliDecompressStream state.
2024-03-12 17:23:31 +05:30
Nathan Whitaker
a77b2987bc
fix(ext/node): Match punycode module behavior to node (#22847)
Fixes #19214.

We were using the `idna` crate to implement our polyfill for
`punycode.toASCII` and `punycode.toUnicode`. The `idna` crate is
correct, and adheres to the IDNA2003/2008 spec, but it turns out
`node`'s implementations don't really follow any spec! Instead, node
splits the domain by `'.'` and punycode encodes/decodes each part. This
means that node's implementations will happily work on codepoints that
are disallowed by the IDNA specs, causing the error in #19214.

While fixing this, I went ahead and matched the node behavior on all of
the punycode functions and enabled node's punycode test in our
`node_compat` suite.
2024-03-11 15:49:43 -07:00
Bartek Iwańczuk
d69aab62b0
fix(ext/node): make worker setup synchronous (#22815)
This commit fixes race condition in "node:worker_threads" module were
the first message did a setup of "threadId", "workerData" and
"environmentData".
Now this data is passed explicitly during workers creation and is set up
before any user code is executed.

Closes https://github.com/denoland/deno/issues/22783
Closes https://github.com/denoland/deno/issues/22672

---------

Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-03-11 23:18:03 +01:00
Bartek Iwańczuk
bb6e4c7414
fix(ext/node): worker_threads.parentPort is updated on startup (#20794)
This addresses
https://github.com/denoland/deno/issues/20613#issuecomment-1739962483.
2024-03-11 08:21:06 +05:30
mash-graz
80dbcd3ddf
fix(ext/node) implement receiveMessageOnPort for node:worker_threads (#22766)
Implementation of `receiveMessageOnPort` for `node:worker_threads`

Fixes: #22702
2024-03-11 00:23:06 +01:00
mash-graz
16dbbfa64a
fix(node:http) Export validateHeaderName and validateHeaderValue functions (#22616)
Modify `_http_outgoing.ts` to support the extended signature of
`validateHeaderName()` used since node v19.5.0/v18.14.0 by adding the
`label` parameter. (see:
https://nodejs.org/api/http.html#httpvalidateheadernamename-label)

Making both validation functions accessible as public exports of
`node:http`

Fixes: #22614
2024-03-10 22:46:05 +00:00
Divy Srivastava
0bed4d3e51
fix(ext/node): support junction symlinks on Windows (#22762)
Fixes https://github.com/denoland/deno/issues/20609

Vitepress support! `vitepress dev` and `vitepress build` via BYONM
2024-03-09 09:07:29 +05:30
Nathan Whitaker
26cee4eb0d
fix(ext/node): Implement isBuiltin in node:module (#22817)
Fixes #22502

Implements the
[`isBuiltin`](https://nodejs.org/api/module.html#moduleisbuiltinmodulename)
function in `node:module`. I had to update the version of `@types/node`
in the test registry in order to get the test I added to typecheck.
2024-03-08 18:06:04 -08:00
Nathan Whitaker
529f79505d
fix(ext/node): Add Immediate class to mirror NodeJS.Immediate (#22808)
Fixes #21660

Adds a basic `Immediate` class to mirror `NodeJS.Immediate`, and changes
`setImmediate` and `clearImmediate` to return and accept (respectively)
`Immediate` objects.

Note that for now {ref,unref,hasRef} are effectively stubs, as deno_core
doesn't really natively support immediates (they're currently modeled as
timers with delay of 0). Eventually we probably want to actually
implement these properly.
2024-03-08 15:58:43 -08:00
Bartek Iwańczuk
93b9d114a4
refactor(ext/node): worker_threads.isMainThread setup (#22785)
This commit changes how we figure out if we're running on main
thread in `node:worker_threads` module. Instead of relying on quirky
"magic variable" for a name to check if we're on main thread, we are
now explicitly passing this information during bootstrapping of the
runtime. As a side effect, `WorkerOptions.name` is more useful
and matches what Node.js does more closely (though not fully).

Towards https://github.com/denoland/deno/issues/22783
2024-03-08 17:31:11 +01:00
Satya Rohith
d5b01e4158
refactor(ext/node): use worker ops directly in worker_threads (#22794) 2024-03-08 14:45:55 +00:00
Matt Mastracci
3745556ccd
feat(ext/node): ref/unref on workers (#22778)
Implements ref/unref on worker to fix part of #22629
2024-03-07 18:51:19 -07:00
Satya Rohith
588dd5e669
fix(ext/node): http2.createServer (#22708) 2024-03-07 19:28:46 +05:30
Leo Kettmeir
0fb67ce43e
feat(node/util): styleText (#22758)
Implements https://github.com/nodejs/node/pull/51850
2024-03-07 00:45:28 +01:00
Nathan Whitaker
9df917c0be
chore: upgrade deno_core (#22725)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/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.
-->
2024-03-06 15:08:10 -08:00
Divy Srivastava
39d9281bb9
fix(ext/node): add default methods to fs.StatsBase (#22750) 2024-03-06 23:01:20 +01:00