bun-types 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types.d.ts +92 -9
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for bun 1.0.
|
|
1
|
+
// Type definitions for bun 1.0.21
|
|
2
2
|
// Project: https://github.com/oven-sh/bun
|
|
3
3
|
// Definitions by: Jarred Sumner <https://github.com/Jarred-Sumner>
|
|
4
4
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
@@ -2985,6 +2985,11 @@ declare var AbortSignal: typeof globalThis extends {
|
|
|
2985
2985
|
declare namespace Bun {
|
|
2986
2986
|
type ArrayBufferView = TypedArray | DataView;
|
|
2987
2987
|
type StringOrBuffer = string | NodeJS.TypedArray | ArrayBufferLike;
|
|
2988
|
+
type BlobOrStringOrBuffer =
|
|
2989
|
+
| string
|
|
2990
|
+
| NodeJS.TypedArray
|
|
2991
|
+
| ArrayBufferLike
|
|
2992
|
+
| Blob;
|
|
2988
2993
|
type PathLike = string | NodeJS.TypedArray | ArrayBufferLike | URL;
|
|
2989
2994
|
}
|
|
2990
2995
|
|
|
@@ -4873,6 +4878,45 @@ declare module "bun:sqlite" {
|
|
|
4873
4878
|
| Record<string, string | bigint | TypedArray | number | boolean | null>;
|
|
4874
4879
|
|
|
4875
4880
|
export default Database;
|
|
4881
|
+
|
|
4882
|
+
/**
|
|
4883
|
+
* Errors from SQLite have a name `SQLiteError`.
|
|
4884
|
+
*
|
|
4885
|
+
* This class does not exist! It is not a class. It is just a type.
|
|
4886
|
+
*
|
|
4887
|
+
* To check if an `Error` is an SQLiteError, use `error.name === "SQLiteError"`
|
|
4888
|
+
*/
|
|
4889
|
+
export interface SQLiteError extends Error {
|
|
4890
|
+
readonly name: "SQLiteError";
|
|
4891
|
+
|
|
4892
|
+
/**
|
|
4893
|
+
* The SQLite3 extended error code
|
|
4894
|
+
*
|
|
4895
|
+
* This corresponds to `sqlite3_extended_errcode`.
|
|
4896
|
+
*
|
|
4897
|
+
* @since v1.0.21
|
|
4898
|
+
*/
|
|
4899
|
+
errno: number;
|
|
4900
|
+
|
|
4901
|
+
/**
|
|
4902
|
+
* The name of the SQLite3 error code
|
|
4903
|
+
*
|
|
4904
|
+
* @example
|
|
4905
|
+
* "SQLITE_CONSTRAINT_UNIQUE"
|
|
4906
|
+
*
|
|
4907
|
+
* @since v1.0.21
|
|
4908
|
+
*/
|
|
4909
|
+
code?: string;
|
|
4910
|
+
|
|
4911
|
+
/**
|
|
4912
|
+
* The UTF-8 byte offset of the sqlite3 query that failed, if known
|
|
4913
|
+
*
|
|
4914
|
+
* This corresponds to `sqlite3_error_offset`.
|
|
4915
|
+
*
|
|
4916
|
+
* @since v1.0.21
|
|
4917
|
+
*/
|
|
4918
|
+
readonly byteOffset: number;
|
|
4919
|
+
}
|
|
4876
4920
|
}
|
|
4877
4921
|
|
|
4878
4922
|
|
|
@@ -4896,6 +4940,7 @@ declare module "bun:sqlite" {
|
|
|
4896
4940
|
declare module "bun" {
|
|
4897
4941
|
type ArrayBufferView = Bun.ArrayBufferView;
|
|
4898
4942
|
type StringOrBuffer = Bun.StringOrBuffer;
|
|
4943
|
+
type BlobOrStringOrBuffer = Bun.BlobOrStringOrBuffer;
|
|
4899
4944
|
type PathLike = Bun.PathLike;
|
|
4900
4945
|
import { Encoding as CryptoEncoding } from "crypto";
|
|
4901
4946
|
interface Env {
|
|
@@ -7637,7 +7682,7 @@ declare module "bun" {
|
|
|
7637
7682
|
*
|
|
7638
7683
|
* @param data
|
|
7639
7684
|
*/
|
|
7640
|
-
update(data:
|
|
7685
|
+
update(data: BlobOrStringOrBuffer): T;
|
|
7641
7686
|
|
|
7642
7687
|
/**
|
|
7643
7688
|
* Finalize the hash
|
|
@@ -7661,7 +7706,7 @@ declare module "bun" {
|
|
|
7661
7706
|
* @param hashInto `TypedArray` to write the hash into. Faster than creating a new one each time
|
|
7662
7707
|
*/
|
|
7663
7708
|
static hash(
|
|
7664
|
-
input:
|
|
7709
|
+
input: BlobOrStringOrBuffer,
|
|
7665
7710
|
hashInto?: NodeJS.TypedArray,
|
|
7666
7711
|
): NodeJS.TypedArray;
|
|
7667
7712
|
|
|
@@ -7672,7 +7717,7 @@ declare module "bun" {
|
|
|
7672
7717
|
*
|
|
7673
7718
|
* @param encoding `DigestEncoding` to return the hash in
|
|
7674
7719
|
*/
|
|
7675
|
-
static hash(input:
|
|
7720
|
+
static hash(input: BlobOrStringOrBuffer, encoding: DigestEncoding): string;
|
|
7676
7721
|
}
|
|
7677
7722
|
|
|
7678
7723
|
type SupportedCryptoAlgorithms =
|
|
@@ -7714,7 +7759,10 @@ declare module "bun" {
|
|
|
7714
7759
|
*
|
|
7715
7760
|
* @param input
|
|
7716
7761
|
*/
|
|
7717
|
-
update(
|
|
7762
|
+
update(
|
|
7763
|
+
input: BlobOrStringOrBuffer,
|
|
7764
|
+
inputEncoding?: CryptoEncoding,
|
|
7765
|
+
): CryptoHasher;
|
|
7718
7766
|
|
|
7719
7767
|
/**
|
|
7720
7768
|
* Perform a deep copy of the hasher
|
|
@@ -7744,7 +7792,7 @@ declare module "bun" {
|
|
|
7744
7792
|
*/
|
|
7745
7793
|
static hash(
|
|
7746
7794
|
algorithm: SupportedCryptoAlgorithms,
|
|
7747
|
-
input:
|
|
7795
|
+
input: BlobOrStringOrBuffer,
|
|
7748
7796
|
hashInto?: NodeJS.TypedArray,
|
|
7749
7797
|
): NodeJS.TypedArray;
|
|
7750
7798
|
|
|
@@ -7757,7 +7805,7 @@ declare module "bun" {
|
|
|
7757
7805
|
*/
|
|
7758
7806
|
static hash(
|
|
7759
7807
|
algorithm: SupportedCryptoAlgorithms,
|
|
7760
|
-
input:
|
|
7808
|
+
input: BlobOrStringOrBuffer,
|
|
7761
7809
|
encoding: DigestEncoding,
|
|
7762
7810
|
): string;
|
|
7763
7811
|
|
|
@@ -9407,7 +9455,9 @@ declare module "bun" {
|
|
|
9407
9455
|
constructor(pattern: string);
|
|
9408
9456
|
|
|
9409
9457
|
/**
|
|
9410
|
-
* Scan for files that match this glob pattern. Returns an async iterator.
|
|
9458
|
+
* Scan a root directory recursively for files that match this glob pattern. Returns an async iterator.
|
|
9459
|
+
*
|
|
9460
|
+
* @throws {ENOTDIR} Given root cwd path must be a directory
|
|
9411
9461
|
*
|
|
9412
9462
|
* @example
|
|
9413
9463
|
* ```js
|
|
@@ -9428,7 +9478,9 @@ declare module "bun" {
|
|
|
9428
9478
|
): AsyncIterableIterator<string>;
|
|
9429
9479
|
|
|
9430
9480
|
/**
|
|
9431
|
-
*
|
|
9481
|
+
* Synchronously scan a root directory recursively for files that match this glob pattern. Returns an iterator.
|
|
9482
|
+
*
|
|
9483
|
+
* @throws {ENOTDIR} Given root cwd path must be a directory
|
|
9432
9484
|
*
|
|
9433
9485
|
* @example
|
|
9434
9486
|
* ```js
|
|
@@ -10638,6 +10690,20 @@ declare module "bun:test" {
|
|
|
10638
10690
|
* @param expected the expected value
|
|
10639
10691
|
*/
|
|
10640
10692
|
toContain(expected: unknown): void;
|
|
10693
|
+
/**
|
|
10694
|
+
* Asserts that an `object` contains a key.
|
|
10695
|
+
*
|
|
10696
|
+
* The value must be an object
|
|
10697
|
+
*
|
|
10698
|
+
* @example
|
|
10699
|
+
* expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKey('a');
|
|
10700
|
+
* expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKey('b');
|
|
10701
|
+
* expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKey('c');
|
|
10702
|
+
* expect({ a: 'foo', b: 'bar', c: 'baz' }).not.toContainKey('d');
|
|
10703
|
+
*
|
|
10704
|
+
* @param expected the expected value
|
|
10705
|
+
*/
|
|
10706
|
+
toContainKey(expected: unknown): void;
|
|
10641
10707
|
/**
|
|
10642
10708
|
* Asserts that a value contains and equals what is expected.
|
|
10643
10709
|
*
|
|
@@ -10828,6 +10894,14 @@ declare module "bun:test" {
|
|
|
10828
10894
|
* @param expected the expected substring or pattern.
|
|
10829
10895
|
*/
|
|
10830
10896
|
toMatch(expected: string | RegExp): void;
|
|
10897
|
+
/**
|
|
10898
|
+
* Asserts that a value matches the most recent snapshot.
|
|
10899
|
+
*
|
|
10900
|
+
* @example
|
|
10901
|
+
* expect([1, 2, 3]).toMatchSnapshot('hint message');
|
|
10902
|
+
* @param hint Hint used to identify the snapshot in the snapshot file.
|
|
10903
|
+
*/
|
|
10904
|
+
toMatchSnapshot(hint?: string): void;
|
|
10831
10905
|
/**
|
|
10832
10906
|
* Asserts that a value matches the most recent snapshot.
|
|
10833
10907
|
*
|
|
@@ -10956,6 +11030,15 @@ declare module "bun:test" {
|
|
|
10956
11030
|
* expect(NaN).not.toBeInteger();
|
|
10957
11031
|
*/
|
|
10958
11032
|
toBeInteger(): void;
|
|
11033
|
+
/**
|
|
11034
|
+
* Asserts that a value is an `object`.
|
|
11035
|
+
*
|
|
11036
|
+
* @example
|
|
11037
|
+
* expect({}).toBeObject();
|
|
11038
|
+
* expect("notAnObject").not.toBeObject();
|
|
11039
|
+
* expect(NaN).not.toBeObject();
|
|
11040
|
+
*/
|
|
11041
|
+
toBeObject(): void;
|
|
10959
11042
|
/**
|
|
10960
11043
|
* Asserts that a value is a `number`, and is not `NaN` or `Infinity`.
|
|
10961
11044
|
*
|