bun-types 1.0.36 → 1.1.0
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/bun.d.ts +6 -2
- package/globals.d.ts +9 -27
- package/package.json +1 -1
- package/test.d.ts +20 -1
package/bun.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ declare module "bun" {
|
|
|
43
43
|
*
|
|
44
44
|
* @param {string} command The name of the executable or script
|
|
45
45
|
* @param {string} options.PATH Overrides the PATH environment variable
|
|
46
|
-
* @param {string} options.cwd
|
|
46
|
+
* @param {string} options.cwd When given a relative path, use this path to join it.
|
|
47
47
|
*/
|
|
48
48
|
function which(
|
|
49
49
|
command: string,
|
|
@@ -280,12 +280,16 @@ declare module "bun" {
|
|
|
280
280
|
blob(): Promise<Blob>;
|
|
281
281
|
|
|
282
282
|
/**
|
|
283
|
-
* Configure the shell to not throw an exception on non-zero exit codes.
|
|
283
|
+
* Configure the shell to not throw an exception on non-zero exit codes. Throwing can be re-enabled with `.throws(true)`.
|
|
284
|
+
*
|
|
285
|
+
* By default, the shell with throw an exception on commands which return non-zero exit codes.
|
|
284
286
|
*/
|
|
285
287
|
nothrow(): this;
|
|
286
288
|
|
|
287
289
|
/**
|
|
288
290
|
* Configure whether or not the shell should throw an exception on non-zero exit codes.
|
|
291
|
+
*
|
|
292
|
+
* By default, this is configured to `true`.
|
|
289
293
|
*/
|
|
290
294
|
throws(shouldThrow: boolean): this;
|
|
291
295
|
}
|
package/globals.d.ts
CHANGED
|
@@ -1874,21 +1874,10 @@ declare global {
|
|
|
1874
1874
|
* ```
|
|
1875
1875
|
*/
|
|
1876
1876
|
readonly env: NodeJS.ProcessEnv;
|
|
1877
|
-
/**
|
|
1878
|
-
* Resolve a module ID the same as if you imported it
|
|
1879
|
-
*
|
|
1880
|
-
* On failure, throws a `ResolveMessage`
|
|
1881
|
-
*/
|
|
1882
|
-
resolve(moduleId: string): Promise<string>;
|
|
1883
|
-
/**
|
|
1884
|
-
* Resolve a `moduleId` as though it were imported from `parent`
|
|
1885
|
-
*
|
|
1886
|
-
* On failure, throws a `ResolveMessage`
|
|
1887
|
-
*/
|
|
1888
|
-
// tslint:disable-next-line:unified-signatures
|
|
1889
|
-
resolve(moduleId: string, parent: string): Promise<string>;
|
|
1890
1877
|
|
|
1891
1878
|
/**
|
|
1879
|
+
* @deprecated Use `require.resolve` or `Bun.resolveSync(moduleId, path.dirname(parent))` instead
|
|
1880
|
+
*
|
|
1892
1881
|
* Resolve a module ID the same as if you imported it
|
|
1893
1882
|
*
|
|
1894
1883
|
* The `parent` argument is optional, and defaults to the current module's path.
|
|
@@ -1896,17 +1885,12 @@ declare global {
|
|
|
1896
1885
|
resolveSync(moduleId: string, parent?: string): string;
|
|
1897
1886
|
|
|
1898
1887
|
/**
|
|
1899
|
-
* Load a CommonJS module
|
|
1900
|
-
*
|
|
1901
|
-
*
|
|
1902
|
-
* - CommonJS modules
|
|
1903
|
-
* - *.node files
|
|
1904
|
-
* - *.json files
|
|
1888
|
+
* Load a CommonJS module within an ES Module. Bun's transpiler rewrites all
|
|
1889
|
+
* calls to `require` with `import.meta.require` when transpiling ES Modules
|
|
1890
|
+
* for the runtime.
|
|
1905
1891
|
*
|
|
1906
|
-
* Warning: **This API is not stable** and may change
|
|
1907
|
-
*
|
|
1908
|
-
* will automatically rewrite your code to use `import.meta.require` if
|
|
1909
|
-
* relevant.
|
|
1892
|
+
* Warning: **This API is not stable** and may change or be removed in the
|
|
1893
|
+
* future. Use at your own risk.
|
|
1910
1894
|
*/
|
|
1911
1895
|
require: NodeJS.Require;
|
|
1912
1896
|
|
|
@@ -1930,17 +1914,15 @@ declare global {
|
|
|
1930
1914
|
readonly main: boolean;
|
|
1931
1915
|
|
|
1932
1916
|
/** Alias of `import.meta.dir`. Exists for Node.js compatibility */
|
|
1933
|
-
dirname: string;
|
|
1917
|
+
readonly dirname: string;
|
|
1934
1918
|
|
|
1935
1919
|
/** Alias of `import.meta.path`. Exists for Node.js compatibility */
|
|
1936
|
-
filename: string;
|
|
1920
|
+
readonly filename: string;
|
|
1937
1921
|
}
|
|
1938
1922
|
|
|
1939
1923
|
/**
|
|
1940
1924
|
* NodeJS-style `require` function
|
|
1941
1925
|
*
|
|
1942
|
-
* Internally, uses `import.meta.require`
|
|
1943
|
-
*
|
|
1944
1926
|
* @param moduleId - The module ID to resolve
|
|
1945
1927
|
*/
|
|
1946
1928
|
var require: NodeJS.Require;
|
package/package.json
CHANGED
package/test.d.ts
CHANGED
|
@@ -204,12 +204,17 @@ declare module "bun:test" {
|
|
|
204
204
|
* @param condition if these tests should be skipped
|
|
205
205
|
*/
|
|
206
206
|
skipIf(condition: boolean): (label: string, fn: () => void) => void;
|
|
207
|
+
/**
|
|
208
|
+
* Marks this group of tests as to be written or to be fixed, if `condition` is true.
|
|
209
|
+
*
|
|
210
|
+
* @param condition if these tests should be skipped
|
|
211
|
+
*/
|
|
212
|
+
todoIf(condition: boolean): (label: string, fn: () => void) => void;
|
|
207
213
|
/**
|
|
208
214
|
* Returns a function that runs for each item in `table`.
|
|
209
215
|
*
|
|
210
216
|
* @param table Array of Arrays with the arguments that are passed into the test fn for each row.
|
|
211
217
|
*/
|
|
212
|
-
|
|
213
218
|
each<T extends Readonly<[any, ...any[]]>>(
|
|
214
219
|
table: readonly T[],
|
|
215
220
|
): (
|
|
@@ -457,6 +462,20 @@ declare module "bun:test" {
|
|
|
457
462
|
| ((done: (err?: unknown) => void) => void),
|
|
458
463
|
options?: number | TestOptions,
|
|
459
464
|
) => void;
|
|
465
|
+
/**
|
|
466
|
+
* Marks this test as to be written or to be fixed, if `condition` is true.
|
|
467
|
+
*
|
|
468
|
+
* @param condition if the test should be marked TODO
|
|
469
|
+
*/
|
|
470
|
+
todoIf(
|
|
471
|
+
condition: boolean,
|
|
472
|
+
): (
|
|
473
|
+
label: string,
|
|
474
|
+
fn:
|
|
475
|
+
| (() => void | Promise<unknown>)
|
|
476
|
+
| ((done: (err?: unknown) => void) => void),
|
|
477
|
+
options?: number | TestOptions,
|
|
478
|
+
) => void;
|
|
460
479
|
/**
|
|
461
480
|
* Returns a function that runs for each item in `table`.
|
|
462
481
|
*
|