create-addfox-app 0.1.1-beta.7 → 0.2.0
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 +18 -18
- package/dist/cli.js +259 -102
- package/package.json +9 -8
- 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,27 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
import { pluginReact } from "@rsbuild/plugin-react";
|
|
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: [pluginReact()],
|
|
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,29 @@
|
|
|
1
|
+
export default function App() {
|
|
2
|
+
const popupStyle = {
|
|
3
|
+
width: 320,
|
|
4
|
+
minHeight: 200,
|
|
5
|
+
padding: 16,
|
|
6
|
+
boxSizing: "border-box" as const,
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column" as const,
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
gap: 12,
|
|
12
|
+
fontFamily: 'system-ui, -apple-system, "Segoe UI", sans-serif',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div style={popupStyle}>
|
|
17
|
+
<img src="/icons/icon_128.png" alt="" width={64} height={64} />
|
|
18
|
+
<div style={{ fontSize: 18, fontWeight: 600 }}>AddFox React</div>
|
|
19
|
+
<a
|
|
20
|
+
href="https://addfox.dev/"
|
|
21
|
+
target="_blank"
|
|
22
|
+
rel="noopener noreferrer"
|
|
23
|
+
style={{ fontSize: 13, color: "#2563eb" }}
|
|
24
|
+
>
|
|
25
|
+
addfox.dev
|
|
26
|
+
</a>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
"react": "^19.2.4",
|
|
13
|
+
"react-dom": "^19.2.4"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"addfox": "0.1.1",
|
|
17
|
+
"@rsbuild/plugin-react": "2.0.0",
|
|
18
|
+
"typescript": "^5.9.3",
|
|
19
|
+
"@types/chrome": "^0.1.38",
|
|
20
|
+
"@types/react": "^19.2.14",
|
|
21
|
+
"@types/react-dom": "^19.2.3"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
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 + React</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 + React</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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# AI Agent Guide - Solid Addfox Extension
|
|
2
|
+
|
|
3
|
+
> **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
SolidJS browser extension using Addfox build tool. Uses `@rsbuild/plugin-solid` for Solid 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 `pluginSolid()` for Solid JSX 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. Each needs `index.jsx` as entry.
|
|
33
|
+
|
|
34
|
+
## Framework-Specific Notes
|
|
35
|
+
|
|
36
|
+
### SolidJS
|
|
37
|
+
|
|
38
|
+
- JSX-based (`.jsx` files)
|
|
39
|
+
- Fine-grained reactivity with signals
|
|
40
|
+
|
|
41
|
+
### Browser Extension APIs
|
|
42
|
+
|
|
43
|
+
- Install `webextension-polyfill` for cross-browser compatibility
|
|
44
|
+
|
|
45
|
+
### Styling
|
|
46
|
+
|
|
47
|
+
- Supports CSS Modules
|
|
48
|
+
- Content scripts: use `@addfox/utils` with Shadow DOM
|
|
49
|
+
|
|
50
|
+
## Resources
|
|
51
|
+
|
|
52
|
+
- Addfox docs: https://addfox.dev
|
|
53
|
+
- Rsbuild Solid plugin: https://rsbuild.dev/plugins/list/plugin-solid
|
|
54
|
+
- Solid docs: https://www.solidjs.com
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
import { pluginBabel } from "@rsbuild/plugin-babel";
|
|
3
|
+
import { pluginSolid } from "@rsbuild/plugin-solid";
|
|
4
|
+
|
|
5
|
+
const manifest = {
|
|
6
|
+
name: "My Extension",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
manifest_version: 3,
|
|
9
|
+
description: "Browser extension built with addfox",
|
|
10
|
+
permissions: ["activeTab"],
|
|
11
|
+
icons: {
|
|
12
|
+
"16": "icons/icon_128.png",
|
|
13
|
+
"48": "icons/icon_128.png",
|
|
14
|
+
"128": "icons/icon_128.png",
|
|
15
|
+
},
|
|
16
|
+
action: {
|
|
17
|
+
default_icon: {
|
|
18
|
+
"16": "icons/icon_128.png",
|
|
19
|
+
"48": "icons/icon_128.png",
|
|
20
|
+
"128": "icons/icon_128.png",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
manifest: { chromium: manifest, firefox: { ...manifest } },
|
|
27
|
+
plugins: [pluginBabel({ include: /\.(?:jsx|tsx)$/ }), pluginSolid()],
|
|
28
|
+
});
|
|
@@ -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
|
+
export default function App() {
|
|
2
|
+
const popupStyle = {
|
|
3
|
+
width: "320px",
|
|
4
|
+
"min-height": "200px",
|
|
5
|
+
padding: "16px",
|
|
6
|
+
"box-sizing": "border-box",
|
|
7
|
+
display: "flex",
|
|
8
|
+
"flex-direction": "column",
|
|
9
|
+
"align-items": "center",
|
|
10
|
+
"justify-content": "center",
|
|
11
|
+
gap: "12px",
|
|
12
|
+
"font-family": 'system-ui, -apple-system, "Segoe UI", sans-serif',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const titleStyle = {
|
|
16
|
+
"font-size": "18px",
|
|
17
|
+
"font-weight": "600",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div style={popupStyle}>
|
|
22
|
+
<img src="/icons/icon_128.png" alt="" width={64} height={64} />
|
|
23
|
+
<div style={titleStyle}>AddFox Solid</div>
|
|
24
|
+
<a
|
|
25
|
+
href="https://addfox.dev/"
|
|
26
|
+
target="_blank"
|
|
27
|
+
rel="noopener noreferrer"
|
|
28
|
+
style={{ "font-size": "13px", color: "#2563eb" }}
|
|
29
|
+
>
|
|
30
|
+
addfox.dev
|
|
31
|
+
</a>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
"solid-js": "^1.9.11"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"addfox": "0.1.1",
|
|
16
|
+
"@rsbuild/plugin-babel": "^1.2.0",
|
|
17
|
+
"@rsbuild/plugin-solid": "1.2.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
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 + Solid</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 + Solid</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,61 @@
|
|
|
1
|
+
# AI Agent Guide - Solid Addfox Extension
|
|
2
|
+
|
|
3
|
+
> **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
SolidJS browser extension using Addfox build tool. Uses `@rsbuild/plugin-solid` for Solid 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 `pluginSolid()` for Solid JSX 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.ts)
|
|
35
|
+
- `app/content/` → Content Script (index.ts)
|
|
36
|
+
- `app/popup/` → Popup page (index.tsx + App.tsx)
|
|
37
|
+
- `app/options/` → Options page
|
|
38
|
+
- `app/sidepanel/` → Side panel
|
|
39
|
+
|
|
40
|
+
## Framework-Specific Notes
|
|
41
|
+
|
|
42
|
+
### SolidJS
|
|
43
|
+
|
|
44
|
+
- JSX-based (`.tsx` files)
|
|
45
|
+
- Fine-grained reactivity with signals
|
|
46
|
+
- TypeScript support enabled
|
|
47
|
+
|
|
48
|
+
### Browser Extension APIs
|
|
49
|
+
|
|
50
|
+
- Install `webextension-polyfill` for cross-browser compatibility
|
|
51
|
+
|
|
52
|
+
### Styling
|
|
53
|
+
|
|
54
|
+
- Supports CSS Modules
|
|
55
|
+
- Content scripts: use `@addfox/utils` with Shadow DOM
|
|
56
|
+
|
|
57
|
+
## Resources
|
|
58
|
+
|
|
59
|
+
- Addfox docs: https://addfox.dev
|
|
60
|
+
- Rsbuild Solid plugin: https://rsbuild.dev/plugins/list/plugin-solid
|
|
61
|
+
- Solid docs: https://www.solidjs.com
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
import { pluginBabel } from "@rsbuild/plugin-babel";
|
|
3
|
+
import { pluginSolid } from "@rsbuild/plugin-solid";
|
|
4
|
+
|
|
5
|
+
const manifest = {
|
|
6
|
+
name: "My Extension",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
manifest_version: 3,
|
|
9
|
+
description: "Browser extension built with addfox",
|
|
10
|
+
permissions: ["activeTab"],
|
|
11
|
+
icons: {
|
|
12
|
+
"16": "icons/icon_128.png",
|
|
13
|
+
"48": "icons/icon_128.png",
|
|
14
|
+
"128": "icons/icon_128.png",
|
|
15
|
+
},
|
|
16
|
+
action: {
|
|
17
|
+
default_icon: {
|
|
18
|
+
"16": "icons/icon_128.png",
|
|
19
|
+
"48": "icons/icon_128.png",
|
|
20
|
+
"128": "icons/icon_128.png",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
manifest: { chromium: manifest, firefox: { ...manifest } },
|
|
27
|
+
plugins: [pluginBabel({ include: /\.(?:jsx|tsx)$/ }), pluginSolid()],
|
|
28
|
+
});
|
|
@@ -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
|
+
export default function App() {
|
|
2
|
+
const popupStyle = {
|
|
3
|
+
width: "320px",
|
|
4
|
+
"min-height": "200px",
|
|
5
|
+
padding: "16px",
|
|
6
|
+
"box-sizing": "border-box",
|
|
7
|
+
display: "flex",
|
|
8
|
+
"flex-direction": "column",
|
|
9
|
+
"align-items": "center",
|
|
10
|
+
"justify-content": "center",
|
|
11
|
+
gap: "12px",
|
|
12
|
+
"font-family": 'system-ui, -apple-system, "Segoe UI", sans-serif',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const titleStyle = {
|
|
16
|
+
"font-size": "18px",
|
|
17
|
+
"font-weight": "600",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div style={popupStyle}>
|
|
22
|
+
<img src="/icons/icon_128.png" alt="" width={64} height={64} />
|
|
23
|
+
<div style={titleStyle}>AddFox Solid</div>
|
|
24
|
+
<a
|
|
25
|
+
href="https://addfox.dev/"
|
|
26
|
+
target="_blank"
|
|
27
|
+
rel="noopener noreferrer"
|
|
28
|
+
style={{ "font-size": "13px", color: "#2563eb" }}
|
|
29
|
+
>
|
|
30
|
+
addfox.dev
|
|
31
|
+
</a>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
"solid-js": "^1.9.11"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"addfox": "0.1.1",
|
|
16
|
+
"@rsbuild/plugin-babel": "^1.2.0",
|
|
17
|
+
"@rsbuild/plugin-solid": "1.2.0",
|
|
18
|
+
"typescript": "^5.9.3",
|
|
19
|
+
"@types/chrome": "^0.1.38"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
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 + Solid</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 + Solid</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
|
+
}
|