From 7abb577254e1db2849fff48cc157937957336f5e Mon Sep 17 00:00:00 2001 From: Aaron Klinker Date: Sat, 24 Jun 2023 19:33:26 -0500 Subject: [PATCH] feat: Support browser and chrome styles for mv2 popups --- src/utils/__tests__/findEntrypoints.test.ts | 5 ----- src/utils/findEntrypoints.ts | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/utils/__tests__/findEntrypoints.test.ts b/src/utils/__tests__/findEntrypoints.test.ts index 4935f0cc..fb5519a5 100644 --- a/src/utils/__tests__/findEntrypoints.test.ts +++ b/src/utils/__tests__/findEntrypoints.test.ts @@ -43,11 +43,6 @@ describe('findEntrypoints', () => { mode: 'production', }; - beforeEach(() => { - vi.resetAllMocks(); - vi.restoreAllMocks(); - }); - it.each<[string, string, PopupEntrypoint]>([ [ 'popup.html', diff --git a/src/utils/findEntrypoints.ts b/src/utils/findEntrypoints.ts index ec7ca5c4..42692292 100644 --- a/src/utils/findEntrypoints.ts +++ b/src/utils/findEntrypoints.ts @@ -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 {