Skip to content

Conversation

@suveshmoza
Copy link

Overview

Adds support for Firefox's required data_collection_permissions field in browser_specific_settings.gecko. As of November 3rd, 2025, all new Firefox extensions must declare their data collection practices.

Changes

  • Add FirefoxDataCollectionType and FirefoxDataCollectionPermissions TypeScript types
  • Update UserManifest to include data_collection_permissions in browser_specific_settings.gecko
  • Add warning when building for Firefox without data_collection_permissions #specified

Manual Testing

Building the wxt-demo for Firefox will show a warning to add data_collection_permissions to manifest config.

Related Issue

This PR closes #1975

@netlify
Copy link

netlify bot commented Nov 13, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit feed267
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/694114dd3eecad000847c434
😎 Deploy Preview https://deploy-preview-1976--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that devs will see the warning and get mad that the only way to silence it is to add the option. I'd be nervous to do that because I'm not sure if adding, even a blank object, could result in the extension being disabled since the manifest changed in a way that the prompt also changed. I'd like to add a config option to silence this if the dev doesn't want to address it yet.

Thoughts?

@suveshmoza
Copy link
Author

suveshmoza commented Dec 16, 2025

I'm concerned that devs will see the warning and get mad that the only way to silence it is to add the option. I'd be nervous to do that because I'm not sure if adding, even a blank object, could result in the extension being disabled since the manifest changed in a way that the prompt also changed. I'd like to add a config option to silence this if the dev doesn't want to address it yet.

Thoughts?

I agree with your concerns. The warning could frustrate developers, especially those maintaining existing extensions, who are currently exempt but will eventually need to specify these permissions.

Yes, a config option would be nice and could be extended for future warnings. Something like

export default defineConfig({
  suppressWarnings: {
    firefoxDataCollection: true,
  },
  // ... rest of config
});


if (
  wxt.config.browser === 'firefox' &&
  !userManifest.browser_specific_settings?.gecko?.data_collection_permissions &&
  !wxt.config.suppressWarnings?.firefoxDataCollection //using config option here to silence warning
)

@suveshmoza suveshmoza force-pushed the feat/firefox-data-collection-permissions branch from 54a2c71 to feed267 Compare December 16, 2025 08:14
Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suppressWarnings - I like that naming, lets add it!

