bun-types-no-globals 1.2.21-canary.20250823T140535 → 1.2.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/README.md +15 -0
- package/lib/bun.d.ts +4 -3
- package/lib/shell.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,21 @@ export function createPlugin(): BunPlugin | WebpackPlugin | VitePlugin {
|
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
### 🛠️ [Re-\]declaring the Bun namespace
|
|
46
|
+
|
|
47
|
+
Sometimes you'll still want the Bun namespace to globally exist - this is most helpful in situations where actually including a runtime import from `bun` is more inconvenient than using the Bun namespace itself. You can tell TypeScript about the namespace by including this code somewhere in your program:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// File could be called `bun.ns.d.ts` for example
|
|
51
|
+
import * as BunModule from 'bun';
|
|
52
|
+
|
|
53
|
+
declare global {
|
|
54
|
+
export import Bun = BunModule;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
I wrote a little about the above syntax [on my blog about Ambient Declarations](https://alistair.sh/ambient-declarations).
|
|
59
|
+
|
|
45
60
|
## Usage
|
|
46
61
|
|
|
47
62
|
We recommend you require these types with a triple slash reference anywhere in your program
|
package/lib/bun.d.ts
CHANGED
|
@@ -1628,7 +1628,7 @@ declare module "bun" {
|
|
|
1628
1628
|
kind: ImportKind;
|
|
1629
1629
|
}
|
|
1630
1630
|
|
|
1631
|
-
namespace
|
|
1631
|
+
namespace Build {
|
|
1632
1632
|
type Architecture = "x64" | "arm64";
|
|
1633
1633
|
type Libc = "glibc" | "musl";
|
|
1634
1634
|
type SIMD = "baseline" | "modern";
|
|
@@ -1641,6 +1641,7 @@ declare module "bun" {
|
|
|
1641
1641
|
| `bun-windows-x64-${SIMD}`
|
|
1642
1642
|
| `bun-linux-x64-${SIMD}-${Libc}`;
|
|
1643
1643
|
}
|
|
1644
|
+
|
|
1644
1645
|
/**
|
|
1645
1646
|
* @see [Bun.build API docs](https://bun.com/docs/bundler#api)
|
|
1646
1647
|
*/
|
|
@@ -1836,7 +1837,7 @@ declare module "bun" {
|
|
|
1836
1837
|
}
|
|
1837
1838
|
|
|
1838
1839
|
interface CompileBuildOptions {
|
|
1839
|
-
target?:
|
|
1840
|
+
target?: Bun.Build.Target;
|
|
1840
1841
|
execArgv?: string[];
|
|
1841
1842
|
executablePath?: string;
|
|
1842
1843
|
outfile?: string;
|
|
@@ -1878,7 +1879,7 @@ declare module "bun" {
|
|
|
1878
1879
|
* });
|
|
1879
1880
|
* ```
|
|
1880
1881
|
*/
|
|
1881
|
-
compile: boolean |
|
|
1882
|
+
compile: boolean | Bun.Build.Target | CompileBuildOptions;
|
|
1882
1883
|
}
|
|
1883
1884
|
|
|
1884
1885
|
/**
|
package/lib/shell.d.ts
CHANGED
package/package.json
CHANGED