@wxt-dev/browser 0.2.7 → 0.2.8

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 +2 -2
  2. package/src/gen/index.d.ts +41 -11
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wxt-dev/browser",
3
3
  "description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
4
- "version": "0.2.7",
4
+ "version": "0.2.8",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "src"
26
26
  ],
27
27
  "devDependencies": {
28
- "@types/chrome": "0.2.7",
28
+ "@types/chrome": "0.2.8",
29
29
  "@types/node": "^22",
30
30
  "typescript": "^6.0.3",
31
31
  "vitest": "^4.1.10"
@@ -396,6 +396,11 @@ export namespace Browser {
396
396
  export namespace alarms {
397
397
  type AlarmCreateInfo =
398
398
  & {
399
+ /**
400
+ * Name of this alarm.
401
+ * @since Chrome 152
402
+ */
403
+ name?: string | undefined;
399
404
  /**
400
405
  * 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.
401
406
  * @since Chrome 150
@@ -455,9 +460,18 @@ export namespace Browser {
455
460
  * Can return its result via Promise in Manifest V3 or later since Chrome 111.
456
461
  */
457
462
  function create(alarmInfo: AlarmCreateInfo): Promise<void>;
458
- function create(name: string | undefined, alarmInfo: AlarmCreateInfo): Promise<void>;
463
+ function create(name: undefined, alarmInfo: AlarmCreateInfo): Promise<void>;
464
+ function create<T extends AlarmCreateInfo>(
465
+ name: string,
466
+ alarmInfo: T & (T extends { name: string } ? never : unknown),
467
+ ): Promise<void>;
459
468
  function create(alarmInfo: AlarmCreateInfo, callback: () => void): void;
460
- function create(name: string | undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void;
469
+ function create(name: undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void;
470
+ function create<T extends AlarmCreateInfo>(
471
+ name: string,
472
+ alarmInfo: T & (T extends { name: string } ? never : unknown),
473
+ callback: () => void,
474
+ ): void;
461
475
 
462
476
  /**
463
477
  * Gets an array of all the alarms.
@@ -3076,10 +3090,13 @@ export namespace Browser {
3076
3090
  /**
3077
3091
  * Creates a pane within panel's sidebar.
3078
3092
  * @param title Text that is displayed in sidebar caption.
3093
+ *
3094
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3079
3095
  */
3096
+ createSidebarPane(title: string): Promise<ExtensionSidebarPane>;
3080
3097
  createSidebarPane(
3081
3098
  title: string,
3082
- callback?: (
3099
+ callback: (
3083
3100
  /** An ExtensionSidebarPane object for created sidebar pane. */
3084
3101
  result: ExtensionSidebarPane,
3085
3102
  ) => void,
@@ -3093,10 +3110,13 @@ export namespace Browser {
3093
3110
  /**
3094
3111
  * Creates a pane within panel's sidebar.
3095
3112
  * @param title Text that is displayed in sidebar caption.
3113
+ *
3114
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3096
3115
  */
3116
+ createSidebarPane(title: string): Promise<ExtensionSidebarPane>;
3097
3117
  createSidebarPane(
3098
3118
  title: string,
3099
- callback?: (
3119
+ callback: (
3100
3120
  /** An ExtensionSidebarPane object for created sidebar pane. */
3101
3121
  result: ExtensionSidebarPane,
3102
3122
  ) => void,
@@ -3116,19 +3136,23 @@ export namespace Browser {
3116
3136
  * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.
3117
3137
  * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch.
3118
3138
  * @param rootTitle An optional title for the root of the expression tree.
3139
+ *
3140
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3119
3141
  */
3120
- setExpression(expression: string, callback?: () => void): void;
3121
- setExpression(expression: string, rootTitle: string | undefined, callback?: () => void): void;
3142
+ setExpression(expression: string, rootTitle?: string): Promise<void>;
3143
+ setExpression(expression: string, rootTitle: string | undefined, callback: () => void): void;
3122
3144
  /**
3123
3145
  * Sets a JSON-compliant object to be displayed in the sidebar pane.
3124
3146
  * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client).
3125
3147
  * @param rootTitle An optional title for the root of the expression tree.
3148
+ *
3149
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3126
3150
  */
3127
- setObject(jsonObject: { [key: string]: unknown }, callback?: () => void): void;
3151
+ setObject(jsonObject: { [key: string]: unknown }, rootTitle?: string): Promise<void>;
3128
3152
  setObject(
3129
3153
  jsonObject: { [key: string]: unknown },
3130
3154
  rootTitle: string | undefined,
3131
- callback?: () => void,
3155
+ callback: () => void,
3132
3156
  ): void;
3133
3157
  /**
3134
3158
  * Sets an HTML page to be displayed in the sidebar pane.
@@ -3158,12 +3182,15 @@ export namespace Browser {
3158
3182
  * @param title Title that is displayed next to the extension icon in the Developer Tools toolbar.
3159
3183
  * @param iconPath Path of the panel's icon relative to the extension directory.
3160
3184
  * @param pagePath Path of the panel's HTML page relative to the extension directory.
3185
+ *
3186
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3161
3187
  */
3188
+ function create(title: string, iconPath: string, pagePath: string): Promise<ExtensionPanel>;
3162
3189
  function create(
3163
3190
  title: string,
3164
3191
  iconPath: string,
3165
3192
  pagePath: string,
3166
- callback?: (
3193
+ callback: (
3167
3194
  /** An ExtensionPanel object representing the created panel. */
3168
3195
  panel: ExtensionPanel,
3169
3196
  ) => void,
@@ -3190,13 +3217,16 @@ export namespace Browser {
3190
3217
  * @param url The URL of the resource to open.
3191
3218
  * @param lineNumber Specifies the line number to scroll to when the resource is loaded.
3192
3219
  * @param columnNumber Specifies the column number to scroll to when the resource is loaded.
3220
+ *
3221
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3193
3222
  */
3194
- function openResource(url: string, lineNumber: number, callback?: () => void): void;
3223
+ function openResource(url: string, lineNumber: number, columnNumber?: number): Promise<void>;
3224
+ function openResource(url: string, lineNumber: number, callback: () => void): void;
3195
3225
  function openResource(
3196
3226
  url: string,
3197
3227
  lineNumber: number,
3198
3228
  columnNumber: number | undefined,
3199
- callback?: () => void,
3229
+ callback: () => void,
3200
3230
  ): void;
3201
3231
 
3202
3232
  /**