Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions notNeededPackages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5009,6 +5009,10 @@
"libraryName": "openpgp",
"asOfVersion": "5.0.0"
},
"openseadragon": {
"libraryName": "openseadragon",
"asOfVersion": "6.0.0"
},
"opn": {
"libraryName": "opn",
"asOfVersion": "5.5.0"
Expand Down
2 changes: 2 additions & 0 deletions types/jquery.pin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"private": true,
"name": "@types/jquery.pin",
"version": "1.0.9999",
"nonNpm": true,
"nonNpmDescription": "jquery.pin",
"projects": [
"https://github.com/webpop/jquery.pin"
],
Expand Down
108 changes: 108 additions & 0 deletions types/node/async_hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,75 @@ declare module "node:async_hooks" {
* @experimental
*/
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
/**
* Creates a disposable scope that enters the given store and automatically
* restores the previous store value when the scope is disposed. This method is
* designed to work with JavaScript's explicit resource management (`using` syntax).
*
* Example:
*
* ```js
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
* {
* using _ = asyncLocalStorage.withScope('my-store');
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
* }
*
* console.log(asyncLocalStorage.getStore()); // Prints: undefined
* ```
*
* The `withScope()` method is particularly useful for managing context in
* synchronous code where you want to ensure the previous store value is restored
* when exiting a block, even if an error is thrown.
*
* ```js
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
* try {
* using _ = asyncLocalStorage.withScope('my-store');
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
* throw new Error('test');
* } catch (e) {
* // Store is automatically restored even after error
* console.log(asyncLocalStorage.getStore()); // Prints: undefined
* }
* ```
*
* **Important:** When using `withScope()` in async functions before the first
* `await`, be aware that the scope change will affect the caller's context. The
* synchronous portion of an async function (before the first `await`) runs
* immediately when called, and when it reaches the first `await`, it returns the
* promise to the caller. At that point, the scope change becomes visible in the
* caller's context and will persist in subsequent synchronous code until something
* else changes the scope value. For async operations, prefer using `run()` which
* properly isolates context across async boundaries.
*
* ```js
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
* async function example() {
* using _ = asyncLocalStorage.withScope('my-store');
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
* await someAsyncOperation(); // Function pauses here and returns promise
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
* }
*
* // Calling without await
* example(); // Synchronous portion runs, then pauses at first await
* // After the promise is returned, the scope 'my-store' is now active in caller!
* console.log(asyncLocalStorage.getStore()); // Prints: my-store (unexpected!)
* ```
* @since v25.9.0
* @experimental
*/
withScope(store: T): RunScope;
/**
* Transitions into the context for the remainder of the current
* synchronous execution and then persists the store through any following
Expand Down Expand Up @@ -533,6 +602,45 @@ declare module "node:async_hooks" {
*/
enterWith(store: T): void;
}
/**
* A disposable scope returned by `asyncLocalStorage.withScope()` that
* automatically restores the previous store value when disposed. This class
* implements the [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management) protocol and is designed to work
* with JavaScript's `using` syntax.
*
* The scope automatically restores the previous store value when the `using` block
* exits, whether through normal completion or by throwing an error.
* @since v25.9.0
* @experimental
*/
interface RunScope extends Disposable {
/**
* Explicitly ends the scope and restores the previous store value. This method
* is idempotent: calling it multiple times has the same effect as calling it once.
*
* The `[Symbol.dispose]()` method defers to `dispose()`.
*
* If `withScope()` is called without the `using` keyword, `dispose()` must be
* called manually to restore the previous store value. Forgetting to call
* `dispose()` will cause the store value to persist for the remainder of the
* current execution context:
*
* ```js
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const storage = new AsyncLocalStorage();
*
* // Without using, the scope must be disposed manually
* const scope = storage.withScope('my-store');
* // storage.getStore() === 'my-store' here
*
* scope.dispose(); // Restore previous value
* // storage.getStore() === undefined here
* ```
* @since v25.9.0
*/
dispose(): void;
}
/**
* @since v17.2.0, v16.14.0
* @return A map of provider types to the corresponding numeric id.
Expand Down
17 changes: 14 additions & 3 deletions types/node/crypto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3778,7 +3778,7 @@ declare module "node:crypto" {
interface CShakeParams extends Algorithm {
customization?: NodeJS.BufferSource;
functionName?: NodeJS.BufferSource;
length: number;
outputLength: number;
}
interface ContextParams extends Algorithm {
context?: NodeJS.BufferSource;
Expand Down Expand Up @@ -3815,6 +3815,10 @@ declare module "node:crypto" {
hash: HashAlgorithmIdentifier;
length?: number;
}
interface KangarooTwelveParams {
customization?: NodeJS.BufferSource;
outputLength: number;
}
interface JsonWebKey {
alg?: string;
crv?: string;
Expand Down Expand Up @@ -3849,7 +3853,7 @@ declare module "node:crypto" {
}
interface KmacParams extends Algorithm {
customization?: NodeJS.BufferSource;
length: number;
outputLength: number;
}
interface Pbkdf2Params extends Algorithm {
hash: HashAlgorithmIdentifier;
Expand Down Expand Up @@ -3884,6 +3888,10 @@ declare module "node:crypto" {
interface RsaPssParams extends Algorithm {
saltLength: number;
}
interface TurboShakeParams {
domainSeparation?: number;
outputLength: number;
}
interface Crypto {
readonly subtle: SubtleCrypto;
getRandomValues<
Expand Down Expand Up @@ -3945,7 +3953,10 @@ declare module "node:crypto" {
extractable: boolean,
keyUsages: readonly KeyUsage[],
): Promise<CryptoKey>;
digest(algorithm: AlgorithmIdentifier | CShakeParams, data: NodeJS.BufferSource): Promise<ArrayBuffer>;
digest(
algorithm: AlgorithmIdentifier | CShakeParams | TurboShakeParams | KangarooTwelveParams,
data: NodeJS.BufferSource,
): Promise<ArrayBuffer>;
encapsulateBits(
encapsulationAlgorithm: AlgorithmIdentifier,
encapsulationKey: CryptoKey,
Expand Down
6 changes: 4 additions & 2 deletions types/node/fs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ declare module "node:fs" {
"ready": [];
}
/**
* Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
* Instances of `fs.ReadStream` cannot be constructed directly. They are created and
* returned using the `fs.createReadStream()` function.
* @since v0.1.93
*/
class ReadStream extends stream.Readable {
Expand Down Expand Up @@ -643,7 +644,8 @@ declare module "node:fs" {
"ready": [];
}
/**
* Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
* Instances of `fs.WriteStream` cannot be constructed directly. They are created and
* returned using the `fs.createWriteStream()` function.
* @since v0.1.93
*/
class WriteStream extends stream.Writable {
Expand Down
126 changes: 126 additions & 0 deletions types/node/fs/promises.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ declare module "node:fs/promises" {
WriteVResult,
} from "node:fs";
import { Stream } from "node:stream";
import { ByteReadableStream, Transform, Writer } from "node:stream/iter";
import { ReadableStream } from "node:stream/web";
interface FileChangeInfo<T extends string | Buffer> {
eventType: WatchEventType;
Expand Down Expand Up @@ -85,6 +86,57 @@ declare module "node:fs/promises" {
interface ReadableWebStreamOptions {
autoClose?: boolean | undefined;
}
interface PullOptions extends Abortable {
/**
* Close the file handle when the stream ends.
* @default false
*/
autoClose?: boolean | undefined;
/**
* Byte offset to begin reading from. When specified,
* reads use explicit positioning (`pread` semantics).
*/
start?: number | undefined;
/**
* Maximum number of bytes to read before ending the
* iterator. Reads stop when `limit` bytes have been delivered or EOF is
* reached, whichever comes first.
*/
limit?: number | undefined;
/**
* Size in bytes of the buffer allocated for each
* read operation.
* @default 131072
*/
chunkSize?: number | undefined;
}
interface WriterOptions {
/**
* Close the file handle when the writer ends or fails.
* @default false
*/
autoClose?: boolean | undefined;
/**
* Byte offset to start writing at. When specified,
* writes use explicit positioning.
*/
start?: number | undefined;
/**
* Maximum number of bytes the writer will accept.
* Async writes (`write()`, `writev()`) that would exceed the limit reject
* with `ERR_OUT_OF_RANGE`. Sync writes (`writeSync()`, `writevSync()`)
* return `false`.
*/
limit?: number | undefined;
/**
* Maximum chunk size in bytes for synchronous write
* operations. Writes larger than this threshold fall back to async I/O.
* Set this to match the reader's `chunkSize` for optimal `pipeTo()`
* performance.
* @default 131072
*/
chunkSize?: number | undefined;
}
// TODO: Add `EventEmitter` close
interface FileHandle {
/**
Expand Down Expand Up @@ -202,6 +254,41 @@ declare module "node:fs/promises" {
* @return Fulfills with `undefined` upon success.
*/
datasync(): Promise<void>;
/**
* Return the file contents as an async iterable using the
* [`node:stream/iter`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html) pull model. Reads are performed in `chunkSize`-byte
* chunks (default 128 KB). If transforms are provided, they are applied
* via [`stream/iter pull()`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html#pullsource-transforms-options).
*
* The file handle is locked while the iterable is being consumed and unlocked
* when iteration completes, an error occurs, or the consumer breaks.
*
* This function is only available when the `--experimental-stream-iter` flag is
* enabled.
*
* ```js
* import { open } from 'node:fs/promises';
* import { text } from 'node:stream/iter';
* import { compressGzip } from 'node:zlib/iter';
*
* const fh = await open('input.txt', 'r');
*
* // Read as text
* console.log(await text(fh.pull({ autoClose: true })));
*
* // Read 1 KB starting at byte 100
* const fh2 = await open('input.txt', 'r');
* console.log(await text(fh2.pull({ start: 100, limit: 1024, autoClose: true })));
*
* // Read with compression
* const fh3 = await open('input.txt', 'r');
* const compressed = fh3.pull(compressGzip(), { autoClose: true });
* ```
* @since v25.9.0
* @experimental
*/
pull(...transforms: Transform[]): ByteReadableStream;
pull(...args: [...transforms: Transform[], options: PullOptions]): ByteReadableStream;
/**
* Request that all data for the open file descriptor is flushed to the storage
* device. The specific implementation is operating system and device specific.
Expand Down Expand Up @@ -450,6 +537,45 @@ declare module "node:fs/promises" {
buffers: TBuffers,
position?: number,
): Promise<WriteVResult<TBuffers>>;
/**
* Return a [`node:stream/iter`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html) writer backed by this file handle.
*
* The writer supports both `Symbol.asyncDispose` and `Symbol.dispose`:
*
* * `await using w = fh.writer()` — if the writer is still open (no `end()`
* called), `asyncDispose` calls `fail()`. If `end()` is pending, it waits
* for it to complete.
* * `using w = fh.writer()` — calls `fail()` unconditionally.
*
* The `writeSync()` and `writevSync()` methods enable the try-sync fast path
* used by [`stream/iter pipeTo()`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html#pipetosource-transforms-writer). When the reader's chunk size matches the
* writer's `chunkSize`, all writes in a `pipeTo()` pipeline complete
* synchronously with zero promise overhead.
*
* This function is only available when the `--experimental-stream-iter` flag is
* enabled.
*
* ```js
* import { open } from 'node:fs/promises';
* import { from, pipeTo } from 'node:stream/iter';
* import { compressGzip } from 'node:zlib/iter';
*
* // Async pipeline
* const fh = await open('output.gz', 'w');
* await pipeTo(from('Hello!'), compressGzip(), fh.writer({ autoClose: true }));
*
* // Sync pipeline with limit
* const src = await open('input.txt', 'r');
* const dst = await open('output.txt', 'w');
* const w = dst.writer({ limit: 1024 * 1024 }); // Max 1 MB
* await pipeTo(src.pull({ autoClose: true }), w);
* await w.end();
* await dst.close();
* ```
* @since v25.9.0
* @experimental
*/
writer(options?: WriterOptions): Writer;
/**
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
* @since v13.13.0, v12.17.0
Expand Down
2 changes: 2 additions & 0 deletions types/node/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
/// <reference path="sqlite.d.ts" />
/// <reference path="stream.d.ts" />
/// <reference path="stream/consumers.d.ts" />
/// <reference path="stream/iter.d.ts" />
/// <reference path="stream/promises.d.ts" />
/// <reference path="stream/web.d.ts" />
/// <reference path="string_decoder.d.ts" />
Expand All @@ -113,3 +114,4 @@
/// <reference path="wasi.d.ts" />
/// <reference path="worker_threads.d.ts" />
/// <reference path="zlib.d.ts" />
/// <reference path="zlib/iter.d.ts" />
Loading