Skip to content

Commit

Permalink
feat: Support browser and chrome styles for mv2 popups
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Jun 25, 2023
1 parent 0f37ceb commit 7abb577
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/utils/__tests__/findEntrypoints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ describe('findEntrypoints', () => {
mode: 'production',
};

beforeEach(() => {
vi.resetAllMocks();
vi.restoreAllMocks();
});

it.each<[string, string, PopupEntrypoint]>([
[
'popup.html',
Expand Down
21 changes: 18 additions & 3 deletions src/utils/findEntrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,26 @@ async function getOptionsEntrypoint(

const content = await fs.readFile(path, 'utf-8');
const { document } = parseHTML(content);
const defaultIconContent = document

const openInTabContent = document
.querySelector("meta[name='manifest.open_in_tab']")
?.getAttribute('content');
if (defaultIconContent) {
options.openInTab = Boolean(defaultIconContent);
if (openInTabContent) {
options.openInTab = Boolean(openInTabContent);
}

const chromeStyleContent = document
.querySelector("meta[name='manifest.chrome_style']")
?.getAttribute('content');
if (chromeStyleContent) {
options.chromeStyle = Boolean(chromeStyleContent);
}

const browserStyleContent = document
.querySelector("meta[name='manifest.browser_style']")
?.getAttribute('content');
if (browserStyleContent) {
options.browserStyle = Boolean(browserStyleContent);
}

return {
Expand Down

0 comments on commit 7abb577

Please sign in to comment.