bun-types 1.1.35-canary.20241107T140530 → 1.1.35-canary.20241109T140516

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.
Files changed (3) hide show
  1. package/bun.d.ts +50 -1
  2. package/globals.d.ts +9 -1
  3. package/package.json +1 -1
package/bun.d.ts CHANGED
@@ -3946,7 +3946,8 @@ declare module "bun" {
3946
3946
  | "file"
3947
3947
  | "napi"
3948
3948
  | "wasm"
3949
- | "text";
3949
+ | "text"
3950
+ | "css";
3950
3951
 
3951
3952
  interface PluginConstraints {
3952
3953
  /**
@@ -4034,12 +4035,20 @@ declare module "bun" {
4034
4035
  * The default loader for this file extension
4035
4036
  */
4036
4037
  loader: Loader;
4038
+
4039
+ /**
4040
+ * Defer the execution of this callback until all other modules have been parsed.
4041
+ *
4042
+ * @returns Promise which will be resolved when all modules have been parsed
4043
+ */
4044
+ defer: () => Promise<void>;
4037
4045
  }
4038
4046
 
4039
4047
  type OnLoadResult = OnLoadResultSourceCode | OnLoadResultObject | undefined;
4040
4048
  type OnLoadCallback = (
4041
4049
  args: OnLoadArgs,
4042
4050
  ) => OnLoadResult | Promise<OnLoadResult>;
4051
+ type OnStartCallback = () => void | Promise<void>;
4043
4052
 
4044
4053
  interface OnResolveArgs {
4045
4054
  /**
@@ -4123,6 +4132,20 @@ declare module "bun" {
4123
4132
  constraints: PluginConstraints,
4124
4133
  callback: OnResolveCallback,
4125
4134
  ): void;
4135
+ /**
4136
+ * Register a callback which will be invoked when bundling starts.
4137
+ * @example
4138
+ * ```ts
4139
+ * Bun.plugin({
4140
+ * setup(builder) {
4141
+ * builder.onStart(() => {
4142
+ * console.log("bundle just started!!")
4143
+ * });
4144
+ * },
4145
+ * });
4146
+ * ```
4147
+ */
4148
+ onStart(callback: OnStartCallback): void;
4126
4149
  /**
4127
4150
  * The config object passed to `Bun.build` as is. Can be mutated.
4128
4151
  */
@@ -4548,6 +4571,30 @@ declare module "bun" {
4548
4571
  */
4549
4572
  setMaxSendFragment(size: number): boolean;
4550
4573
 
4574
+ /**
4575
+ * Enable/disable the use of Nagle's algorithm.
4576
+ * Only available for already connected sockets, will return false otherwise
4577
+ * @param noDelay Default: `true`
4578
+ * @returns true if is able to setNoDelay and false if it fails.
4579
+ */
4580
+ setNoDelay(noDelay?: boolean): boolean;
4581
+
4582
+ /**
4583
+ * Enable/disable keep-alive functionality, and optionally set the initial delay before the first keepalive probe is sent on an idle socket.
4584
+ * Set `initialDelay` (in milliseconds) to set the delay between the last data packet received and the first keepalive probe.
4585
+ * Only available for already connected sockets, will return false otherwise.
4586
+ *
4587
+ * Enabling the keep-alive functionality will set the following socket options:
4588
+ * SO_KEEPALIVE=1
4589
+ * TCP_KEEPIDLE=initialDelay
4590
+ * TCP_KEEPCNT=10
4591
+ * TCP_KEEPINTVL=1
4592
+ * @param enable Default: `false`
4593
+ * @param initialDelay Default: `0`
4594
+ * @returns true if is able to setNoDelay and false if it fails.
4595
+ */
4596
+ setKeepAlive(enable?: boolean, initialDelay?: number): boolean;
4597
+
4551
4598
  /**
4552
4599
  * The number of bytes written to the socket.
4553
4600
  */
@@ -4668,6 +4715,7 @@ declare module "bun" {
4668
4715
  port: number;
4669
4716
  tls?: TLSOptions;
4670
4717
  exclusive?: boolean;
4718
+ allowHalfOpen?: boolean;
4671
4719
  }
4672
4720
 
4673
4721
  interface TCPSocketConnectOptions<Data = undefined>
@@ -4676,6 +4724,7 @@ declare module "bun" {
4676
4724
  port: number;
4677
4725
  tls?: boolean;
4678
4726
  exclusive?: boolean;
4727
+ allowHalfOpen?: boolean;
4679
4728
  }
4680
4729
 
4681
4730
  interface UnixSocketOptions<Data = undefined> extends SocketOptions<Data> {
package/globals.d.ts CHANGED
@@ -661,8 +661,16 @@ declare global {
661
661
  * @default true
662
662
  */
663
663
  // trackUnmanagedFds?: boolean;
664
-
665
664
  // resourceLimits?: import("worker_threads").ResourceLimits;
665
+
666
+ /**
667
+ * An array of module specifiers to preload in the worker.
668
+ *
669
+ * These modules load before the worker's entry point is executed.
670
+ *
671
+ * Equivalent to passing the `--preload` CLI argument, but only for this Worker.
672
+ */
673
+ preload?: string[] | string | undefined;
666
674
  }
667
675
 
668
676
  interface Worker extends EventTarget, AbstractWorker {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.35-canary.20241107T140530",
2
+ "version": "1.1.35-canary.20241109T140516",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",