@crxjs/vite-plugin 2.7.1 → 3.0.0

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.
package/dist/index.d.mts CHANGED
@@ -1,332 +1,334 @@
1
- import { ConfigEnv, Plugin, PluginOption } from 'vite';
2
- import { IsStringLiteral } from 'type-fest';
3
- import { GlobOptions } from 'tinyglobby';
4
- import { PluginContext, OutputBundle } from 'rollup';
5
-
1
+ import { ReplaySubject } from "rxjs";
2
+ import { OutputBundle, PluginContext } from "rollup";
3
+ import { ConfigEnv, Plugin, PluginOption } from "vite";
4
+ import { GlobOptions } from "tinyglobby";
5
+ import { IsStringLiteral } from "type-fest";
6
+ //#region src/node/manifest.d.ts
6
7
  interface DeclarativeNetRequestResource {
7
- id: string;
8
- enabled: boolean;
9
- path: string;
8
+ id: string;
9
+ enabled: boolean;
10
+ path: string;
10
11
  }
11
12
  interface WebAccessibleResourceByMatch {
12
- matches: string[];
13
- resources: string[];
14
- use_dynamic_url?: boolean;
13
+ matches: string[];
14
+ resources: string[];
15
+ use_dynamic_url?: boolean;
15
16
  }
16
17
  interface WebAccessibleResourceById {
17
- extension_ids: string[];
18
- resources: string[];
19
- use_dynamic_url?: boolean;
18
+ extension_ids: string[];
19
+ resources: string[];
20
+ use_dynamic_url?: boolean;
20
21
  }
21
22
  interface ChromeManifestBackground {
22
- service_worker: string;
23
- type?: 'module' | (string & Record<never, never>);
23
+ service_worker: string;
24
+ type?: 'module' | (string & Record<never, never>);
24
25
  }
25
26
  interface FirefoxManifestBackground {
26
- scripts: string[];
27
- persistent?: false;
27
+ scripts: string[];
28
+ persistent?: false;
28
29
  }
