bun-types 1.0.19 → 1.0.20

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 (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +102 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-types",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "license": "MIT",
5
5
  "description": "Type definitions for Bun, an incredibly fast JavaScript runtime",
6
6
  "types": "types.d.ts",
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for bun 1.0.19
1
+ // Type definitions for bun 1.0.20
2
2
  // Project: https://github.com/oven-sh/bun
3
3
  // Definitions by: Jarred Sumner <https://github.com/Jarred-Sumner>
4
4
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -8845,6 +8845,83 @@ declare module "bun" {
8845
8845
  : undefined;
8846
8846
  }
8847
8847
 
8848
+ interface ResourceUsage {
8849
+ /**
8850
+ * The number of voluntary and involuntary context switches that the process made.
8851
+ */
8852
+ contextSwitches: {
8853
+ /**
8854
+ * Voluntary context switches (context switches that the process initiated).
8855
+ */
8856
+ voluntary: number;
8857
+ /**
8858
+ * Involuntary context switches (context switches initiated by the system scheduler).
8859
+ */
8860
+ involuntary: number;
8861
+ };
8862
+
8863
+ /**
8864
+ * The amount of CPU time used by the process, in nanoseconds.
8865
+ */
8866
+ cpuTime: {
8867
+ /**
8868
+ * User CPU time used by the process, in nanoseconds.
8869
+ */
8870
+ user: number;
8871
+ /**
8872
+ * System CPU time used by the process, in nanoseconds.
8873
+ */
8874
+ system: number;
8875
+ /**
8876
+ * Total CPU time used by the process, in nanoseconds.
8877
+ */
8878
+ total: number;
8879
+ };
8880
+ /**
8881
+ * The maximum amount of resident set size (in bytes) used by the process during its lifetime.
8882
+ */
8883
+ maxRSS: number;
8884
+
8885
+ /**
8886
+ * IPC messages sent and received by the process.
8887
+ */
8888
+ messages: {
8889
+ /**
8890
+ * The number of IPC messages sent.
8891
+ */
8892
+ sent: number;
8893
+ /**
8894
+ * The number of IPC messages received.
8895
+ */
8896
+ received: number;
8897
+ };
8898
+ /**
8899
+ * The number of IO operations done by the process.
8900
+ */
8901
+ ops: {
8902
+ /**
8903
+ * The number of input operations via the file system.
8904
+ */
8905
+ in: number;
8906
+ /**
8907
+ * The number of output operations via the file system.
8908
+ */
8909
+ out: number;
8910
+ };
8911
+ /**
8912
+ * The amount of shared memory that the process used.
8913
+ */
8914
+ shmSize: number;
8915
+ /**
8916
+ * The number of signals delivered to the process.
8917
+ */
8918
+ signalCount: number;
8919
+ /**
8920
+ * The number of times the process was swapped out of main memory.
8921
+ */
8922
+ swapCount: number;
8923
+ }
8924
+
8848
8925
  /**
8849
8926
  * A process created by {@link Bun.spawn}.
8850
8927
  *
@@ -8944,6 +9021,15 @@ declare module "bun" {
8944
9021
  * was created with the `ipc` option.
8945
9022
  */
8946
9023
  disconnect(): void;
9024
+
9025
+ /**
9026
+ * Get the resource usage information of the process (max RSS, CPU time, etc)
9027
+ *
9028
+ * Only available after the process has exited
9029
+ *
9030
+ * If the process hasn't exited yet, this will return `undefined`
9031
+ */
9032
+ resourceUsage(): ResourceUsage | undefined;
8947
9033
  }
8948
9034
 
8949
9035
  /**
@@ -8961,6 +9047,10 @@ declare module "bun" {
8961
9047
  stderr: SpawnOptions.ReadableToSyncIO<Err>;
8962
9048
  exitCode: number;
8963
9049
  success: boolean;
9050
+ /**
9051
+ * Get the resource usage information of the process (max RSS, CPU time, etc)
9052
+ */
9053
+ resourceUsage: ResourceUsage;
8964
9054
  }
8965
9055
 
8966
9056
  /**
@@ -9498,7 +9588,17 @@ declare class HTMLRewriter {
9498
9588
  * @param input - The HTML to transform
9499
9589
  * @returns A new {@link Response} with the transformed HTML
9500
9590
  */
9501
- transform(input: Response): Response;
9591
+ transform(input: Response | Blob | Bun.BufferSource): Response;
9592
+ /**
9593
+ * @param input - The HTML string to transform
9594
+ * @returns A new {@link String} containing the transformed HTML
9595
+ */
9596
+ transform(input: string): string;
9597
+ /**
9598
+ * @param input - The HTML to transform as a {@link ArrayBuffer}
9599
+ * @returns A new {@link ArrayBuffer} with the transformed HTML
9600
+ */
9601
+ transform(input: ArrayBuffer): ArrayBuffer;
9502
9602
  }
9503
9603
 
9504
9604