Skip to content

Commit

Permalink
feat: Use @types/chrome for config manifest type (#969)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Sep 3, 2024
1 parent 143b5ac commit abe1263
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/wxt/e2e/tests/user-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('User Config', () => {
);

await project.build({
// @ts-expect-error: Specifically setting an invalid field for the test - it should show up in the snapshot
// Specifically setting an invalid field for the test - it should show up in the snapshot
manifest: ({ manifestVersion, command }) => ({
example_customization: [String(manifestVersion), command],
}),
Expand Down
5 changes: 1 addition & 4 deletions packages/wxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"prepack": "pnpm build"
},
"dependencies": {
"@types/chrome": "^0.0.269",
"@aklinker1/rollup-plugin-visualizer": "5.12.0",
"@types/webextension-polyfill": "^0.10.7",
"@webext-core/fake-browser": "^1.3.1",
Expand Down Expand Up @@ -128,7 +129,6 @@
"devDependencies": {
"@aklinker1/check": "^1.4.5",
"@faker-js/faker": "^8.4.1",
"@types/chrome": "^0.0.269",
"@types/fs-extra": "^11.0.4",
"@types/lodash.merge": "^4.6.9",
"@types/natural-compare": "^1.4.3",
Expand All @@ -147,9 +147,6 @@
"vitest": "^2.0.4",
"vitest-plugin-random-seed": "^1.1.0"
},
"peerDependencies": {
"@types/chrome": "*"
},
"peerDependenciesMeta": {
"@types/chrome": {
"optional": true
Expand Down
32 changes: 30 additions & 2 deletions packages/wxt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,8 @@ export type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
*/
export type UserManifest = Partial<
Omit<
Manifest.WebExtensionManifest,
chrome.runtime.ManifestV3,
| 'action'
| 'background'
| 'chrome_url_overrides'
| 'devtools_page'
Expand All @@ -841,7 +842,34 @@ export type UserManifest = Partial<
| 'options_ui'
| 'sandbox'
>
>;
> & {
// Add any Browser-specific or MV2 properties that WXT supports here
action?: chrome.runtime.ManifestV3['action'] & {
browser_style?: boolean;
};
browser_action?: chrome.runtime.ManifestV2['browser_action'] & {
browser_style?: boolean;
};
page_action?: chrome.runtime.ManifestV2['page_action'] & {
browser_style?: boolean;
};
browser_specific_settings?: {
gecko?: {
id?: string;
strict_min_version?: string;
strict_max_version?: string;
update_url?: string;
};
gecko_android?: {
strict_min_version?: string;
strict_max_version?: string;
};
safari?: {
strict_min_version?: string;
strict_max_version?: string;
};
};
};

export type UserManifestFn = (
env: ConfigEnv,
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit abe1263

Please sign in to comment.