Needs to be added in 2 places:

  1. User facing config type:

    export interface InlineConfig {
    /**
    * Your project's root directory containing the `package.json` used to fill out the
    * `manifest.json`.
    *
    * @default process.cwd()
    */
    root?: string;
    /**
    * Directory containing all source code. Set to `"src"` to move all source code to a `src/`
    * directory.
    *
    * After changing, don't forget to move the `public/` and `entrypoints/` directories into the new
    * source dir.
    *
    * @default config.root
    */
    srcDir?: string;
    /**
    * Directory containing files that will be copied to the output directory as-is.
    *
    * @default "${config.root}/public"
    */
    publicDir?: string;
    /**
    * @default "${config.srcDir}/entrypoints"
    */
    entrypointsDir?: string;
    /**
    * @default "${config.root}/modules"
    */
    modulesDir?: string;
    /**
    * A list of entrypoint names (`"popup"`, `"options"`, etc.) to build. Will speed up the build if
    * your extension has lots of entrypoints, and you don't need to build all of them to develop a
    * feature.
    * If specified, this completely overrides the `include`/`exclude` option provided per-entrypoint.
    */
    filterEntrypoints?: string[];
    /**
    * Output directory that stored build folders and ZIPs.
    *
    * @default ".output"
    */
    outDir?: string;
    /**
    * Template string for customizing the output directory structure.
    * Available variables:
    * - <span v-pre>`{{browser}}`</span>: The target browser (e.g., 'chrome', 'firefox')
    * - <span v-pre>`{{manifestVersion}}`</span>: The manifest version (e.g., 2 or 3)
    * - <span v-pre>`{{mode}}`</span>: The build mode (e.g., 'development', 'production')
    * - <span v-pre>`{{modeSuffix}}`</span>: A suffix based on the mode ('-dev' for development, '' for production)
    * - <span v-pre>`{{command}}`</span>: The WXT command being run (e.g., 'build', 'serve')
    *
    * @example "{{browser}}-mv{{manifestVersion}}"
    * @default <span v-pre>`"{{browser}}-mv{{manifestVersion}}{{modeSuffix}}"`</span>
    */
    outDirTemplate?: string;
    /**
    * > Only available when using the JS API. Not available in `wxt.config.ts` files
    *
    * Path to `wxt.config.ts` file or `false` to disable config file discovery.
    *
    * @default "wxt.config.ts"
    */
    configFile?: string | false;
    /**
    * Set to `true` to show debug logs. Overridden by the command line `--debug` option.
    *
    * @default false
    */
    debug?: boolean;
    /**
    * Explicitly set a mode to run in. This will override the default mode for each command, and can
    * be overridden by the command line `--mode` option.
    */
    mode?: string;
    /**
    * Customize auto-import options. Set to `false` to disable auto-imports.
    *
    * For example, to add a directory to auto-import from, you can use:
    *
    * ```ts
    * export default defineConfig({
    * imports: {
    * dirs: ["some-directory"]
    * }
    * })
    * ```
    */
    imports?: WxtUnimportOptions | false;
    /**
    * Explicitly set a browser to build for. This will override the default browser for each command,
    * and can be overridden by the command line `--browser` option.
    *
    * @default
    * "chrome"
    */
    browser?: TargetBrowser;
    /**
    * Target browsers to support. When set, `import.meta.env.BROWSER` will be narrowed to a string literal type containing only the specified browser names.
    *
    * @default []
    */
    targetBrowsers?: TargetBrowser[];
    /**
    * Explicitly set a manifest version to target. This will override the default manifest version
    * for each command, and can be overridden by the command line `--mv2` or `--mv3` option.
    */
    manifestVersion?: TargetManifestVersion;
    /**
    * Override the logger used.
    *
    * @default
    * consola
    */
    logger?: Logger;
    /**
    * Customize the `manifest.json` output. Can be an object, promise, or function that returns an
    * object or promise.
    */
    manifest?: UserManifest | Promise<UserManifest> | UserManifestFn;
    /**
    * Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file.
    */
    webExt?: WebExtConfig;
    /**
    * @deprecated Use `webExt` instead. Same option, just renamed.
    */
    runner?: WebExtConfig;
    zip?: {
    /**
    * Configure the filename output when zipping files.
    *
    * Available template variables:
    *
    * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
    * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
    * - <span v-pre>`{{packageVersion}}`</span> - The version from the package.json
    * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
    * - <span v-pre>`{{mode}}`</span> - The current mode
    * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
    *
    * @default "{{name}}-{{version}}-{{browser}}.zip"
    */
    artifactTemplate?: string;
    /**
    * When zipping the extension, also zip sources.
    *
    * - `undefined`: zip sources if the target browser is "firefox" or "opera"
    * - `true`: always zip sources
    * - `false`: never zip sources
    *
    * @default undefined
    */
    zipSources?: boolean;
    /**
    * Configure the filename output when zipping files.
    *
    * Available template variables:
    *
    * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
    * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
    * - <span v-pre>`{{packageVersion}}`</span> - The version from the package.json
    * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
    * - <span v-pre>`{{mode}}`</span> - The current mode
    * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
    *
    * @default "{{name}}-{{version}}-sources.zip"
    */
    sourcesTemplate?: string;
    /**
    * Override the artifactTemplate's `{name}` template variable. Defaults to the `package.json`'s
    * name, or if that doesn't exist, the current working directories name.
    */
    name?: string;
    /**
    * Root directory to ZIP when generating the sources ZIP.
    *
    * @default config.root
    */
    sourcesRoot?: string;
    /**
    * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to include when
    * creating a ZIP of all your source code for Firefox. Patterns are relative to your
    * `config.zip.sourcesRoot`.
    *
    * This setting overrides `excludeSources`. So if a file matches both lists, it is included in the ZIP.
    *
    * @example
    * [
    * "coverage", // Include the coverage directory in the `sourcesRoot`
    * ]
    */
    includeSources?: string[];
    /**
    * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
    * creating a ZIP of all your source code for Firefox. Patterns are relative to your
    * `config.zip.sourcesRoot`.
    *
    * Hidden files, node_modules, and tests are ignored by default.
    *
    * @example
    * [
    * "coverage", // Ignore the coverage directory in the `sourcesRoot`
    * ]
    */
    excludeSources?: string[];
    /**
    * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
    * zipping the extension.
    *
    * @example
    * [
    * "**\/*.map", // Exclude all sourcemaps
    * ]
    */
    exclude?: string[];
    /**
    * The Firefox review process requires the extension be buildable from source to make reviewing
    * easier. This field allows you to use private packages without exposing your auth tokens.
    *
    * Just list the name of all the packages you want to download and include in the sources zip.
    * Usually, these will be private packages behind auth tokens, but they don't have to be.
    *
    * All packages listed here will be downloaded to in `.wxt/local_modules/` and an `overrides` or
    * `resolutions` field (depending on your package manager) will be added to the `package.json`,
    * pointing to the downloaded packages.
    *
    * > ***DO NOT include versions or version filters.*** Just the package name. If multiple
    * > versions of a package are present in the project, all versions will be downloaded and
    * > referenced in the package.json correctly.
    *
    * @default []
    *
    * @example
    * // Correct:
    * ["@scope/package-name", "package-name"]
    *
    * // Incorrect, don't include versions!!!
    * ["@scope/[email protected]", "package-name@^2"]
    */
    downloadPackages?: string[];
    /**
    * Compression level to use when zipping files.
    *
    * Levels: 0 (no compression) to 9 (maximum compression).
    *
    * @default 9
    */
    compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    };
    analysis?: {
    /**
    * Explicitly include bundle analysis when running `wxt build`. This can be overridden by the
    * command line `--analyze` option.
    *
    * @default false
    */
    enabled?: boolean;
    /**
    * Set to true to automatically open the `stats.html` file when the build is finished. When building in CI, the browser will never open.
    *
    * @default false
    */
    open?: boolean;
    /**
    * When running `wxt build --analyze` or setting `analysis.enabled` to true, customize how the
    * bundle will be visualized. See
    * [`rollup-plugin-visualizer`](https://github.com/btd/rollup-plugin-visualizer#how-to-use-generated-files)
    * for more details.
    *
    * @default "treemap"
    */
    template?: PluginVisualizerOptions['template'];
    /**
    * Name of the output HTML file. Relative to the project's root directory.
    *
    * Changing the filename of the outputFile also effects the names of the artifacts generated
    * when setting `keepArtifacts` to true:
    * - "stats.html" => "stats-*.json"
    * - "stats/bundle.html" => "bundle-*.json"
    * - ".analysis/index.html" => "index-*.json"
    *
    * @default "stats.html"
    */
    outputFile?: string;
    /**
    * By default, the `stats-*.json` artifacts generated during bundle analysis are deleted. Set to
    * `true` to keep them.
    *
    * One stats file is output per build step.
    *
    * @default false
    */
    keepArtifacts?: boolean;
    };
    /**
    * Add additional paths to the `.wxt/tsconfig.json`. Use this instead of overwriting the `paths`
    * in the root `tsconfig.json` if you want to add new paths.
    *
    * The key is the import alias and the value is either a relative path to the root directory or an absolute path.
    *
    * @example
    * {
    * "testing": "src/utils/testing.ts"
    * }
    */
    alias?: Record<string, string>;
    /**
    * Experimental settings - use with caution.
    */
    experimental?: {};
    /**
    * Config effecting dev mode only.
    */
    dev?: {
    server?: {
    /**
    * Host to bind the dev server to.
    *
    * @default "localhost"
    */
    host?: string;
    /**
    * Port to run the dev server on. Defaults to the first open port from 3000 to 3010.
    */
    port?: number;
    /**
    * Origin to use to connect from the extension ui runtime to the dev server.
    *
    * @default "http://localhost:3000"
    */
    origin?: string;
    /**
    * Hostname to run the dev server on.
    *
    * @deprecated use `host` to specify the interface to bind to, or use `origin` to specify the dev server hostname.
    */
    hostname?: string;
    };
    /**
    * Controls whether a custom keyboard shortcut command, `Alt+R`, is added during dev mode to
    * quickly reload the extension.
    *
    * If false, the shortcut is not added during development.
    *
    * If set to a custom string, you can override the key combo used. See
    * [Chrome's command docs](https://developer.chrome.com/docs/extensions/reference/api/commands)
    * for available options.
    *
    * @default "Alt+R"
    */
    reloadCommand?: string | false;
    };
    /**
    * Project hooks for running logic during the build process.
    */
    hooks?: NestedHooks<WxtHooks>;
    /**
    * List of WXT module names to include. Can be the full package name
    * ("wxt-module-analytics"), or just the suffix ("analytics" would resolve to
    * "wxt-module-analytics").
    */
    modules?: string[];
    }

    Everything needs to be optional

  2. Internal config type:

    wxt/packages/wxt/src/types.ts

    Lines 1288 to 1403 in 223cf86

    export interface ResolvedConfig {
    root: string;
    srcDir: string;
    publicDir: string;
    /**
    * Absolute path pointing to `.wxt` directory in project root.
    * @example
    * "/path/to/project/.wxt"
    */
    wxtDir: string;
    typesDir: string;
    entrypointsDir: string;
    modulesDir: string;
    filterEntrypoints?: Set<string>;
    /**
    * Absolute path to the `.output` directory
    * @example
    * "/path/to/project/.output"
    */
    outBaseDir: string;
    /**
    * Absolute path to the target output directory.
    * @example
    * "/path/to/project/.output/chrome-mv3"
    */
    outDir: string;
    debug: boolean;
    /**
    * Absolute path pointing to the `node_modules/wxt` directory, wherever WXT is installed.
    */
    wxtModuleDir: string;
    mode: string;
    command: WxtCommand;
    browser: TargetBrowser;
    targetBrowsers: TargetBrowser[];
    manifestVersion: TargetManifestVersion;
    env: ConfigEnv;
    logger: Logger;
    imports: WxtResolvedUnimportOptions;
    manifest: UserManifest;
    fsCache: FsCache;
    runnerConfig: C12ResolvedConfig<WebExtConfig>;
    zip: {
    name?: string;
    artifactTemplate: string;
    sourcesTemplate: string;
    includeSources: string[];
    excludeSources: string[];
    sourcesRoot: string;
    downloadedPackagesDir: string;
    downloadPackages: string[];
    compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    exclude: string[];
    /**
    * If true, when zipping the extension, also zip the sources.
    */
    zipSources: boolean;
    };
    analysis: {
    enabled: boolean;
    open: boolean;
    template: NonNullable<PluginVisualizerOptions['template']>;
    /** Absolute file path to the `stats.html` file */
    outputFile: string;
    /** The directory where the final `stats.html` file is located */
    outputDir: string;
    /** Name of the `stats.html` file, minus ".html" */
    outputName: string;
    keepArtifacts: boolean;
    };
    userConfigMetadata: Omit<C12ResolvedConfig<UserConfig>, 'config'>;
    /**
    * Import aliases to absolute paths.
    */
    alias: Record<string, string>;
    experimental: {};
    dev: {
    /** Only defined during dev command */
    server?: {
    host: string;
    port: number;
    origin: string;
    /**
    * The milliseconds to debounce when a file is saved before reloading.
    * The only way to set this option is to set the `WXT_WATCH_DEBOUNCE`
    * environment variable, either globally (like in `.bashrc` file) or
    * per-project (in `.env` file).
    *
    * For example:
    * ```
    * # ~/.zshrc
    * export WXT_WATCH_DEBOUNCE=1000
    * ```
    * or
    * ```
    * # .env
    * WXT_WATCH_DEBOUNCE=1000
    * ```
    * @default 800
    */
    watchDebounce: number;
    };
    reloadCommand: string | false;
    };
    hooks: NestedHooks<WxtHooks>;
    builtinModules: WxtModule<any>[];
    userModules: WxtModuleWithMetadata<any>[];
    /**
    * An array of string to import plugins from. These paths should be
    * resolvable by vite, and they should `export default defineWxtPlugin(...)`.
    *
    * @example
    * ["@wxt-dev/module-vue/plugin", "wxt-module-google-analytics/plugin"]
    */
    plugins: string[];
    }

    Everything is required.

  3. Map the user config to the resolved config:

    export async function resolveConfig(

    You should see a type error in this file after changing the types.

Then we can also a message to the warning about how to set the config to suppress the warning.

@suveshmoza
Copy link
Author

suppressWarnings - I like that naming, lets add it!

Needs to be added in 2 places:

  1. User facing config type:

    export interface InlineConfig {
    /**
    * Your project's root directory containing the `package.json` used to fill out the
    * `manifest.json`.
    *
    * @default process.cwd()
    */
    root?: string;
    /**
    * Directory containing all source code. Set to `"src"` to move all source code to a `src/`
    * directory.
    *
    * After changing, don't forget to move the `public/` and `entrypoints/` directories into the new
    * source dir.
    *
    * @default config.root
    */
    srcDir?: string;
    /**
    * Directory containing files that will be copied to the output directory as-is.
    *
    * @default "${config.root}/public"
    */
    publicDir?: string;
    /**
    * @default "${config.srcDir}/entrypoints"
    */
    entrypointsDir?: string;
    /**
    * @default "${config.root}/modules"
    */
    modulesDir?: string;
    /**
    * A list of entrypoint names (`"popup"`, `"options"`, etc.) to build. Will speed up the build if
    * your extension has lots of entrypoints, and you don't need to build all of them to develop a
    * feature.
    * If specified, this completely overrides the `include`/`exclude` option provided per-entrypoint.
    */
    filterEntrypoints?: string[];
    /**
    * Output directory that stored build folders and ZIPs.
    *
    * @default ".output"
    */
    outDir?: string;
    /**
    * Template string for customizing the output directory structure.
    * Available variables:
    * - <span v-pre>`{{browser}}`</span>: The target browser (e.g., 'chrome', 'firefox')
    * - <span v-pre>`{{manifestVersion}}`</span>: The manifest version (e.g., 2 or 3)
    * - <span v-pre>`{{mode}}`</span>: The build mode (e.g., 'development', 'production')
    * - <span v-pre>`{{modeSuffix}}`</span>: A suffix based on the mode ('-dev' for development, '' for production)
    * - <span v-pre>`{{command}}`</span>: The WXT command being run (e.g., 'build', 'serve')
    *
    * @example "{{browser}}-mv{{manifestVersion}}"
    * @default <span v-pre>`"{{browser}}-mv{{manifestVersion}}{{modeSuffix}}"`</span>
    */
    outDirTemplate?: string;
    /**
    * > Only available when using the JS API. Not available in `wxt.config.ts` files
    *
    * Path to `wxt.config.ts` file or `false` to disable config file discovery.
    *
    * @default "wxt.config.ts"
    */
    configFile?: string | false;
    /**
    * Set to `true` to show debug logs. Overridden by the command line `--debug` option.
    *
    * @default false
    */
    debug?: boolean;
    /**
    * Explicitly set a mode to run in. This will override the default mode for each command, and can
    * be overridden by the command line `--mode` option.
    */
    mode?: string;
    /**
    * Customize auto-import options. Set to `false` to disable auto-imports.
    *
    * For example, to add a directory to auto-import from, you can use:
    *
    * ```ts
    * export default defineConfig({
    * imports: {
    * dirs: ["some-directory"]
    * }
    * })
    * ```
    */
    imports?: WxtUnimportOptions | false;
    /**
    * Explicitly set a browser to build for. This will override the default browser for each command,
    * and can be overridden by the command line `--browser` option.
    *
    * @default
    * "chrome"
    */
    browser?: TargetBrowser;
    /**
    * Target browsers to support. When set, `import.meta.env.BROWSER` will be narrowed to a string literal type containing only the specified browser names.
    *
    * @default []
    */
    targetBrowsers?: TargetBrowser[];
    /**
    * Explicitly set a manifest version to target. This will override the default manifest version
    * for each command, and can be overridden by the command line `--mv2` or `--mv3` option.
    */
    manifestVersion?: TargetManifestVersion;
    /**
    * Override the logger used.
    *
    * @default
    * consola
    */
    logger?: Logger;
    /**
    * Customize the `manifest.json` output. Can be an object, promise, or function that returns an
    * object or promise.
    */
    manifest?: UserManifest | Promise<UserManifest> | UserManifestFn;
    /**
    * Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file.
    */
    webExt?: WebExtConfig;
    /**
    * @deprecated Use `webExt` instead. Same option, just renamed.
    */
    runner?: WebExtConfig;
    zip?: {
    /**
    * Configure the filename output when zipping files.
    *
    * Available template variables:
    *
    * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
    * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
    * - <span v-pre>`{{packageVersion}}`</span> - The version from the package.json
    * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
    * - <span v-pre>`{{mode}}`</span> - The current mode
    * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
    *
    * @default "{{name}}-{{version}}-{{browser}}.zip"
    */
    artifactTemplate?: string;
    /**
    * When zipping the extension, also zip sources.
    *
    * - `undefined`: zip sources if the target browser is "firefox" or "opera"
    * - `true`: always zip sources
    * - `false`: never zip sources
    *
    * @default undefined
    */
    zipSources?: boolean;
    /**
    * Configure the filename output when zipping files.
    *
    * Available template variables:
    *
    * - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
    * - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
    * - <span v-pre>`{{packageVersion}}`</span> - The version from the package.json
    * - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
    * - <span v-pre>`{{mode}}`</span> - The current mode
    * - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
    *
    * @default "{{name}}-{{version}}-sources.zip"
    */
    sourcesTemplate?: string;
    /**
    * Override the artifactTemplate's `{name}` template variable. Defaults to the `package.json`'s
    * name, or if that doesn't exist, the current working directories name.
    */
    name?: string;
    /**
    * Root directory to ZIP when generating the sources ZIP.
    *
    * @default config.root
    */
    sourcesRoot?: string;
    /**
    * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to include when
    * creating a ZIP of all your source code for Firefox. Patterns are relative to your
    * `config.zip.sourcesRoot`.
    *
    * This setting overrides `excludeSources`. So if a file matches both lists, it is included in the ZIP.
    *
    * @example
    * [
    * "coverage", // Include the coverage directory in the `sourcesRoot`
    * ]
    */
    includeSources?: string[];
    /**
    * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
    * creating a ZIP of all your source code for Firefox. Patterns are relative to your
    * `config.zip.sourcesRoot`.
    *
    * Hidden files, node_modules, and tests are ignored by default.
    *
    * @example
    * [
    * "coverage", // Ignore the coverage directory in the `sourcesRoot`
    * ]
    */
    excludeSources?: string[];
    /**
    * [Minimatch](https://www.npmjs.com/package/minimatch) patterns of files to exclude when
    * zipping the extension.
    *
    * @example
    * [
    * "**\/*.map", // Exclude all sourcemaps
    * ]
    */
    exclude?: string[];
    /**
    * The Firefox review process requires the extension be buildable from source to make reviewing
    * easier. This field allows you to use private packages without exposing your auth tokens.
    *
    * Just list the name of all the packages you want to download and include in the sources zip.
    * Usually, these will be private packages behind auth tokens, but they don't have to be.
    *
    * All packages listed here will be downloaded to in `.wxt/local_modules/` and an `overrides` or
    * `resolutions` field (depending on your package manager) will be added to the `package.json`,
    * pointing to the downloaded packages.
    *
    * > ***DO NOT include versions or version filters.*** Just the package name. If multiple
    * > versions of a package are present in the project, all versions will be downloaded and
    * > referenced in the package.json correctly.
    *
    * @default []
    *
    * @example
    * // Correct:
    * ["@scope/package-name", "package-name"]
    *
    * // Incorrect, don't include versions!!!
    * ["@scope/[email protected]", "package-name@^2"]
    */
    downloadPackages?: string[];
    /**
    * Compression level to use when zipping files.
    *
    * Levels: 0 (no compression) to 9 (maximum compression).
    *
    * @default 9
    */
    compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    };
    analysis?: {
    /**
    * Explicitly include bundle analysis when running `wxt build`. This can be overridden by the
    * command line `--analyze` option.
    *
    * @default false
    */
    enabled?: boolean;
    /**
    * Set to true to automatically open the `stats.html` file when the build is finished. When building in CI, the browser will never open.
    *
    * @default false
    */
    open?: boolean;
    /**
    * When running `wxt build --analyze` or setting `analysis.enabled` to true, customize how the
    * bundle will be visualized. See
    * [`rollup-plugin-visualizer`](https://github.com/btd/rollup-plugin-visualizer#how-to-use-generated-files)
    * for more details.
    *
    * @default "treemap"
    */
    template?: PluginVisualizerOptions['template'];
    /**
    * Name of the output HTML file. Relative to the project's root directory.
    *
    * Changing the filename of the outputFile also effects the names of the artifacts generated
    * when setting `keepArtifacts` to true:
    * - "stats.html" => "stats-*.json"
    * - "stats/bundle.html" => "bundle-*.json"
    * - ".analysis/index.html" => "index-*.json"
    *
    * @default "stats.html"
    */
    outputFile?: string;
    /**
    * By default, the `stats-*.json` artifacts generated during bundle analysis are deleted. Set to
    * `true` to keep them.
    *
    * One stats file is output per build step.
    *
    * @default false
    */
    keepArtifacts?: boolean;
    };
    /**
    * Add additional paths to the `.wxt/tsconfig.json`. Use this instead of overwriting the `paths`
    * in the root `tsconfig.json` if you want to add new paths.
    *
    * The key is the import alias and the value is either a relative path to the root directory or an absolute path.
    *
    * @example
    * {
    * "testing": "src/utils/testing.ts"
    * }
    */
    alias?: Record<string, string>;
    /**
    * Experimental settings - use with caution.
    */
    experimental?: {};
    /**
    * Config effecting dev mode only.
    */
    dev?: {
    server?: {
    /**
    * Host to bind the dev server to.
    *
    * @default "localhost"
    */
    host?: string;
    /**
    * Port to run the dev server on. Defaults to the first open port from 3000 to 3010.
    */
    port?: number;
    /**
    * Origin to use to connect from the extension ui runtime to the dev server.
    *
    * @default "http://localhost:3000"
    */
    origin?: string;
    /**
    * Hostname to run the dev server on.
    *
    * @deprecated use `host` to specify the interface to bind to, or use `origin` to specify the dev server hostname.
    */
    hostname?: string;
    };
    /**
    * Controls whether a custom keyboard shortcut command, `Alt+R`, is added during dev mode to
    * quickly reload the extension.
    *
    * If false, the shortcut is not added during development.
    *
    * If set to a custom string, you can override the key combo used. See
    * [Chrome's command docs](https://developer.chrome.com/docs/extensions/reference/api/commands)
    * for available options.
    *
    * @default "Alt+R"
    */
    reloadCommand?: string | false;
    };
    /**
    * Project hooks for running logic during the build process.
    */
    hooks?: NestedHooks<WxtHooks>;
    /**
    * List of WXT module names to include. Can be the full package name
    * ("wxt-module-analytics"), or just the suffix ("analytics" would resolve to
    * "wxt-module-analytics").
    */
    modules?: string[];
    }

    Everything needs to be optional

  2. Internal config type:

    wxt/packages/wxt/src/types.ts

    Lines 1288 to 1403 in 223cf86

    export interface ResolvedConfig {
    root: string;
    srcDir: string;
    publicDir: string;
    /**
    * Absolute path pointing to `.wxt` directory in project root.
    * @example
    * "/path/to/project/.wxt"
    */
    wxtDir: string;
    typesDir: string;
    entrypointsDir: string;
    modulesDir: string;
    filterEntrypoints?: Set<string>;
    /**
    * Absolute path to the `.output` directory
    * @example
    * "/path/to/project/.output"
    */
    outBaseDir: string;
    /**
    * Absolute path to the target output directory.
    * @example
    * "/path/to/project/.output/chrome-mv3"
    */
    outDir: string;
    debug: boolean;
    /**
    * Absolute path pointing to the `node_modules/wxt` directory, wherever WXT is installed.
    */
    wxtModuleDir: string;
    mode: string;
    command: WxtCommand;
    browser: TargetBrowser;
    targetBrowsers: TargetBrowser[];
    manifestVersion: TargetManifestVersion;
    env: ConfigEnv;
    logger: Logger;
    imports: WxtResolvedUnimportOptions;
    manifest: UserManifest;
    fsCache: FsCache;
    runnerConfig: C12ResolvedConfig<WebExtConfig>;
    zip: {
    name?: string;
    artifactTemplate: string;
    sourcesTemplate: string;
    includeSources: string[];
    excludeSources: string[];
    sourcesRoot: string;
    downloadedPackagesDir: string;
    downloadPackages: string[];
    compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    exclude: string[];
    /**
    * If true, when zipping the extension, also zip the sources.
    */
    zipSources: boolean;
    };
    analysis: {
    enabled: boolean;
    open: boolean;
    template: NonNullable<PluginVisualizerOptions['template']>;
    /** Absolute file path to the `stats.html` file */
    outputFile: string;
    /** The directory where the final `stats.html` file is located */
    outputDir: string;
    /** Name of the `stats.html` file, minus ".html" */
    outputName: string;
    keepArtifacts: boolean;
    };
    userConfigMetadata: Omit<C12ResolvedConfig<UserConfig>, 'config'>;
    /**
    * Import aliases to absolute paths.
    */
    alias: Record<string, string>;
    experimental: {};
    dev: {
    /** Only defined during dev command */
    server?: {
    host: string;
    port: number;
    origin: string;
    /**
    * The milliseconds to debounce when a file is saved before reloading.
    * The only way to set this option is to set the `WXT_WATCH_DEBOUNCE`
    * environment variable, either globally (like in `.bashrc` file) or
    * per-project (in `.env` file).
    *
    * For example:
    * ```
    * # ~/.zshrc
    * export WXT_WATCH_DEBOUNCE=1000
    * ```
    * or
    * ```
    * # .env
    * WXT_WATCH_DEBOUNCE=1000
    * ```
    * @default 800
    */
    watchDebounce: number;
    };
    reloadCommand: string | false;
    };
    hooks: NestedHooks<WxtHooks>;
    builtinModules: WxtModule<any>[];
    userModules: WxtModuleWithMetadata<any>[];
    /**
    * An array of string to import plugins from. These paths should be
    * resolvable by vite, and they should `export default defineWxtPlugin(...)`.
    *
    * @example
    * ["@wxt-dev/module-vue/plugin", "wxt-module-google-analytics/plugin"]
    */
    plugins: string[];
    }

    Everything is required.

  3. Map the user config to the resolved config:

    export async function resolveConfig(

    You should see a type error in this file after changing the types.

Then we can also a message to the warning about how to set the config to suppress the warning.

Should I include this with current PR or create a separate one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Firefox data collection permissions

2 participants