From 40c6c1980215f8ced9fbcc36f0a6f7b1f6e2c671 Mon Sep 17 00:00:00 2001 From: aklinker1 <10101283+aklinker1@users.noreply.github.com> Date: Thu, 2 Jul 2026 01:05:26 +0000 Subject: [PATCH] fix: Upgrade `@wxt-dev/browser` to latest `@types/chrome` version --- bun.lock | 6 +-- packages/browser/package.json | 4 +- packages/browser/src/gen/index.d.ts | 63 ++++++++++++++++++++++------- 3 files changed, 53 insertions(+), 20 deletions(-) diff --git a/bun.lock b/bun.lock index 2117b232..41acbc72 100644 --- a/bun.lock +++ b/bun.lock @@ -83,13 +83,13 @@ }, "packages/browser": { "name": "@wxt-dev/browser", - "version": "0.2.0", + "version": "0.2.2", "dependencies": { "@types/filesystem": "*", "@types/har-format": "*", }, "devDependencies": { - "@types/chrome": "0.2.0", + "@types/chrome": "0.2.2", "@types/node": "catalog:", "nano-spawn": "catalog:", "typescript": "catalog:", @@ -1062,7 +1062,7 @@ "@types/chai": ["@types/chai@5.2.3", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="], - "@types/chrome": ["@types/chrome@0.2.0", "", { "dependencies": { "@types/filesystem": "*", "@types/har-format": "*" } }, "sha512-K/i7EKEVSpmyXXjE0ev5oASWBYMY6yM8LFSutG2PkM1DmxJUggZsoaTc0W1RsVwDDKrsZEjpHFAbqqxlRxGsSg=="], + "@types/chrome": ["@types/chrome@0.2.2", "", { "dependencies": { "@types/filesystem": "*", "@types/har-format": "*" } }, "sha512-8rSMZ4cvo2xmaSyQg0sN5yRL7oiDkntLoiHxUhfwQnv1mvnkrdoZ25SlNrKWmYKaeP50WvrfWj1pmc02+U9KKw=="], "@types/debug": ["@types/debug@4.1.12", "", { "dependencies": { "@types/ms": "*" } }, "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ=="], diff --git a/packages/browser/package.json b/packages/browser/package.json index 5c7bd92f..75348a61 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -1,7 +1,7 @@ { "name": "@wxt-dev/browser", "description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome", - "version": "0.2.0", + "version": "0.2.2", "type": "module", "main": "src/index.mjs", "types": "src/index.d.ts", @@ -25,7 +25,7 @@ "src" ], "devDependencies": { - "@types/chrome": "0.2.0", + "@types/chrome": "0.2.2", "@types/node": "catalog:", "nano-spawn": "catalog:", "typescript": "catalog:", diff --git a/packages/browser/src/gen/index.d.ts b/packages/browser/src/gen/index.d.ts index 4946c8f5..6f4863fc 100644 --- a/packages/browser/src/gen/index.d.ts +++ b/packages/browser/src/gen/index.d.ts @@ -383,22 +383,53 @@ export namespace Browser { * Permissions: "alarms" */ export namespace alarms { - interface AlarmCreateInfo { - /** Length of time in minutes after which the {@link onAlarm} event should fire. */ - delayInMinutes?: number | undefined; - /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */ - periodInMinutes?: number | undefined; - /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */ - when?: number | undefined; - } + type AlarmCreateInfo = + & { + /** + * Whether the alarm should persist across sessions (browser restarts). In Chrome, this defaults to true to match historical behavior, but you should set this explicitly to maximize compatibility across browsers. + * @since Chrome 150 + */ + persistAcrossSessions?: boolean | undefined; + } + & ( + | { + /** Length of time in minutes after which the {@link onAlarm} event should fire. */ + delayInMinutes: number; + /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */ + periodInMinutes?: number | undefined; + /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */ + when?: never | undefined; + } + | { + /** Length of time in minutes after which the {@link onAlarm} event should fire. */ + delayInMinutes?: number | undefined; + /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */ + periodInMinutes: number; + /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */ + when?: number | undefined; + } + | { + /** Length of time in minutes after which the {@link onAlarm} event should fire. */ + delayInMinutes?: never | undefined; + /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */ + periodInMinutes?: number | undefined; + /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */ + when: number; + } + ); interface Alarm { - /** If not null, the alarm is a repeating alarm and will fire again in `periodInMinutes` minutes. */ - periodInMinutes?: number; - /** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. `Date.now() + n`). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */ - scheduledTime: number; /** Name of this alarm. */ name: string; + /** If not null, the alarm is a repeating alarm and will fire again in `periodInMinutes` minutes. */ + periodInMinutes?: number; + /** + * Whether the alarm should persist across sessions (browser restarts). + * @since Chrome 150 + */ + persistAcrossSessions: boolean; + /** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. `Date.now() + n`). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */ + scheduledTime: number; } /** @@ -7606,7 +7637,7 @@ export namespace Browser { * Creates a new offscreen document for the extension. * @param parameters The parameters describing the offscreen document to create. * - * Can return its result via Promise in Manifest V3. + * Can return its result via Promise. */ function createDocument(parameters: CreateParameters): Promise; function createDocument(parameters: CreateParameters, callback: () => void): void; @@ -7614,7 +7645,7 @@ export namespace Browser { /** * Closes the currently-open offscreen document for the extension. * - * Can return its result via Promise in Manifest V3. + * Can return its result via Promise. */ function closeDocument(): Promise; function closeDocument(callback: () => void): void; @@ -7622,7 +7653,8 @@ export namespace Browser { /** * Determines whether the extension has an active document. * - * Can return its result via Promise in Manifest V3. + * Can return its result via Promise. + * @since Chrome 150 */ function hasDocument(): Promise; function hasDocument(callback: (result: boolean) => void): void; @@ -9184,6 +9216,7 @@ export namespace Browser { | "identity" | "identity.email" | "idle" + | "input" | "loginState" | "management" | "nativeMessaging"