Skip to content

Commit 840aedb

Browse files
committed
refactor(webext): package directory
1 parent 5a30f22 commit 840aedb

26 files changed

Lines changed: 55 additions & 303 deletions

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"@json-render/vue": "catalog:frontend",
4545
"@nuxt/devtools": "catalog:devtools",
4646
"@nuxt/eslint": "catalog:devtools",
47-
"@types/chrome": "catalog:types",
4847
"@types/connect": "catalog:types",
4948
"@types/d3": "catalog:types",
5049
"@types/d3-hierarchy": "catalog:types",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>Vite DevTools Background</title>
5+
</head>
6+
<body>
7+
<script src="../../dist/devtools-bg.mjs" type="module"></script>
8+
</body>
9+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>Vite DevTools Panel</title>
5+
</head>
6+
<body>
7+
<script src="../../dist/panel.mjs" type="module"></script>
8+
</body>
9+
</html>

packages/webext/app/scripts/background.ts

Whitespace-only changes.

packages/webext/app/scripts/content-scripts.ts

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function setupDevToolsPanel() {
2+
chrome.devtools.panels.create(
3+
'Vite',
4+
'icons/128.png',
5+
'app/pages/panel.html',
6+
(panel) => {
7+
panel.onShown.addListener(() => {
8+
})
9+
panel.onHidden.addListener(() => {
10+
})
11+
},
12+
)
13+
}
14+
15+
// @TODO: detect vite env
16+
setupDevToolsPanel()

packages/webext/app/scripts/devtools-panel.ts

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(async () => {
2+
// eslint-disable-next-line no-undef
3+
const script = chrome.runtime.getURL('dist/content-scripts.mjs')
4+
console.log('scripts', script)
5+
await import(script)
6+
})()

0 commit comments

Comments
 (0)