`fs.mkdtemp` and `fs.mkdtempSync` now accept `Buffer` and `Uint8Array`
path. The implementation has been moved to Rust, including directory
suffix generation and directory creation.
Fixes https://github.com/denoland/deno/issues/20594
This implements `JSStreamSocket` which drives the TLS underlying stream
in `rustls_tokio_stream` using 2 sets of channels. One for piping the
encrypted protocol transport and the other for plaintext application
data.
This fixes connecting to `npm:mssql`:
```js
import sql from "npm:mssql";
const sqlConfig = {
server: "localhost",
user: "divy",
password: "123",
database: "master",
options: {
trustServerCertificate: true,
},
};
const pool = await sql.connect(sqlConfig);
const result = await pool.request().query(`SELECT * FROM sys.databases`);
```
Notable changes:
- Introduces a separate op between `Deno.open` and `node:fs.open`.
- Removes redundant `existenceCheckRequired` and `Deno.lstatSync` calls,
as the op layer already handles that when `options.create_new` is true
and uses synchronous I/O when `O_SYNC` is passed.
- Allows passing custom flags to the op (e.g. `O_SYNC`).
- Addresses `prefer-primordials` lint rule.
- Allows
[parallel/test-fs-open.js](https://github.com/nodejs/node/blob/v23.9.0/test/parallel/test-fs-open.js)
test to pass. There are also several tests that have passed before that
I added to the config.toml.
This commit changes how "performance" global is handled -
instead of having separate "performance" globals for user and npm
code, we now have a single implementation.
This implementation is a de facto Node.js implementation - ie. it
contains additional properties compared to the "Web" implementation.
The two global can be compared using these docs sites:
- Web - https://developer.mozilla.org/en-US/docs/Web/API/Performance
- Node.js https://nodejs.org/api/perf_hooks.html
The benefit of this change is that when you use `performance.now()` in a
tight loop, the actual runtime of the code significantly improves - this
is because the `performance` global doesn't have to be "looked up" and
decided which is to be used, the "Web" or the "Node.js" version.
Ref https://github.com/denoland/deno/issues/28836
This PR replaces the _stream.mjs bundle with a file-by-file port instead. A codemod transpiles Node.js internals to ESM. The codemod performs three tasks: translating CJS to ESM, remapping internal dependencies, and hoisting lazy requires as imports.
The process is fully automated through the `update_node_stream.ts` script, simplifying future internal updates. The script checks out Node.js from a specific tag defined in the `tests/node_compat/runner`.
Additionally, the update enables new tests in our Node test runner and adds features (like compose()) that were missing from the outdated bundle.
## Performance
There is a 140KB+ binary size increase on aarch64-apple-darwin and nop startup time stays the same.
Updates to use rust 1.85. Doesn't move to the 2024 edition, as that's a
fair bit more involved.
A nice side benefit is that the new rustc version seems to lead to a
slight reduction in binary size (at least on mac):
```
FILE SIZE
--------------
+4.3% +102Ki __DATA_CONST,__const
[NEW] +69.3Ki __TEXT,__literals
[NEW] +68.5Ki Rebase Info
+5.0% +39.9Ki __TEXT,__unwind_info
+57% +8.85Ki [__TEXT]
[NEW] +8.59Ki Lazy Binding Info
[NEW] +5.16Ki __TEXT,__stub_helper
[NEW] +3.58Ki Export Info
[NEW] +3.42Ki __DATA,__la_symbol_ptr
-0.1% -726 [12 Others]
-21.4% -3.10Ki [__DATA_CONST]
-95.8% -3.39Ki __DATA_CONST,__got
-20.9% -3.43Ki [__DATA]
-0.5% -4.52Ki Code Signature
-100.0% -11.6Ki [__LINKEDIT]
-1.0% -43.5Ki Symbol Table
-1.6% -44.0Ki __TEXT,__gcc_except_tab
-0.2% -48.1Ki __TEXT,__const
-3.3% -78.6Ki __TEXT,__eh_frame
-0.7% -320Ki __TEXT,__text
-1.5% -334Ki String Table
-0.5% -586Ki TOTAL
```