bun-types 1.1.18 → 1.1.19-canary.20240710T140452

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/jsc.d.ts +21 -16
  2. package/package.json +1 -1
  3. package/sqlite.d.ts +5 -5
package/jsc.d.ts CHANGED
@@ -88,21 +88,7 @@ declare module "bun:jsc" {
88
88
  */
89
89
  function setTimeZone(timeZone: string): string;
90
90
 
91
- /**
92
- * Run JavaScriptCore's sampling profiler for a particular function
93
- *
94
- * This is pretty low-level.
95
- *
96
- * Things to know:
97
- * - LLint means "Low Level Interpreter", which is the interpreter that runs before any JIT compilation
98
- * - Baseline is the first JIT compilation tier. It's the least optimized, but the fastest to compile
99
- * - DFG means "Data Flow Graph", which is the second JIT compilation tier. It has some optimizations, but is slower to compile
100
- * - FTL means "Faster Than Light", which is the third JIT compilation tier. It has the most optimizations, but is the slowest to compile
101
- */
102
- function profile(
103
- callback: CallableFunction,
104
- sampleInterval?: number,
105
- ): {
91
+ interface SamplingProfile {
106
92
  /**
107
93
  * A formatted summary of the top functions
108
94
  *
@@ -193,7 +179,26 @@ declare module "bun:jsc" {
193
179
  * Stack traces of the top functions
194
180
  */
195
181
  stackTraces: string[];
196
- };
182
+ }
183
+
184
+ /**
185
+ * Run JavaScriptCore's sampling profiler for a particular function
186
+ *
187
+ * This is pretty low-level.
188
+ *
189
+ * Things to know:
190
+ * - LLint means "Low Level Interpreter", which is the interpreter that runs before any JIT compilation
191
+ * - Baseline is the first JIT compilation tier. It's the least optimized, but the fastest to compile
192
+ * - DFG means "Data Flow Graph", which is the second JIT compilation tier. It has some optimizations, but is slower to compile
193
+ * - FTL means "Faster Than Light", which is the third JIT compilation tier. It has the most optimizations, but is the slowest to compile
194
+ */
195
+ function profile<T extends (...args: any[]) => any>(
196
+ callback: T,
197
+ sampleInterval?: number,
198
+ ...args: Parameters<T>
199
+ ): ReturnType<T> extends Promise<infer U>
200
+ ? Promise<SamplingProfile>
201
+ : SamplingProfile;
197
202
 
198
203
  /**
199
204
  * This returns objects which native code has explicitly protected from being
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.18",
2
+ "version": "1.1.19-canary.20240710T140452",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",
package/sqlite.d.ts CHANGED
@@ -36,7 +36,7 @@ declare module "bun:sqlite" {
36
36
  * ```ts
37
37
  * const db = new Database("mydb.sqlite");
38
38
  * db.run("CREATE TABLE foo (bar TEXT)");
39
- * db.run("INSERT INTO foo VALUES (?)", "baz");
39
+ * db.run("INSERT INTO foo VALUES (?)", ["baz"]);
40
40
  * console.log(db.query("SELECT * FROM foo").all());
41
41
  * ```
42
42
  *
@@ -47,7 +47,7 @@ declare module "bun:sqlite" {
47
47
  * ```ts
48
48
  * const db = new Database(":memory:");
49
49
  * db.run("CREATE TABLE foo (bar TEXT)");
50
- * db.run("INSERT INTO foo VALUES (?)", "hiiiiii");
50
+ * db.run("INSERT INTO foo VALUES (?)", ["hiiiiii"]);
51
51
  * console.log(db.query("SELECT * FROM foo").all());
52
52
  * ```
53
53
  *
@@ -158,7 +158,7 @@ declare module "bun:sqlite" {
158
158
  * @example
159
159
  * ```ts
160
160
  * db.run("CREATE TABLE foo (bar TEXT)");
161
- * db.run("INSERT INTO foo VALUES (?)", "baz");
161
+ * db.run("INSERT INTO foo VALUES (?)", ["baz"]);
162
162
  * ```
163
163
  *
164
164
  * Useful for queries like:
@@ -277,9 +277,9 @@ declare module "bun:sqlite" {
277
277
  * @example
278
278
  * ```ts
279
279
  * db.run("CREATE TABLE foo (bar TEXT)");
280
- * db.run("INSERT INTO foo VALUES (?)", "baz");
280
+ * db.run("INSERT INTO foo VALUES (?)", ["baz"]);
281
281
  * db.run("BEGIN");
282
- * db.run("INSERT INTO foo VALUES (?)", "qux");
282
+ * db.run("INSERT INTO foo VALUES (?)", ["qux"]);
283
283
  * console.log(db.inTransaction());
284
284
  * ```
285
285
  */