29
30
  interface ManifestV3 {
30
- manifest_version: number;
31
- name: string;
32
- version: string;
33
- default_locale?: string | undefined;
34
- description?: string | undefined;
35
- icons?: chrome.runtime.ManifestIcons | undefined;
36
- action?: chrome.runtime.ManifestAction | undefined;
37
- /**
38
- * @see https://developer.chrome.com/docs/extensions/reference/manifest/author
39
- */
40
- author?: {
41
- email: string;
42
- } | undefined;
43
- background?: ChromeManifestBackground | FirefoxManifestBackground | undefined;
44
- chrome_settings_overrides?: {
45
- homepage?: string | undefined;
46
- search_provider?: chrome.runtime.SearchProvider | undefined;
47
- startup_pages?: string[] | undefined;
31
+ manifest_version: number;
32
+ name: string;
33
+ version: string;
34
+ default_locale?: string | undefined;
35
+ description?: string | undefined;
36
+ icons?: chrome.runtime.ManifestIcons | undefined;
37
+ action?: chrome.runtime.ManifestAction | undefined;
38
+ /**
39
+ * @see https://developer.chrome.com/docs/extensions/reference/manifest/author
40
+ */
41
+ author?: {
42
+ email: string;
43
+ } | undefined;
44
+ background?: ChromeManifestBackground | FirefoxManifestBackground | undefined;
45
+ chrome_settings_overrides?: {
46
+ homepage?: string | undefined;
47
+ search_provider?: chrome.runtime.SearchProvider | undefined;
48
+ startup_pages?: string[] | undefined;
49
+ } | undefined;
50
+ chrome_ui_overrides?: {
51
+ bookmarks_ui?: {
52
+ remove_bookmark_shortcut?: boolean | undefined;
53
+ remove_button?: boolean | undefined;
48
54
  } | undefined;
49
- chrome_ui_overrides?: {
50
- bookmarks_ui?: {
51
- remove_bookmark_shortcut?: boolean | undefined;
52
- remove_button?: boolean | undefined;
53
- } | undefined;
54
- } | undefined;
55
- chrome_url_overrides?: {
56
- bookmarks?: string | undefined;
57
- history?: string | undefined;
58
- newtab?: string | undefined;
59
- } | undefined;
60
- commands?: {
61
- [name: string]: {
62
- suggested_key?: {
63
- default?: string | undefined;
64
- windows?: string | undefined;
65
- mac?: string | undefined;
66
- chromeos?: string | undefined;
67
- linux?: string | undefined;
68
- } | undefined;
69
- description?: string | undefined;
70
- global?: boolean | undefined;
71
- };
72
- } | undefined;
73
- content_capabilities?: {
74
- matches?: string[] | undefined;
75
- permissions?: string[] | undefined;
76
- } | undefined;
77
- content_scripts?: {
78
- matches?: string[] | undefined;
79
- exclude_matches?: string[] | undefined;
80
- css?: string[] | undefined;
81
- js?: string[] | undefined;
82
- run_at?: string | undefined;
83
- all_frames?: boolean | undefined;
84
- match_about_blank?: boolean | undefined;
85
- include_globs?: string[] | undefined;
86
- exclude_globs?: string[] | undefined;
87
- world?: chrome.scripting.ExecutionWorld | string | undefined;
88
- }[] | undefined;
89
- content_security_policy?: {
90
- extension_pages?: string;
91
- sandbox?: string;
92
- };
93
- converted_from_user_script?: boolean | undefined;
94
- current_locale?: string | undefined;
95
- declarative_net_request?: {
96
- rule_resources: DeclarativeNetRequestResource[];
55
+ } | undefined;
56
+ chrome_url_overrides?: {
57
+ bookmarks?: string | undefined;
58
+ history?: string | undefined;
59
+ newtab?: string | undefined;
60
+ } | undefined;
61
+ commands?: {
62
+ [name: string]: {
63
+ suggested_key?: {
64
+ default?: string | undefined;
65
+ windows?: string | undefined;
66
+ mac?: string | undefined;
67
+ chromeos?: string | undefined;
68
+ linux?: string | undefined;
69
+ } | undefined;
70
+ description?: string | undefined;
71
+ global?: boolean | undefined;
97
72
  };
98
- devtools_page?: string | undefined;
99
- event_rules?: {
100
- event?: string | undefined;
101
- actions?: {
102
- type: string;
103
- }[] | undefined;
104
- conditions?: chrome.declarativeContent.PageStateMatcherProperties[] | undefined;
73
+ } | undefined;
74
+ content_capabilities?: {
75
+ matches?: string[] | undefined;
76
+ permissions?: string[] | undefined;
77
+ } | undefined;
78
+ content_scripts?: {
79
+ matches?: string[] | undefined;
80
+ exclude_matches?: string[] | undefined;
81
+ css?: string[] | undefined;
82
+ js?: string[] | undefined;
83
+ run_at?: string | undefined;
84
+ all_frames?: boolean | undefined;
85
+ match_about_blank?: boolean | undefined;
86
+ include_globs?: string[] | undefined;
87
+ exclude_globs?: string[] | undefined;
88
+ world?: chrome.scripting.ExecutionWorld | string | undefined;
89
+ }[] | undefined;
90
+ content_security_policy?: {
91
+ extension_pages?: string;
92
+ sandbox?: string;
93
+ };
94
+ converted_from_user_script?: boolean | undefined;
95
+ current_locale?: string | undefined;
96
+ declarative_net_request?: {
97
+ rule_resources: DeclarativeNetRequestResource[];
98
+ };
99
+ devtools_page?: string | undefined;
100
+ event_rules?: {
101
+ event?: string | undefined;
102
+ actions?: {
103
+ type: string;
105
104
  }[] | undefined;
106
- externally_connectable?: {
107
- ids?: string[] | undefined;
108
- matches?: string[] | undefined;
109
- accepts_tls_channel_id?: boolean | undefined;
110
- } | undefined;
111
- file_browser_handlers?: {
112
- id?: string | undefined;
113
- default_title?: string | undefined;
114
- file_filters?: string[] | undefined;
115
- }[] | undefined;
116
- file_system_provider_capabilities?: {
117
- configurable?: boolean | undefined;
118
- watchable?: boolean | undefined;
119
- multiple_mounts?: boolean | undefined;
120
- source?: string | undefined;
121
- } | undefined;
122
- homepage_url?: string | undefined;
123
- host_permissions?: string[] | undefined;
124
- import?: {
125
- id: string;
126
- minimum_version?: string | undefined;
127
- }[] | undefined;
128
- export?: {
129
- whitelist?: string[] | undefined;
130
- } | undefined;
131
- incognito?: string | undefined;
132
- input_components?: {
133
- name: string;
134
- id?: string | undefined;
135
- language?: string | string[] | undefined;
136
- layouts?: string | string[] | undefined;
137
- input_view?: string | undefined;
138
- options_page?: string | undefined;
139
- }[] | undefined;
140
- key?: string | undefined;
141
- minimum_chrome_version?: string | undefined;
142
- nacl_modules?: {
143
- path: string;
144
- mime_type: string;
145
- }[] | undefined;
146
- oauth2?: {
147
- client_id: string;
148
- scopes?: string[] | undefined;
149
- } | undefined;
150
- offline_enabled?: boolean | undefined;
151
- omnibox?: {
152
- keyword: string;
153
- } | undefined;
154
- optional_host_permissions?: string[] | undefined;
155
- optional_permissions?: chrome.runtime.ManifestPermissions[] | string[] | undefined;
105
+ conditions?: chrome.declarativeContent.PageStateMatcherProperties[] | undefined;
106
+ }[] | undefined;
107
+ externally_connectable?: {
108
+ ids?: string[] | undefined;
109
+ matches?: string[] | undefined;
110
+ accepts_tls_channel_id?: boolean | undefined;
111
+ } | undefined;
112
+ file_browser_handlers?: {
113
+ id?: string | undefined;
114
+ default_title?: string | undefined;
115
+ file_filters?: string[] | undefined;
116
+ }[] | undefined;
117
+ file_system_provider_capabilities?: {
118
+ configurable?: boolean | undefined;
119
+ watchable?: boolean | undefined;
120
+ multiple_mounts?: boolean | undefined;
121
+ source?: string | undefined;
122
+ } | undefined;
123
+ homepage_url?: string | undefined;
124
+ host_permissions?: string[] | undefined;
125
+ import?: {
126
+ id: string;
127
+ minimum_version?: string | undefined;
128
+ }[] | undefined;
129
+ export?: {
130
+ whitelist?: string[] | undefined;
131
+ } | undefined;
132
+ incognito?: string | undefined;
133
+ input_components?: {
134
+ name: string;
135
+ id?: string | undefined;
136
+ language?: string | string[] | undefined;
137
+ layouts?: string | string[] | undefined;
138
+ input_view?: string | undefined;
156
139
  options_page?: string | undefined;
157
- options_ui?: {
158
- page?: string | undefined;
159
- chrome_style?: boolean | undefined;
160
- open_in_tab?: boolean | undefined;
140
+ }[] | undefined;
141
+ key?: string | undefined;
142
+ minimum_chrome_version?: string | undefined;
143
+ nacl_modules?: {
144
+ path: string;
145
+ mime_type: string;
146
+ }[] | undefined;
147
+ oauth2?: {
148
+ client_id: string;
149
+ scopes?: string[] | undefined;
150
+ } | undefined;
151
+ offline_enabled?: boolean | undefined;
152
+ omnibox?: {
153
+ keyword: string;
154
+ } | undefined;
155
+ optional_host_permissions?: string[] | undefined;
156
+ optional_permissions?: chrome.runtime.ManifestPermissions[] | string[] | undefined;
157
+ options_page?: string | undefined;
158
+ options_ui?: {
159
+ page?: string | undefined;
160
+ chrome_style?: boolean | undefined;
161
+ open_in_tab?: boolean | undefined;
162
+ } | undefined;
163
+ permissions?: chrome.runtime.ManifestPermissions[] | string[] | undefined;
164
+ platforms?: {
165
+ nacl_arch?: string | undefined;
166
+ sub_package_path: string;
167
+ }[] | undefined;
168
+ plugins?: {
169
+ path: string;
170
+ }[] | undefined;
171
+ requirements?: {
172
+ '3D'?: {
173
+ features?: string[] | undefined;
161
174
  } | undefined;
162
- permissions?: chrome.runtime.ManifestPermissions[] | string[] | undefined;
163
- platforms?: {
164
- nacl_arch?: string | undefined;
165
- sub_package_path: string;
166
- }[] | undefined;
167
175
  plugins?: {
168
- path: string;
169
- }[] | undefined;
170
- requirements?: {
171
- '3D'?: {
172
- features?: string[] | undefined;
173
- } | undefined;
174
- plugins?: {
175
- npapi?: boolean | undefined;
176
- } | undefined;
177
- } | undefined;
178
- sandbox?: {
179
- pages: string[];
180
- content_security_policy?: string | undefined;
181
- } | undefined;
182
- side_panel?: {
183
- default_path?: string | undefined;
184
- } | undefined;
185
- short_name?: string | undefined;
186
- spellcheck?: {
187
- dictionary_language?: string | undefined;
188
- dictionary_locale?: string | undefined;
189
- dictionary_format?: string | undefined;
190
- dictionary_path?: string | undefined;
191
- } | undefined;
192
- storage?: {
193
- managed_schema: string;
194
- } | undefined;
195
- tts_engine?: {
196
- voices: {
197
- voice_name: string;
198
- lang?: string | undefined;
199
- gender?: string | undefined;
200
- event_types?: string[] | undefined;
201
- }[];
202
- } | undefined;
203
- update_url?: string | undefined;
204
- version_name?: string | undefined;
205
- web_accessible_resources?: (WebAccessibleResourceById | WebAccessibleResourceByMatch)[] | undefined;
206
- browser_specific_settings?: {
207
- gecko: {
208
- id: string;
209
- strict_min_version?: string | undefined;
210
- strict_max_version?: string | undefined;
211
- update_url?: string | undefined;
212
- data_collection_permissions?: {
213
- /**
214
- * available value: "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "none".
215
- * see also: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/
216
- */
217
- required: GeckoPermissionsRequired[];
218
- /**
219
- * available value: "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "technicalAndInteraction".
220
- * see also: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/
221
- */
222
- optional?: GeckoPermissionsOptional[] | undefined;
223
- };
224
- };
176
+ npapi?: boolean | undefined;
225
177
  } | undefined;
178
+ } | undefined;
179
+ sandbox?: {
180
+ pages: string[];
181
+ content_security_policy?: string | undefined;
182
+ } | undefined;
183
+ side_panel?: {
184
+ default_path?: string | undefined;
185
+ } | undefined;
186
+ short_name?: string | undefined;
187
+ spellcheck?: {
188
+ dictionary_language?: string | undefined;
189
+ dictionary_locale?: string | undefined;
190
+ dictionary_format?: string | undefined;
191
+ dictionary_path?: string | undefined;
192
+ } | undefined;
193
+ storage?: {
194
+ managed_schema: string;
195
+ } | undefined;
196
+ tts_engine?: {
197
+ voices: {
198
+ voice_name: string;
199
+ lang?: string | undefined;
200
+ gender?: string | undefined;
201
+ event_types?: string[] | undefined;
202
+ }[];
203
+ } | undefined;
204
+ update_url?: string | undefined;
205
+ version_name?: string | undefined;
206
+ web_accessible_resources?: (WebAccessibleResourceById | WebAccessibleResourceByMatch)[] | undefined;
207
+ browser_specific_settings?: {
208
+ gecko: {
209
+ id: string;
210
+ strict_min_version?: string | undefined;
211
+ strict_max_version?: string | undefined;
212
+ update_url?: string | undefined;
213
+ data_collection_permissions?: {
214
+ /**
215
+ * available value: "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "none".
216
+ * see also: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/
217
+ */
218
+ required: GeckoPermissionsRequired[];
219
+ /**
220
+ * available value: "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "technicalAndInteraction".
221
+ * see also: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/
222
+ */
223
+ optional?: GeckoPermissionsOptional[] | undefined;
224
+ };
225
+ };
226
+ } | undefined;
226
227
  }
227
228
  type GeckoPermissionsRequired = "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "none";
228
229
  type GeckoPermissionsOptional = "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "technicalAndInteraction";
229
-
230
+ //#endregion
231
+ //#region src/node/defineManifest.d.ts
230
232
  type ManifestV3Fn = (env: ConfigEnv) => ManifestV3 | Promise<ManifestV3>;
231
233
  type ManifestV3Export = ManifestV3 | Promise<ManifestV3> | ManifestV3Fn;
232
234
  type Code = '.' | '/' | '\\';
233
235
  type LiteralManifestFilePath<T extends string> = T extends `${Code}${string}` ? never : T extends `${string}.${infer Ext}` ? Ext extends '' ? never : T : never;
234
236
  type ManifestFilePath<T extends string> = IsStringLiteral<T> extends true ? LiteralManifestFilePath<T> : T;
235
237
  interface ManifestIcons<T extends string> {
236
- [size: number]: ManifestFilePath<T>;
238
+ [size: number]: ManifestFilePath<T>;
237
239
  }
238
240
  type FilePathFields<T extends string> = {
239
- icons?: ManifestIcons<T>;
240
- action?: {
241
- /**
242
- * - Relative to Vite project root (where vite.config.js is)
243
- * - Format: "subdir/icon.png" (no leading ./ or /)
244
- *
245
- * @example "assets/icon.png"
246
- */
247
- default_icon?: ManifestIcons<T>;
248
- default_title?: string;
249
- /**
250
- * - Relative to Vite project root (where vite.config.js is)
251
- * - Format: "subdir/index.html" (no leading ./ or /)
252
- *
253
- * @example "src/popup.html"
254
- */
255
- default_popup?: ManifestFilePath<T>;
256
- };
257
- background?: {
258
- /**
259
- * - Relative to Vite project root (where vite.config.js is)
260
- * - Format: "subdir/index.js" (no leading ./ or /)
261
- *
262
- * @example "src/background.js"
263
- */
264
- service_worker: ManifestFilePath<T>;
265
- type?: 'module' | (string & Record<never, never>);
266
- } | FirefoxManifestBackground;
267
- content_scripts?: {
268
- matches?: string[];
269
- exclude_matches?: string[];
270
- /**
271
- * - Relative to Vite project root (where vite.config.js is)
272
- * - Format: "subdir/content.css" (no leading ./ or /)
273
- *
274
- * @example "src/content.css"
275
- */
276
- css?: ManifestFilePath<T>[];
277
- /**
278
- * - Relative to Vite project root (where vite.config.js is)
279
- * - Format: "subdir/content.js" (no leading ./ or /)
280
- *
281
- * @example "src/content.js"
282
- */
283
- js?: ManifestFilePath<T>[];
284
- run_at?: string;
285
- all_frames?: boolean;
286
- match_about_blank?: boolean;
287
- include_globs?: string[];
288
- exclude_globs?: string[];
289
- /**
290
- * - 'ISOLATED' (default): Content script runs in an isolated world.
291
- * - 'MAIN': Content script runs in the main world.
292
- * NOTE: MAIN currently does NOT support crxjs HMR
293
- * @see https://developer.chrome.com/docs/extensions/mv3/content_scripts/#world
294
- */
295
- world?: 'ISOLATED' | 'MAIN';
296
- }[];
297
- input_components?: {
298
- name: string;
299
- id?: string;
300
- language?: string | string[];
301
- layouts?: string | string[];
302
- input_view?: string;
303
- /**
304
- * - Relative to Vite project root (where vite.config.js is)
305
- * - Format: "subdir/options.html" (no leading ./ or /)
306
- *
307
- * @example "src/options.html"
308
- */
309
- options_page?: ManifestFilePath<T>;
310
- }[];
241
+ icons?: ManifestIcons<T>;
242
+ action?: {
311
243
  /**
312
244
  * - Relative to Vite project root (where vite.config.js is)
313
- * - Format: "subdir/options.html" (no leading ./ or /)
245
+ * - Format: "subdir/icon.png" (no leading ./ or /)
314
246
  *
315
- * @example "src/options.html"
247
+ * @example "assets/icon.png"
316
248
  */
317
- options_page?: ManifestFilePath<T>;
249
+ default_icon?: ManifestIcons<T>;
250
+ default_title?: string;
318
251
  /**
319
252
  * - Relative to Vite project root (where vite.config.js is)
320
- * - Format: "subdir/devtools.html" (no leading ./ or /)
253
+ * - Format: "subdir/index.html" (no leading ./ or /)
321
254
  *
322
- * @example "src/devtools.html"
255
+ * @example "src/popup.html"
323
256
  */
324
- devtools_page?: ManifestFilePath<T>;
257
+ default_popup?: ManifestFilePath<T>;
258
+ };
259
+ background?: {
260
+ /**
261
+ * - Relative to Vite project root (where vite.config.js is)
262
+ * - Format: "subdir/index.js" (no leading ./ or /)
263
+ *
264
+ * @example "src/background.js"
265
+ */
266
+ service_worker: ManifestFilePath<T>;
267
+ type?: 'module' | (string & Record<never, never>);
268
+ } | FirefoxManifestBackground;
269
+ content_scripts?: {
270
+ matches?: string[];
271
+ exclude_matches?: string[];
272
+ /**
273
+ * - Relative to Vite project root (where vite.config.js is)
274
+ * - Format: "subdir/content.css" (no leading ./ or /)
275
+ *
276
+ * @example "src/content.css"
277
+ */
278
+ css?: ManifestFilePath<T>[];
279
+ /**
280
+ * - Relative to Vite project root (where vite.config.js is)
281
+ * - Format: "subdir/content.js" (no leading ./ or /)
282
+ *
283
+ * @example "src/content.js"
284
+ */
285
+ js?: ManifestFilePath<T>[];
286
+ run_at?: string;
287
+ all_frames?: boolean;
288
+ match_about_blank?: boolean;
289
+ include_globs?: string[];
290
+ exclude_globs?: string[];
291
+ /**
292
+ * - 'ISOLATED' (default): Content script runs in an isolated world.
293
+ * - 'MAIN': Content script runs in the main world.
294
+ * NOTE: MAIN currently does NOT support crxjs HMR
295
+ * @see https://developer.chrome.com/docs/extensions/mv3/content_scripts/#world
296
+ */
297
+ world?: 'ISOLATED' | 'MAIN';
298
+ }[];
299
+ input_components?: {
300
+ name: string;
301
+ id?: string;
302
+ language?: string | string[];
303
+ layouts?: string | string[];
304
+ input_view?: string;
305
+ /**
306
+ * - Relative to Vite project root (where vite.config.js is)
307
+ * - Format: "subdir/options.html" (no leading ./ or /)
308
+ *
309
+ * @example "src/options.html"
310
+ */
311
+ options_page?: ManifestFilePath<T>;
312
+ }[];
313
+ /**
314
+ * - Relative to Vite project root (where vite.config.js is)
315
+ * - Format: "subdir/options.html" (no leading ./ or /)
316
+ *
317
+ * @example "src/options.html"
318
+ */
319
+ options_page?: ManifestFilePath<T>;
320
+ /**
321
+ * - Relative to Vite project root (where vite.config.js is)
322
+ * - Format: "subdir/devtools.html" (no leading ./ or /)
323
+ *
324
+ * @example "src/devtools.html"
325
+ */
326
+ devtools_page?: ManifestFilePath<T>;
325
327
  };
326
328
  type ManifestOptions<T extends string> = Omit<ManifestV3, keyof FilePathFields<string>> & FilePathFields<T>;
327
329
  type ManifestV3Options<T extends string = string> = ManifestOptions<T> | Promise<ManifestOptions<T>> | ManifestV3Define<T>;
328
330
  type ManifestV3Define<T extends string> = (env: ConfigEnv) => ManifestOptions<T> | Promise<ManifestOptions<T>>;
329
- declare const defineManifest: <T extends string>(manifest: ManifestV3Options<T>) => ManifestV3Export;
331
+ export declare const defineManifest: <T extends string>(manifest: ManifestV3Options<T>) => ManifestV3Export;
330
332
  /**
331
333
  * Content script resources like CSS and image files must be declared in the
332
334
  * manifest under `web_accessible_resources`. Manifest V3 uses a match pattern
@@ -352,97 +354,101 @@ declare const defineManifest: <T extends string>(manifest: ManifestV3Options<T>)
352
354
  * })
353
355
  * ```
354
356
  */
355
- declare const defineDynamicResource: ({ matches, use_dynamic_url, }: Omit<WebAccessibleResourceByMatch, 'resources'>) => WebAccessibleResourceByMatch;
356
-
357
+ export declare const defineDynamicResource: ({ matches, use_dynamic_url }: Omit<WebAccessibleResourceByMatch, "resources">) => WebAccessibleResourceByMatch;
358
+ //#endregion
359
+ //#region src/node/types.d.ts
357
360
  type CrxDevAssetId = {
358
- id: string;
359
- type: 'asset';
360
- source?: string | Uint8Array;
361
+ id: string;
362
+ type: 'asset';
363
+ source?: string | Uint8Array;
361
364
  };
362
365
  type CrxDevScriptId = {
363
- id: string;
364
- type: 'module' | 'iife';
366
+ id: string;
367
+ type: 'module' | 'iife';
365
368
  };
366
369
  interface CrxPlugin extends Plugin {
367
- /**
368
- * Runs during the transform hook for the manifest. Filenames use input
369
- * filenames.
370
- */
371
- transformCrxManifest?: (this: PluginContext, manifest: ManifestV3) => Promise<ManifestV3 | null | undefined> | ManifestV3 | null | undefined;
372
- /**
373
- * Runs during generateBundle, before manifest output. Filenames use output
374
- * filenames.
375
- */
376
- renderCrxManifest?: (this: PluginContext, manifest: ManifestV3, bundle: OutputBundle) => Promise<ManifestV3 | null | undefined> | ManifestV3 | null | undefined;
377
- /**
378
- * Runs in the file writer on content scripts during development. `script.id`
379
- * is Vite URL format.
380
- */
381
- renderCrxDevScript?: (code: string, script: CrxDevScriptId) => Promise<string | null | undefined> | string | null | undefined;
370
+ /**
371
+ * Runs during the transform hook for the manifest. Filenames use input
372
+ * filenames.
373
+ */
374
+ transformCrxManifest?: (this: PluginContext, manifest: ManifestV3) => Promise<ManifestV3 | null | undefined> | ManifestV3 | null | undefined;
375
+ /**
376
+ * Runs during generateBundle, before manifest output. Filenames use output
377
+ * filenames.
378
+ */
379
+ renderCrxManifest?: (this: PluginContext, manifest: ManifestV3, bundle: OutputBundle) => Promise<ManifestV3 | null | undefined> | ManifestV3 | null | undefined;
380
+ /**
381
+ * Runs in the file writer on content scripts during development. `script.id`
382
+ * is Vite URL format.
383
+ */
384
+ renderCrxDevScript?: (code: string, script: CrxDevScriptId) => Promise<string | null | undefined> | string | null | undefined;
382
385
  }
383
386
  interface CrxOptions {
384
- contentScripts?: {
385
- preambleCode?: string | false;
386
- hmrTimeout?: number;
387
- injectCss?: boolean;
388
- /**
389
- * List of content script files (relative to project root) that should be
390
- * built as standalone IIFE bundles (self-contained, no loader, all imports
391
- * inlined). This allows using normal filenames (without the `.iife.*`
392
- * convention) for IIFE content scripts, e.g. for `world: 'MAIN'` or to
393
- * avoid loader overhead.
394
- *
395
- * The files must still be listed in `manifest.content_scripts` (or used
396
- * via `?script` / `?iife`).
397
- *
398
- * Example:
399
- * crx({
400
- * manifest,
401
- * contentScripts: {
402
- * standaloneFiles: ['src/injected.ts', 'src/another.js']
403
- * }
404
- * })
405
- */
406
- standaloneFiles?: string[];
407
- };
408
- globOptions?: GlobOptions;
409
- /**
410
- * The browser that this extension is targeting, can be "firefox" or "chrome".
411
- * Default is "chrome".
412
- */
413
- browser?: Browser;
387
+ contentScripts?: {
388
+ preambleCode?: string | false;
389
+ hmrTimeout?: number;
390
+ injectCss?: boolean;
414
391
  /**
415
- * Enable automatic extension reload and HMR during development. When false:
416
- *
417
- * - The extension will not call `chrome.runtime.reload()` on background changes
418
- * or dev server reconnection.
419
- * - Content scripts will not receive HMR updates or reload their host pages.
420
- * - Files are still rebuilt and written to the output directory on change.
392
+ * List of content script files (relative to project root) that should be
393
+ * built as standalone IIFE bundles (self-contained, no loader, all imports
394
+ * inlined). This allows using normal filenames (without the `.iife.*`
395
+ * convention) for IIFE content scripts, e.g. for `world: 'MAIN'` or to
396
+ * avoid loader overhead.
421
397
  *
422
- * Use this when content scripts have side effects on injection and you want
423
- * to manually reload the extension in the browser.
398
+ * The files must still be listed in `manifest.content_scripts` (or used
399
+ * via `?script` / `?iife`).
424
400
  *
425
- * Default is `true`.
401
+ * Example:
402
+ * crx({
403
+ * manifest,
404
+ * contentScripts: {
405
+ * standaloneFiles: ['src/injected.ts', 'src/another.js']
406
+ * }
407
+ * })
426
408
  */
427
- liveReload?: boolean;
409
+ standaloneFiles?: string[];
410
+ };
411
+ globOptions?: GlobOptions;
412
+ /**
413
+ * The browser that this extension is targeting, can be "firefox" or "chrome".
414
+ * Default is "chrome".
415
+ */
416
+ browser?: Browser;
417
+ /**
418
+ * Enable automatic extension reload and HMR during development. When false:
419
+ *
420
+ * - The extension will not call `chrome.runtime.reload()` on background changes
421
+ * or dev server reconnection.
422
+ * - Content scripts will not receive HMR updates or reload their host pages.
423
+ * - Files are still rebuilt and written to the output directory on change.
424
+ *
425
+ * Use this when content scripts have side effects on injection and you want
426
+ * to manually reload the extension in the browser.
427
+ *
428
+ * Default is `true`.
429
+ */
430
+ liveReload?: boolean;
428
431
  }
429
432
  type Browser = 'firefox' | 'chrome';
430
-
433
+ //#endregion
434
+ //#region src/node/fileWriter-rxjs.d.ts
431
435
  /** Resolves when all existing files in scriptFiles are written. */
432
- declare function allFilesReady(): Promise<void>;
433
-
436
+ export declare function allFilesReady(): Promise<void>;
437
+ //#endregion
438
+ //#region src/node/fileWriter-utilities.d.ts
434
439
  type FileWriterId = {
435
- type: CrxDevAssetId['type'] | CrxDevScriptId['type'] | 'loader';
436
- id: string;
440
+ type: CrxDevAssetId['type'] | CrxDevScriptId['type'] | 'loader';
441
+ id: string;
437
442
  };
438
443
  /** Resolves when file and dependencies are written. */
439
444
  declare function fileReady(script: FileWriterId): Promise<void>;
440
-
441
- declare const crx: (options: {
442
- manifest: ManifestV3Export;
445
+ //#endregion
446
+ //#region src/node/index.d.ts
447
+ export declare const crx: (options: {
448
+ manifest: ManifestV3Export;
443
449
  } & CrxOptions) => PluginOption[];
444
- declare const chromeExtension: (options: {
445
- manifest: ManifestV3Export;
450
+ export declare const chromeExtension: (options: {
451
+ manifest: ManifestV3Export;
446
452
  } & CrxOptions) => PluginOption[];
447
-
448
- export { CrxPlugin, ManifestV3Export, allFilesReady, chromeExtension, crx, defineDynamicResource, defineManifest, fileReady as filesReady };
453
+ //#endregion
454
+ export { type CrxPlugin, type ManifestV3Export, fileReady as filesReady };