bun-types-no-globals 1.2.22-canary.20250831T140556 → 1.2.22-canary.20250902T140709
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/lib/bun.d.ts +32 -0
- package/lib/test.d.ts +30 -0
- package/package.json +1 -1
package/lib/bun.d.ts
CHANGED
|
@@ -644,6 +644,38 @@ declare module "bun" {
|
|
|
644
644
|
* ```
|
|
645
645
|
*/
|
|
646
646
|
export function parse(input: string): unknown;
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Convert a JavaScript value into a YAML string. Strings are double quoted if they contain keywords, non-printable or
|
|
650
|
+
* escaped characters, or if a YAML parser would parse them as numbers. Anchors and aliases are inferred from objects, allowing cycles.
|
|
651
|
+
*
|
|
652
|
+
* @category Utilities
|
|
653
|
+
*
|
|
654
|
+
* @param input The JavaScript value to stringify.
|
|
655
|
+
* @param replacer Currently not supported.
|
|
656
|
+
* @param space A number for how many spaces each level of indentation gets, or a string used as indentation. The number is clamped between 0 and 10, and the first 10 characters of the string are used.
|
|
657
|
+
* @returns A string containing the YAML document.
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```ts
|
|
661
|
+
* import { YAML } from "bun";
|
|
662
|
+
*
|
|
663
|
+
* const input = {
|
|
664
|
+
* abc: "def"
|
|
665
|
+
* };
|
|
666
|
+
* console.log(YAML.stringify(input));
|
|
667
|
+
* // # output
|
|
668
|
+
* // abc: def
|
|
669
|
+
*
|
|
670
|
+
* const cycle = {};
|
|
671
|
+
* cycle.obj = cycle;
|
|
672
|
+
* console.log(YAML.stringify(cycle));
|
|
673
|
+
* // # output
|
|
674
|
+
* // &root
|
|
675
|
+
* // obj:
|
|
676
|
+
* // *root
|
|
677
|
+
*/
|
|
678
|
+
export function stringify(input: unknown, replacer?: undefined | null, space?: string | number): string;
|
|
647
679
|
}
|
|
648
680
|
|
|
649
681
|
/**
|
package/lib/test.d.ts
CHANGED
|
@@ -152,11 +152,41 @@ declare module "bun:test" {
|
|
|
152
152
|
type SpiedSetter<T> = JestMock.SpiedSetter<T>;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Create a spy on an object property or method
|
|
157
|
+
*/
|
|
155
158
|
export function spyOn<T extends object, K extends keyof T>(
|
|
156
159
|
obj: T,
|
|
157
160
|
methodOrPropertyValue: K,
|
|
158
161
|
): Mock<Extract<T[K], (...args: any[]) => any>>;
|
|
159
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Vitest-compatible mocking utilities
|
|
165
|
+
* Provides Vitest-style mocking API for easier migration from Vitest to Bun
|
|
166
|
+
*/
|
|
167
|
+
export const vi: {
|
|
168
|
+
/**
|
|
169
|
+
* Create a mock function
|
|
170
|
+
*/
|
|
171
|
+
fn: typeof jest.fn;
|
|
172
|
+
/**
|
|
173
|
+
* Create a spy on an object property or method
|
|
174
|
+
*/
|
|
175
|
+
spyOn: typeof spyOn;
|
|
176
|
+
/**
|
|
177
|
+
* Mock a module
|
|
178
|
+
*/
|
|
179
|
+
module: typeof mock.module;
|
|
180
|
+
/**
|
|
181
|
+
* Restore all mocks to their original implementation
|
|
182
|
+
*/
|
|
183
|
+
restoreAllMocks: typeof jest.restoreAllMocks;
|
|
184
|
+
/**
|
|
185
|
+
* Clear all mock state (calls, results, etc.) without restoring original implementation
|
|
186
|
+
*/
|
|
187
|
+
clearAllMocks: typeof jest.clearAllMocks;
|
|
188
|
+
};
|
|
189
|
+
|
|
160
190
|
interface FunctionLike {
|
|
161
191
|
readonly name: string;
|
|
162
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bun-types-no-globals",
|
|
3
|
-
"version": "1.2.22-canary.
|
|
3
|
+
"version": "1.2.22-canary.20250902T140709",
|
|
4
4
|
"main": "./generator/index.ts",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"description": "TypeScript type definitions for Bun without global types pollution",
|