Skip to content

Commit e7727f5

Browse files
committed
feat: add default_state option to popup entrypoints
1 parent a87d3e4 commit e7727f5

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

packages/browser/src/gen/index.d.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/wxt/src/core/utils/__tests__/manifest.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('Manifest Utils', () => {
4343
'16': '/icon/16.png',
4444
},
4545
defaultTitle: 'Default Iitle',
46+
defaultState: 'enabled',
4647
},
4748
outputDir: outDir,
4849
skipped: false,
@@ -62,6 +63,7 @@ describe('Manifest Utils', () => {
6263
action: {
6364
default_icon: popup.options.defaultIcon,
6465
default_title: popup.options.defaultTitle,
66+
default_state: popup.options.defaultState,
6567
default_popup: 'popup.html',
6668
},
6769
};
@@ -95,6 +97,7 @@ describe('Manifest Utils', () => {
9597
const expected = {
9698
default_icon: popup.options.defaultIcon,
9799
default_title: popup.options.defaultTitle,
100+
default_state: popup.options.defaultState,
98101
default_popup: 'popup.html',
99102
};
100103

packages/wxt/src/core/utils/manifest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ function addEntrypoints(
278278
options.default_icon = popup.options.defaultIcon;
279279
if (popup.options.defaultTitle)
280280
options.default_title = popup.options.defaultTitle;
281+
if (popup.options.defaultState)
282+
options.default_state = popup.options.defaultState;
281283
if (popup.options.browserStyle)
282284
// @ts-expect-error: Not typed by @wxt-dev/browser, but supported by Firefox
283285
options.browser_style = popup.options.browserStyle;

packages/wxt/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ export interface PopupEntrypointOptions extends BaseEntrypointOptions {
655655
mv2Key?: PerBrowserOption<'browser_action' | 'page_action'>;
656656
defaultIcon?: Record<string, string>;
657657
defaultTitle?: PerBrowserOption<string>;
658+
defaultState?: PerBrowserOption<'enabled' | 'disabled'>;
658659
browserStyle?: PerBrowserOption<boolean>;
659660
}
660661

0 commit comments

Comments
 (0)