-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update-dependency-specificity
- Loading branch information
Showing
22 changed files
with
489 additions
and
1,047 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{ | ||
"extends": "@parcel/config-webextension" | ||
"extends": "@parcel/config-webextension", | ||
"optimizers": { | ||
"*.js": [ | ||
"@parcel/optimizer-terser" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"output": { | ||
"beautify": true, | ||
"indent_level": 2 | ||
"beautify": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { TargetType } from "puppeteer"; | ||
|
||
async function getServiceWorker() { | ||
const workerTarget = await browser.waitForTarget( | ||
(target) => target.type() === TargetType.SERVICE_WORKER | ||
); | ||
|
||
return (await workerTarget.worker())!; | ||
} | ||
|
||
/** | ||
* This is used to make headless testing possible. Because in Chrome for Testing | ||
* `document.execCommand` doesn't work we need a way to test without using the | ||
* real clipboard. It reads and writes from and to local storage. | ||
*/ | ||
export const storageClipboard = { | ||
async readText() { | ||
const worker = await getServiceWorker(); | ||
const { clipboard } = (await worker.evaluate(async () => | ||
chrome.storage.local.get("clipboard") | ||
)) as { clipboard: string }; | ||
|
||
return clipboard; | ||
}, | ||
async writeText(text: string) { | ||
const worker = await getServiceWorker(); | ||
|
||
await worker.evaluate(async (text) => { | ||
await chrome.storage.local.set({ clipboard: text }); | ||
}, text); | ||
}, | ||
}; | ||
|
||
export async function runTestRequest(request: string) { | ||
const worker = await getServiceWorker(); | ||
|
||
await worker.evaluate(async (request) => { | ||
await chrome.storage.local.set({ clipboard: request }); | ||
dispatchEvent(new CustomEvent("handle-test-request")); | ||
}, request); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.