bun-types-no-globals 1.3.7-canary.20260125T140607 → 1.3.7-canary.20260127T141314
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 +63 -0
- package/lib/extensions.d.ts +5 -0
- package/package.json +1 -1
package/lib/bun.d.ts
CHANGED
|
@@ -905,6 +905,69 @@ declare module "bun" {
|
|
|
905
905
|
export function stringify(input: unknown, replacer?: undefined | null, space?: string | number): string;
|
|
906
906
|
}
|
|
907
907
|
|
|
908
|
+
/**
|
|
909
|
+
* JSON5 related APIs
|
|
910
|
+
*/
|
|
911
|
+
namespace JSON5 {
|
|
912
|
+
/**
|
|
913
|
+
* Parse a JSON5 string into a JavaScript value.
|
|
914
|
+
*
|
|
915
|
+
* JSON5 is a superset of JSON based on ECMAScript 5.1 that supports
|
|
916
|
+
* comments, trailing commas, unquoted keys, single-quoted strings,
|
|
917
|
+
* hex numbers, Infinity, NaN, and more.
|
|
918
|
+
*
|
|
919
|
+
* @category Utilities
|
|
920
|
+
*
|
|
921
|
+
* @param input The JSON5 string to parse
|
|
922
|
+
* @returns A JavaScript value
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```ts
|
|
926
|
+
* import { JSON5 } from "bun";
|
|
927
|
+
*
|
|
928
|
+
* const result = JSON5.parse(`{
|
|
929
|
+
* // This is a comment
|
|
930
|
+
* name: 'my-app',
|
|
931
|
+
* version: '1.0.0', // trailing comma is allowed
|
|
932
|
+
* hex: 0xDEADbeef,
|
|
933
|
+
* half: .5,
|
|
934
|
+
* infinity: Infinity,
|
|
935
|
+
* }`);
|
|
936
|
+
* ```
|
|
937
|
+
*/
|
|
938
|
+
export function parse(input: string): unknown;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Convert a JavaScript value into a JSON5 string. Object keys that are
|
|
942
|
+
* valid identifiers are unquoted, strings use double quotes, `Infinity`
|
|
943
|
+
* and `NaN` are represented as literals, and indented output includes
|
|
944
|
+
* trailing commas.
|
|
945
|
+
*
|
|
946
|
+
* @category Utilities
|
|
947
|
+
*
|
|
948
|
+
* @param input The JavaScript value to stringify.
|
|
949
|
+
* @param replacer Currently not supported.
|
|
950
|
+
* @param space A number for how many spaces each level of indentation gets, or a string used as indentation.
|
|
951
|
+
* The number is clamped between 0 and 10, and the first 10 characters of the string are used.
|
|
952
|
+
* @returns A JSON5 string, or `undefined` if the input is `undefined`, a function, or a symbol.
|
|
953
|
+
*
|
|
954
|
+
* @example
|
|
955
|
+
* ```ts
|
|
956
|
+
* import { JSON5 } from "bun";
|
|
957
|
+
*
|
|
958
|
+
* console.log(JSON5.stringify({ a: 1, b: "two" }));
|
|
959
|
+
* // {a:1,b:"two"}
|
|
960
|
+
*
|
|
961
|
+
* console.log(JSON5.stringify({ a: 1, b: 2 }, null, 2));
|
|
962
|
+
* // {
|
|
963
|
+
* // a: 1,
|
|
964
|
+
* // b: 2,
|
|
965
|
+
* // }
|
|
966
|
+
* ```
|
|
967
|
+
*/
|
|
968
|
+
export function stringify(input: unknown, replacer?: undefined | null, space?: string | number): string | undefined;
|
|
969
|
+
}
|
|
970
|
+
|
|
908
971
|
/**
|
|
909
972
|
* Synchronously resolve a `moduleId` as though it were imported from `parent`
|
|
910
973
|
*
|
package/lib/extensions.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bun-types-no-globals",
|
|
3
|
-
"version": "1.3.7-canary.
|
|
3
|
+
"version": "1.3.7-canary.20260127T141314",
|
|
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",
|