@crxjs/vite-plugin 2.3.0 → 2.5.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/client.d.ts CHANGED
@@ -43,6 +43,21 @@ declare module '*?script&iife' {
43
43
  export default fileName
44
44
  }
45
45
 
46
+ declare module '*?iife' {
47
+ /**
48
+ * Alias for `*?script&iife`.
49
+ *
50
+ * Script format is IIFE. Use for content scripts with opaque origins.
51
+ *
52
+ * Exports the file name of the output script file.
53
+ *
54
+ * If imported inside a content script, RPCE will include the file name in
55
+ * `web_accessible_resources`.
56
+ */
57
+ const fileName: string
58
+ export default fileName
59
+ }
60
+
46
61
  declare module '*?script&module' {
47
62
  /**
48
63
  * Script format is ESM. No loader and no HMR. Does not support frameworks
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ConfigEnv, Plugin, PluginOption } from 'vite';
2
2
  import { IsStringLiteral } from 'type-fest';
3
- import { Options } from 'fast-glob';
3
+ import { GlobOptions } from 'tinyglobby';
4
4
  import { PluginContext, OutputBundle } from 'rollup';
5
5
 
6
6
  interface DeclarativeNetRequestResource {
@@ -203,7 +203,29 @@ interface ManifestV3 {
203
203
  update_url?: string | undefined;
204
204
  version_name?: string | undefined;
205
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
+ };
225
+ } | undefined;
206
226
  }
227
+ type GeckoPermissionsRequired = "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "none";
228
+ type GeckoPermissionsOptional = "personallyIdentifyingInfo" | "healthInfo" | "financialAndPaymentInfo" | "authenticationInfo" | "personalCommunications" | "locationInfo" | "browsingActivity" | "websiteContent" | "websiteActivity" | "searchTerms" | "bookmarksInfo" | "technicalAndInteraction";
207
229
 
208
230
  type ManifestV3Fn = (env: ConfigEnv) => ManifestV3 | Promise<ManifestV3>;
209
231
  type ManifestV3Export = ManifestV3 | Promise<ManifestV3> | ManifestV3Fn;
@@ -363,13 +385,46 @@ interface CrxOptions {
363
385
  preambleCode?: string | false;
364
386
  hmrTimeout?: number;
365
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[];
366
407
  };
367
- fastGlobOptions?: Options;
408
+ globOptions?: GlobOptions;
368
409
  /**
369
410
  * The browser that this extension is targeting, can be "firefox" or "chrome".
370
411
  * Default is "chrome".
371
412
  */
372
413
  browser?: Browser;
414
+ /**
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.
421
+ *
422
+ * Use this when content scripts have side effects on injection and you want
423
+ * to manually reload the extension in the browser.
424
+ *
425
+ * Default is `true`.
426
+ */
427
+ liveReload?: boolean;
373
428
  }
374
429
  type Browser = 'firefox' | 'chrome';
375
430