summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal
AgeCommit message (Collapse)Author
2023-06-27chore(ext/node): disable prefer-primordials on a per-file basis (#19553)Kenta Moriuchi
2023-06-27test(ext/node): port crypto_test.ts from deno_std (#19561)Felipe Baltor
2023-06-26chore: fix typos (#19572)Martin Fischer
2023-06-23fix(serde_v8): Do not coerce values in serde_v8 (#19569)Divy Srivastava
Fixes #19568 Values are not coerced to the desired type during deserialisation. This makes serde_v8 stricter. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
2023-06-13fix(node/buffer): make slice be the same as subarray (#19481)Leo Kettmeir
2023-06-08feat(node_compat): Add a write method to the FileHandle class (#19385)nasa
## WHY ref: https://github.com/denoland/deno/issues/19165 The FileHandle class has many missing methods compared to node. ## WHAT Add write method
2023-06-08feat(node_compat): Add a read method to the FileHandle class (#19359)nasa
ref: #19165 The FileHandle class has many missing methods compared to node.
2023-06-06refactor(core): ensureFastOps is an op-generating proxy (#19377)Matt Mastracci
Startup benchmark shows no changes (within 1ms, identical system/user times).
2023-06-05feat(node_compat): Add a close method to the FileHandle class. (#19357)nasa
## WHY ref: https://github.com/denoland/deno/issues/19165 The FileHandle class has many missing methods compared to node. Add these. ## WHAT - Add close method --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-06-05feat: add more options to Deno.inspect (#19337)Leo Kettmeir
For https://github.com/denoland/deno_std/issues/3404 --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-06-02fix(node): map stdio [0, 1, 2] to "inherit" (#19352)Marvin Hagemeister
<!-- 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. --> Internally, `node-tap` spawns a child process with `stdio: [0, 1, 2]`. Whilst we don't support passing fd numbers as an argument so far, it turns out that `[0, 1, 2]` is equivalent to `"inherit"` which we already support. See: https://nodejs.org/api/child_process.html#optionsstdio Mapping it to `"inherit"` is fine for us and gets us one step closer in getting `node-tap` working. I'm now at the stage where already the coverage table is shown 🎉
2023-06-02feat(node_compat): Added base implementation of FileHandle (#19294)nasa
<!-- 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. --> ## WHY ref: https://github.com/denoland/deno/issues/19165 Node's fs/promises includes a FileHandle class, but deno does not. The open function in Node's fs/promises returns a FileHandle, which provides an IO interface to the file. However, deno's open function returns a resource id. ### deno ```js > const fs = await import("node:fs/promises"); undefined > const file3 = await fs.open("./README.md"); undefined > file3 3 > file3.read undefined Node: ``` ### Node ```js > const fs = await import("fs/promises"); undefined > const file3 = await fs.open("./tests/e2e_unit/testdata/file.txt"); undefined > file3 FileHandle { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, close: [Function: close], [Symbol(kCapture)]: false, [Symbol(kHandle)]: FileHandle {}, [Symbol(kFd)]: 24, [Symbol(kRefs)]: 1, [Symbol(kClosePromise)]: null } > file3.read [Function: read] ``` To be compatible with Node, deno's open function should also return a FileHandle. ## WHAT I have implemented the first step in adding a FileHandle. - Changed the return value of the open function to a FileHandle object - Implemented the readFile method in FileHandle - Add test code ## What to do next This PR is the first step in adding a FileHandle, and there are things that should be done next. - Add functionality equivalent to Node's FileHandle to FileHandle (currently there is only readFile) --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-05-31chore(ext/node): Implement stubs for Http2Session (#19329)Matt Mastracci
Fleshes out all the stubs for `node:http2`.
2023-05-18fix(npm): `process` not defined in readline (#19184)Marvin Hagemeister
Issue was that we create node globals much later, so pulling `process` via a module import is the way to go. Fixes #19183
2023-05-18fix(node): support passing parent stdio streams (#19171)Marvin Hagemeister
This is a bit bare bones but gets `npm-run-all` working. For full stdio compatibility with node more work is needed which is probably better done in follow up PRs. Fixes #19159
2023-05-16feat(node/crypto): Builtin Diffie-Hellman Groups (#19137)Levente Kurusa
Towards #18455
2023-05-15feat(node/crypto): Diffie Hellman Support (#18943)Levente Kurusa
Support crypto.DiffieHellman class in ext/node/crypto
2023-05-10chore(node/stream): unbundle/unminify readable-streams (#19045)Levente Kurusa
2023-05-02refactor(core): Use `ObjectHasOwn` instead of ↔Kenta Moriuchi
`ObjectPrototypeHasOwnProperty` (#18952) ES2022 `Object.hasOwn` can be used in snapshot, so I migrate to use it.
2023-05-01refactor: migrate async ops to generated wrappers (#18937)Bartek IwaƄczuk
Migrates some of existing async ops to generated wrappers introduced in https://github.com/denoland/deno/pull/18887. As a result "core.opAsync2" was removed. I will follow up with more PRs that migrate all the async ops to generated wrappers.
2023-04-30refactor: remove ext/console/01_colors.js (#18927)Leo Kettmeir
2023-04-30refactor: merge Deno & Node inspectors (#18691)Leo Kettmeir
2023-04-27feat(node/crypto): Elliptic Curve Diffie-Hellman (ECDH) support (#18832)Levente Kurusa
- ECDH class - crypto.createECDH() - Supported curves: - secp256k1 - prime256v1 / secp256r1 - secp384r1 - secp224r1 Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
2023-04-27fix(ext/node): prime generation (#18861)Divy Srivastava
Towards https://github.com/denoland/deno/issues/18455 `safe`, `add` and `rem` options are not implemented because there is no rust crate that provides this functionality (except rust-openssl maybe) and its just not clear if this API is used widely.
2023-04-25fix(ext/node): fix hash.flush (#18818)Yoshiya Hinosawa
2023-04-19fix(ext/node): implement asymmetric keygen (#18651)Divy Srivastava
Towards #18455 This commit implements the keypair generation for asymmetric keys for the `generateKeyPair` API. See how key material is managed in this implementation: https://www.notion.so/denolandinc/node-crypto-design-99fc33f568d24e47a5e4b36002c5325d?pvs=4 Private and public key encoding depend on `KeyObject#export` which is not implemented. I've also skipped ED448 and X448 since we need a crate for that in WebCrypto too.
2023-04-19fix(ext/node): add crypto.sign|verify methods (#18765)Yoshiya Hinosawa
2023-04-18refactor(node/crypto): scrypt polyfill to rust (#18746)Levente Kurusa
2023-04-18fix(ext/node): implement crypto.createVerify (#18703)Yoshiya Hinosawa
2023-04-12refactor(node/crypto): port polyfill to Rust for randomInt, randomFill, ↔Levente Kurusa
randomFillSync (#18658) Pretty much as per the title, I'd welcome some feedback especially around the array/buffer handling in the two randomFill functions.
2023-04-07fix(ext/node): add X509Certificate (#18625)Divy Srivastava
Towards #18455
2023-04-06fix(ext/node): implement hkdf-expand (#18612)Divy Srivastava
Towards https://github.com/denoland/deno/issues/18455
2023-04-06fix(ext/node): add symmetric keygen (#18609)Divy Srivastava
Towards #18455
2023-03-31perf(ext/websocket): use opAsync2 to avoid spread deopt (#18525)Divy Srivastava
This commit adds a new core API `opAsync2` to call an async op with atmost 2 arguments. Spread argument iterators has a pretty big perf hit when calling ops. | name | avg msg/sec/core | | --- | --- | | 1.32.1 | `127820.750000` | | #18506 | `140079.000000` | | #18506 + #18509 | `150104.250000` | | #18506 + #18509 + this | `157340.000000` |
2023-03-30Revert "refactor(ext/node): Use Deno.inspect (#17960)" (#18491)Bartek IwaƄczuk
This reverts commit a3529d02329e0d2127ad2a5bb78b4c476ddd6984. This change made debugging Node tests very hard - `AssertionError` is now printed as `[Circular *1]` giving no visibility what failed. We need to align two implementations together and remove this one then.
2023-03-28fix(ext/node): implement crypto.Sign (RSA/PEM/SHA{224,256,384,512}) (#18471)Yoshiya Hinosawa
2023-03-28feat(ext/node): add `crypto.checkPrime` API (#18465)Divy Srivastava
Towards #18455 This commit implements `checkPrimeSync` and `checkPrime` in node:crypto using the Miller-Rabin primality test (fun fact: it actually is a test for composite numbers) It first compares the candidate against many known small primes and if not, proceeds to run the Miller-Rabin primality test. http://nickle.org/examples/miller-rabin.5c used as reference implementation.
2023-03-28chore(ext/node): port pbkdf2 to Rust (#18470)Divy Srivastava
Towards #18455
2023-03-25fix(ext/node): add aes-128-ecb algorithm support (#18412)Yoshiya Hinosawa
2023-03-24feat(ext/node): implement crypto.createSecretKey (#18413)Divy Srivastava
This commit adds the `crypto.createSecretKey` API. Key management: This follows the same approach as our WebCrypto CryptoKey impl where we use WeakMap for storing key material and a handle is passed around, such that (only internal) JS can access the key material and we don't have to explicitly close a Rust resource. As a result, `createHmac` now accepts a secret KeyObject. Closes https://github.com/denoland/deno/issues/17844
2023-03-24fix(ext/node): make cipher/decipher transform stream (#18408)Yoshiya Hinosawa
2023-03-23fix(core): panic at build time if extension code contains anything other ↔Matt Mastracci
than 7-bit ASCII (#18372) This will improve diagnostics and catch any non-ASCII extension code early. This will use `debug_assert!` rather than `assert!` to avoid runtime costs, and ensures (in debug_assert mode only) that all extension source files are ASCII as we load them.
2023-03-23refactor(ext/node): Use Deno.inspect (#17960)Ryan Dahl
No need for two almost identical implementations of the same thing --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com> Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-03-22chore: update ext/ code to only use ASCII (#18371)Matt Mastracci
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
2023-03-18Reland "perf(core): preserve ops between snapshots (#18080)" (#18272)Bartek IwaƄczuk
Relanding 4b6305f4f25fc76f974bbdcc9cdb139d5ab8f5f4
2023-03-18Revert "perf(core): preserve ops between snapshots (#18080)" (#18267)Bartek IwaƄczuk
This reverts commit 4b6305f4f25fc76f974bbdcc9cdb139d5ab8f5f4.
2023-03-18fix(ext/node): add createDecipheriv (#18245)Yoshiya Hinosawa
2023-03-18perf(core): preserve ops between snapshots (#18080)Bartek IwaƄczuk
This commit changes the build process in a way that preserves already registered ops in the snapshot. This allows us to skip creating hundreds of "v8::String" on each startup, but sadly there is still some op registration going on startup (however we're registering 49 ops instead of >200 ops). This situation could be further improved, by moving some of the ops from "runtime/" to a separate extension crates. --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-03-16fix(ext/node): resource leak in createHmac (#18229)Divy Srivastava
This commit fixes https://github.com/denoland/deno/issues/18140. Verified that test fails on `main`.
2023-03-14fix(ext/node): add crypto.createCipheriv (#18091)Yoshiya Hinosawa