create-addfox-app 0.1.1-beta.7 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +184 -99
- package/package.json +9 -5
- package/templates/README.md +3 -0
- package/templates/template-preact-js/AGENTS.md +54 -0
- package/templates/template-preact-js/addfox.config.js +27 -0
- package/templates/template-preact-js/app/background/index.js +8 -0
- package/templates/template-preact-js/app/content/index.js +1 -0
- package/templates/template-preact-js/app/options/App.jsx +5 -0
- package/templates/template-preact-js/app/options/index.jsx +5 -0
- package/templates/template-preact-js/app/popup/App.jsx +31 -0
- package/templates/template-preact-js/app/popup/index.jsx +5 -0
- package/templates/template-preact-js/app/sidepanel/App.jsx +5 -0
- package/templates/template-preact-js/app/sidepanel/index.jsx +5 -0
- package/templates/template-preact-js/package.json +18 -0
- package/templates/template-preact-js/public/icons/icon_128.png +0 -0
- package/templates/template-preact-js/public/welcome.html +20 -0
- package/templates/template-preact-ts/AGENTS.md +61 -0
- package/templates/template-preact-ts/addfox.config.ts +27 -0
- package/templates/template-preact-ts/app/background/index.ts +8 -0
- package/templates/template-preact-ts/app/content/index.ts +1 -0
- package/templates/template-preact-ts/app/options/App.tsx +5 -0
- package/templates/template-preact-ts/app/options/index.tsx +5 -0
- package/templates/template-preact-ts/app/popup/App.tsx +31 -0
- package/templates/template-preact-ts/app/popup/index.tsx +5 -0
- package/templates/template-preact-ts/app/sidepanel/App.tsx +5 -0
- package/templates/template-preact-ts/app/sidepanel/index.tsx +5 -0
- package/templates/template-preact-ts/package.json +20 -0
- package/templates/template-preact-ts/public/icons/icon_128.png +0 -0
- package/templates/template-preact-ts/public/welcome.html +20 -0
- package/templates/template-preact-ts/tsconfig.json +19 -0
- package/templates/template-react-js/AGENTS.md +66 -0
- package/templates/template-react-js/addfox.config.js +27 -0
- package/templates/template-react-js/app/background/index.js +8 -0
- package/templates/template-react-js/app/content/index.js +1 -0
- package/templates/template-react-js/app/options/App.jsx +3 -0
- package/templates/template-react-js/app/options/index.jsx +5 -0
- package/templates/template-react-js/app/popup/App.jsx +29 -0
- package/templates/template-react-js/app/popup/index.jsx +5 -0
- package/templates/template-react-js/app/sidepanel/App.jsx +3 -0
- package/templates/template-react-js/app/sidepanel/index.jsx +5 -0
- package/templates/template-react-js/package.json +19 -0
- package/templates/template-react-js/public/icons/icon_128.png +0 -0
- package/templates/template-react-js/public/welcome.html +20 -0
- package/templates/template-react-ts/AGENTS.md +93 -0
- package/templates/template-react-ts/addfox.config.ts +27 -0
- package/templates/template-react-ts/app/background/index.ts +8 -0
- package/templates/template-react-ts/app/content/index.ts +1 -0
- package/templates/template-react-ts/app/options/App.tsx +3 -0
- package/templates/template-react-ts/app/options/index.tsx +5 -0
- package/templates/template-react-ts/app/popup/App.tsx +29 -0
- package/templates/template-react-ts/app/popup/index.tsx +5 -0
- package/templates/template-react-ts/app/sidepanel/App.tsx +3 -0
- package/templates/template-react-ts/app/sidepanel/index.tsx +5 -0
- package/templates/template-react-ts/package.json +23 -0
- package/templates/template-react-ts/public/icons/icon_128.png +0 -0
- package/templates/template-react-ts/public/welcome.html +20 -0
- package/templates/template-react-ts/tsconfig.json +19 -0
- package/templates/template-solid-js/AGENTS.md +54 -0
- package/templates/template-solid-js/addfox.config.js +28 -0
- package/templates/template-solid-js/app/background/index.js +8 -0
- package/templates/template-solid-js/app/content/index.js +1 -0
- package/templates/template-solid-js/app/options/App.jsx +3 -0
- package/templates/template-solid-js/app/options/index.jsx +5 -0
- package/templates/template-solid-js/app/popup/App.jsx +34 -0
- package/templates/template-solid-js/app/popup/index.jsx +5 -0
- package/templates/template-solid-js/app/sidepanel/App.jsx +3 -0
- package/templates/template-solid-js/app/sidepanel/index.jsx +5 -0
- package/templates/template-solid-js/package.json +19 -0
- package/templates/template-solid-js/public/icons/icon_128.png +0 -0
- package/templates/template-solid-js/public/welcome.html +20 -0
- package/templates/template-solid-ts/AGENTS.md +61 -0
- package/templates/template-solid-ts/addfox.config.ts +28 -0
- package/templates/template-solid-ts/app/background/index.ts +8 -0
- package/templates/template-solid-ts/app/content/index.ts +1 -0
- package/templates/template-solid-ts/app/options/App.tsx +3 -0
- package/templates/template-solid-ts/app/options/index.tsx +5 -0
- package/templates/template-solid-ts/app/popup/App.tsx +34 -0
- package/templates/template-solid-ts/app/popup/index.tsx +5 -0
- package/templates/template-solid-ts/app/sidepanel/App.tsx +3 -0
- package/templates/template-solid-ts/app/sidepanel/index.tsx +5 -0
- package/templates/template-solid-ts/package.json +21 -0
- package/templates/template-solid-ts/public/icons/icon_128.png +0 -0
- package/templates/template-solid-ts/public/welcome.html +20 -0
- package/templates/template-solid-ts/tsconfig.json +19 -0
- package/templates/template-svelte-js/AGENTS.md +54 -0
- package/templates/template-svelte-js/addfox.config.js +27 -0
- package/templates/template-svelte-js/app/background/index.js +8 -0
- package/templates/template-svelte-js/app/content/index.js +1 -0
- package/templates/template-svelte-js/app/options/App.svelte +4 -0
- package/templates/template-svelte-js/app/options/index.js +4 -0
- package/templates/template-svelte-js/app/popup/App.svelte +30 -0
- package/templates/template-svelte-js/app/popup/index.js +4 -0
- package/templates/template-svelte-js/app/sidepanel/App.svelte +4 -0
- package/templates/template-svelte-js/app/sidepanel/index.js +4 -0
- package/templates/template-svelte-js/package.json +18 -0
- package/templates/template-svelte-js/public/icons/icon_128.png +0 -0
- package/templates/template-svelte-js/public/welcome.html +20 -0
- package/templates/template-svelte-ts/AGENTS.md +61 -0
- package/templates/template-svelte-ts/addfox.config.ts +27 -0
- package/templates/template-svelte-ts/app/background/index.ts +8 -0
- package/templates/template-svelte-ts/app/content/index.ts +1 -0
- package/templates/template-svelte-ts/app/options/App.svelte +4 -0
- package/templates/template-svelte-ts/app/options/index.ts +4 -0
- package/templates/template-svelte-ts/app/popup/App.svelte +30 -0
- package/templates/template-svelte-ts/app/popup/index.ts +4 -0
- package/templates/template-svelte-ts/app/sidepanel/App.svelte +4 -0
- package/templates/template-svelte-ts/app/sidepanel/index.ts +4 -0
- package/templates/template-svelte-ts/package.json +20 -0
- package/templates/template-svelte-ts/public/icons/icon_128.png +0 -0
- package/templates/template-svelte-ts/public/welcome.html +20 -0
- package/templates/template-svelte-ts/tsconfig.json +19 -0
- package/templates/template-vanilla-js/AGENTS.md +52 -0
- package/templates/template-vanilla-js/addfox.config.js +25 -0
- package/templates/template-vanilla-js/app/background/index.js +8 -0
- package/templates/template-vanilla-js/app/content/index.js +1 -0
- package/templates/template-vanilla-js/app/options/index.js +2 -0
- package/templates/template-vanilla-js/app/popup/index.js +48 -0
- package/templates/template-vanilla-js/app/sidepanel/index.js +2 -0
- package/templates/template-vanilla-js/package.json +13 -0
- package/templates/template-vanilla-js/public/icons/icon_128.png +0 -0
- package/templates/template-vanilla-js/public/welcome.html +20 -0
- package/templates/template-vanilla-ts/AGENTS.md +59 -0
- package/templates/template-vanilla-ts/addfox.config.ts +25 -0
- package/templates/template-vanilla-ts/app/background/index.ts +8 -0
- package/templates/template-vanilla-ts/app/content/index.ts +1 -0
- package/templates/template-vanilla-ts/app/options/index.ts +2 -0
- package/templates/template-vanilla-ts/app/popup/index.ts +48 -0
- package/templates/template-vanilla-ts/app/sidepanel/index.ts +2 -0
- package/templates/template-vanilla-ts/package.json +14 -0
- package/templates/template-vanilla-ts/public/icons/icon_128.png +0 -0
- package/templates/template-vanilla-ts/public/welcome.html +20 -0
- package/templates/template-vanilla-ts/tsconfig.json +17 -0
- package/templates/template-vue-js/AGENTS.md +60 -0
- package/templates/template-vue-js/addfox.config.js +27 -0
- package/templates/template-vue-js/app/background/index.js +8 -0
- package/templates/template-vue-js/app/content/index.js +1 -0
- package/templates/template-vue-js/app/options/App.vue +6 -0
- package/templates/template-vue-js/app/options/index.js +5 -0
- package/templates/template-vue-js/app/popup/App.vue +34 -0
- package/templates/template-vue-js/app/popup/index.js +5 -0
- package/templates/template-vue-js/app/sidepanel/App.vue +6 -0
- package/templates/template-vue-js/app/sidepanel/index.js +5 -0
- package/templates/template-vue-js/package.json +18 -0
- package/templates/template-vue-js/public/icons/icon_128.png +0 -0
- package/templates/template-vue-js/public/welcome.html +20 -0
- package/templates/template-vue-ts/AGENTS.md +65 -0
- package/templates/template-vue-ts/addfox.config.ts +27 -0
- package/templates/template-vue-ts/app/background/index.ts +8 -0
- package/templates/template-vue-ts/app/content/index.ts +1 -0
- package/templates/template-vue-ts/app/options/App.vue +6 -0
- package/templates/template-vue-ts/app/options/index.ts +5 -0
- package/templates/template-vue-ts/app/popup/App.vue +32 -0
- package/templates/template-vue-ts/app/popup/index.ts +5 -0
- package/templates/template-vue-ts/app/sidepanel/App.vue +6 -0
- package/templates/template-vue-ts/app/sidepanel/index.ts +5 -0
- package/templates/template-vue-ts/package.json +20 -0
- package/templates/template-vue-ts/public/icons/icon_128.png +0 -0
- package/templates/template-vue-ts/public/welcome.html +20 -0
- package/templates/template-vue-ts/tsconfig.json +19 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome - Addfox + Vanilla</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: #fafafa; color: #1a1a1a; }
|
|
9
|
+
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.5rem; }
|
|
10
|
+
p { font-size: 1rem; color: #666; margin: 0; }
|
|
11
|
+
.welcome-icon { width: 96px; height: 96px; margin-bottom: 1rem; object-fit: contain; border-radius: 12px; }
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<img class="welcome-icon" src="/icons/icon_128.png" alt="" width="96" height="96" />
|
|
16
|
+
<h1>Addfox + Vanilla</h1>
|
|
17
|
+
<p>Your extension is ready. Happy building!</p>
|
|
18
|
+
<p style="margin-top: 1rem;"><a href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a></p>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"types": []
|
|
13
|
+
},
|
|
14
|
+
"include": [
|
|
15
|
+
"app"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# AI Agent Guide - Vue Addfox Extension
|
|
2
|
+
|
|
3
|
+
> **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Vue 3 browser extension using Addfox build tool. Uses `@rsbuild/plugin-vue` for SFC support.
|
|
8
|
+
|
|
9
|
+
## Key Configuration Fields (addfox.config.js)
|
|
10
|
+
|
|
11
|
+
### Required Fields
|
|
12
|
+
|
|
13
|
+
- **`manifest`** - Extension manifest.json content
|
|
14
|
+
- Supports `chromium` and `firefox` variants
|
|
15
|
+
- Addfox auto-injects entry paths
|
|
16
|
+
|
|
17
|
+
- **`plugins`** - Rsbuild plugins array
|
|
18
|
+
- Must include `pluginVue()` for Vue SFC support
|
|
19
|
+
|
|
20
|
+
### Optional Fields (use when needed)
|
|
21
|
+
|
|
22
|
+
- **`appDir`** - Source directory (default: "app")
|
|
23
|
+
- **`outDir`** - Build output directory
|
|
24
|
+
- **`entry`** - Manual entry mapping
|
|
25
|
+
- **`hotReload`** - Dev server settings
|
|
26
|
+
- **`debug`** - Enable debug logging
|
|
27
|
+
- **`zip`** - Output zip configuration
|
|
28
|
+
- **`rsbuild`** - Override Rsbuild configuration
|
|
29
|
+
|
|
30
|
+
## Entry Structure
|
|
31
|
+
|
|
32
|
+
Entries auto-discovered from `appDir` subdirectories:
|
|
33
|
+
|
|
34
|
+
- `app/background/` → Service Worker (index.js)
|
|
35
|
+
- `app/content/` → Content Script (index.js)
|
|
36
|
+
- `app/popup/` → Popup page (index.js + App.vue)
|
|
37
|
+
- `app/options/` → Options page
|
|
38
|
+
- `app/sidepanel/` → Side panel
|
|
39
|
+
|
|
40
|
+
## Framework-Specific Notes
|
|
41
|
+
|
|
42
|
+
### Vue 3
|
|
43
|
+
|
|
44
|
+
- Uses Vue 3 Composition API
|
|
45
|
+
- Single File Components (`.vue` files)
|
|
46
|
+
|
|
47
|
+
### Browser Extension APIs
|
|
48
|
+
|
|
49
|
+
- Install `webextension-polyfill` for cross-browser compatibility
|
|
50
|
+
|
|
51
|
+
### Styling
|
|
52
|
+
|
|
53
|
+
- Vue scoped styles supported
|
|
54
|
+
- Content scripts: use `@addfox/utils` with Shadow DOM
|
|
55
|
+
|
|
56
|
+
## Resources
|
|
57
|
+
|
|
58
|
+
- Addfox docs: https://addfox.dev
|
|
59
|
+
- Rsbuild Vue plugin: https://rsbuild.dev/plugins/list/plugin-vue
|
|
60
|
+
- Vue 3 docs: https://vuejs.org
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
import { pluginVue } from "@rsbuild/plugin-vue";
|
|
3
|
+
|
|
4
|
+
const manifest = {
|
|
5
|
+
name: "My Extension",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
manifest_version: 3,
|
|
8
|
+
description: "Browser extension built with addfox",
|
|
9
|
+
permissions: ["activeTab"],
|
|
10
|
+
icons: {
|
|
11
|
+
"16": "icons/icon_128.png",
|
|
12
|
+
"48": "icons/icon_128.png",
|
|
13
|
+
"128": "icons/icon_128.png",
|
|
14
|
+
},
|
|
15
|
+
action: {
|
|
16
|
+
default_icon: {
|
|
17
|
+
"16": "icons/icon_128.png",
|
|
18
|
+
"48": "icons/icon_128.png",
|
|
19
|
+
"128": "icons/icon_128.png",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
manifest: { chromium: manifest, firefox: { ...manifest } },
|
|
26
|
+
plugins: [pluginVue()],
|
|
27
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function openWelcomePage() {
|
|
2
|
+
chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
chrome.runtime.onInstalled.addListener((details) => {
|
|
6
|
+
if (details.reason === "install" || details.reason === "update") openWelcomePage();
|
|
7
|
+
console.log("Extension installed");
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("Content script loaded");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="popup">
|
|
3
|
+
<img src="/icons/icon_128.png" alt="" width="64" height="64" />
|
|
4
|
+
<div class="title">AddFox Vue</div>
|
|
5
|
+
<a class="site-link" href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup></script>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.popup {
|
|
13
|
+
width: 320px;
|
|
14
|
+
min-height: 200px;
|
|
15
|
+
padding: 16px;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
gap: 12px;
|
|
22
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.title {
|
|
26
|
+
font-size: 18px;
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.site-link {
|
|
31
|
+
font-size: 13px;
|
|
32
|
+
color: #2563eb;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-extension",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "addfox dev",
|
|
8
|
+
"build": "addfox build"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@addfox/utils": "^0.1.1",
|
|
12
|
+
"vue": "^3.5.30"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"addfox": "^0.1.1",
|
|
16
|
+
"@rsbuild/plugin-vue": "^1.2.7"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome - Addfox + Vue</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: #fafafa; color: #1a1a1a; }
|
|
9
|
+
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.5rem; }
|
|
10
|
+
p { font-size: 1rem; color: #666; margin: 0; }
|
|
11
|
+
.welcome-icon { width: 96px; height: 96px; margin-bottom: 1rem; object-fit: contain; border-radius: 12px; }
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<img class="welcome-icon" src="/icons/icon_128.png" alt="" width="96" height="96" />
|
|
16
|
+
<h1>Addfox + Vue</h1>
|
|
17
|
+
<p>Your extension is ready. Happy building!</p>
|
|
18
|
+
<p style="margin-top: 1rem;"><a href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a></p>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# AI Agent Guide - Vue Addfox Extension
|
|
2
|
+
|
|
3
|
+
> **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Vue 3 browser extension using Addfox build tool. Uses `@rsbuild/plugin-vue` for SFC support.
|
|
8
|
+
|
|
9
|
+
## Key Configuration Fields (addfox.config.ts)
|
|
10
|
+
|
|
11
|
+
### Required Fields
|
|
12
|
+
|
|
13
|
+
- **`manifest`** - Extension manifest.json content
|
|
14
|
+
- Supports `chromium` and `firefox` variants
|
|
15
|
+
- Addfox auto-injects entry paths
|
|
16
|
+
|
|
17
|
+
- **`plugins`** - Rsbuild plugins array
|
|
18
|
+
- Must include `pluginVue()` for Vue SFC support
|
|
19
|
+
|
|
20
|
+
### Optional Fields (use when needed)
|
|
21
|
+
|
|
22
|
+
- **`appDir`** - Source directory (default: "app")
|
|
23
|
+
- **`outDir`** - Build output directory (default: ".addfox/extension")
|
|
24
|
+
- **`entry`** - Manual entry mapping (when auto-discovery fails)
|
|
25
|
+
- **`hotReload`** - Dev server settings
|
|
26
|
+
- **`debug`** - Enable debug logging
|
|
27
|
+
- **`zip`** - Output zip configuration
|
|
28
|
+
- **`rsbuild`** - Override Rsbuild configuration
|
|
29
|
+
|
|
30
|
+
## Entry Structure
|
|
31
|
+
|
|
32
|
+
Entries auto-discovered from `appDir` subdirectories:
|
|
33
|
+
|
|
34
|
+
- `app/background/` → Service Worker (index.ts)
|
|
35
|
+
- `app/content/` → Content Script (index.ts)
|
|
36
|
+
- `app/popup/` → Popup page (index.ts + App.vue)
|
|
37
|
+
- `app/options/` → Options page
|
|
38
|
+
- `app/sidepanel/` → Side panel
|
|
39
|
+
- `app/devtools/` → DevTools page
|
|
40
|
+
|
|
41
|
+
## Framework-Specific Notes
|
|
42
|
+
|
|
43
|
+
### Vue 3
|
|
44
|
+
|
|
45
|
+
- Uses Vue 3 Composition API
|
|
46
|
+
- Single File Components (`.vue` files)
|
|
47
|
+
- TypeScript support enabled
|
|
48
|
+
|
|
49
|
+
### Browser Extension APIs
|
|
50
|
+
|
|
51
|
+
- Install `webextension-polyfill` for cross-browser compatibility
|
|
52
|
+
- Use in setup scripts or component methods
|
|
53
|
+
|
|
54
|
+
### Styling
|
|
55
|
+
|
|
56
|
+
- Vue scoped styles supported
|
|
57
|
+
- CSS Modules available
|
|
58
|
+
- Content scripts: use `@addfox/utils` with Shadow DOM
|
|
59
|
+
|
|
60
|
+
## Resources
|
|
61
|
+
|
|
62
|
+
- Addfox docs: https://addfox.dev
|
|
63
|
+
- Rsbuild Vue plugin: https://rsbuild.dev/plugins/list/plugin-vue
|
|
64
|
+
- Vue 3 docs: https://vuejs.org
|
|
65
|
+
- WebExtension API: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
import { pluginVue } from "@rsbuild/plugin-vue";
|
|
3
|
+
|
|
4
|
+
const manifest = {
|
|
5
|
+
name: "My Extension",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
manifest_version: 3,
|
|
8
|
+
description: "Browser extension built with addfox",
|
|
9
|
+
permissions: ["activeTab"],
|
|
10
|
+
icons: {
|
|
11
|
+
"16": "icons/icon_128.png",
|
|
12
|
+
"48": "icons/icon_128.png",
|
|
13
|
+
"128": "icons/icon_128.png",
|
|
14
|
+
},
|
|
15
|
+
action: {
|
|
16
|
+
default_icon: {
|
|
17
|
+
"16": "icons/icon_128.png",
|
|
18
|
+
"48": "icons/icon_128.png",
|
|
19
|
+
"128": "icons/icon_128.png",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
manifest: { chromium: manifest, firefox: { ...manifest } },
|
|
26
|
+
plugins: [pluginVue()],
|
|
27
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function openWelcomePage() {
|
|
2
|
+
chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
chrome.runtime.onInstalled.addListener((details) => {
|
|
6
|
+
if (details.reason === "install" || details.reason === "update") openWelcomePage();
|
|
7
|
+
console.log("Extension installed");
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("Content script loaded");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="popup">
|
|
3
|
+
<img src="/icons/icon_128.png" alt="" width="64" height="64" />
|
|
4
|
+
<div class="title">AddFox Vue</div>
|
|
5
|
+
<a class="site-link" href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<style scoped>
|
|
10
|
+
.popup {
|
|
11
|
+
width: 320px;
|
|
12
|
+
min-height: 200px;
|
|
13
|
+
padding: 16px;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
gap: 12px;
|
|
20
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.title {
|
|
24
|
+
font-size: 18px;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.site-link {
|
|
29
|
+
font-size: 13px;
|
|
30
|
+
color: #2563eb;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-extension",
|
|
3
|
+
"version": "1.0.1-beta.2",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "addfox dev",
|
|
8
|
+
"build": "addfox build"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@addfox/utils": "^0.1.1",
|
|
12
|
+
"vue": "^3.5.30"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"addfox": "^0.1.1",
|
|
16
|
+
"@rsbuild/plugin-vue": "^1.2.7",
|
|
17
|
+
"typescript": "^5.9.3",
|
|
18
|
+
"@types/chrome": "^0.1.38"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome - Addfox + Vue</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: #fafafa; color: #1a1a1a; }
|
|
9
|
+
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.5rem; }
|
|
10
|
+
p { font-size: 1rem; color: #666; margin: 0; }
|
|
11
|
+
.welcome-icon { width: 96px; height: 96px; margin-bottom: 1rem; object-fit: contain; border-radius: 12px; }
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<img class="welcome-icon" src="/icons/icon_128.png" alt="" width="96" height="96" />
|
|
16
|
+
<h1>Addfox + Vue</h1>
|
|
17
|
+
<p>Your extension is ready. Happy building!</p>
|
|
18
|
+
<p style="margin-top: 1rem;"><a href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a></p>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"types": [
|
|
13
|
+
"chrome"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"include": [
|
|
17
|
+
"app"
|
|
18
|
+
]
|
|
19
|
+
}
|