-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwxt.config.ts
More file actions
117 lines (116 loc) · 3.73 KB
/
Copy pathwxt.config.ts
File metadata and controls
117 lines (116 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import { defineConfig } from 'wxt';
import tailwindcss from '@tailwindcss/vite';
import path from 'path';
// See https://wxt.dev/api/config.html
export default defineConfig({
manifest: {
name: 'Better Lectio',
description: 'Gør Lectio suverent bedre. Installér mobil appen også!',
version: '0.0.32',
author: 'Jonathan Bangert <betterlectio@jonathanb.dk>' as any,
homepage_url: 'https://github.com/jonbng/betterlectio',
action: {
default_title: 'Better Lectio',
},
permissions: ['activeTab', 'storage'],
host_permissions: [
`${process.env.VITE_SUPABASE_URL || 'https://*.supabase.co'}/*`,
'https://eu.i.posthog.com/*',
],
web_accessible_resources: [
{
resources: ['assets/*', 'vendor/userjot/**', 'userjot-bootstrap.js'],
matches: ['*://*.lectio.dk/*'],
},
],
},
hooks: {
'build:manifestGenerated': (wxt, manifest) => {
if (wxt.config.browser === 'firefox') {
manifest.browser_specific_settings = {
gecko: {
id: '{c3b94c3b-a7d2-4130-9adc-75cc174b0aaa}',
strict_min_version: '109.0',
data_collection_permissions: {
required: ['none'],
},
},
};
}
if (wxt.config.browser === 'safari') {
manifest.name = 'BetterLectio';
if (manifest.action && typeof manifest.action === 'object') {
manifest.action.default_title = 'BetterLectio';
}
if (manifest.browser_action && typeof manifest.browser_action === 'object') {
manifest.browser_action.default_title = 'BetterLectio';
}
// iOS/iPadOS don't support persistent background pages.
if (manifest.background && typeof manifest.background === 'object') {
(manifest.background as { persistent?: boolean }).persistent = false;
}
// Safari doesn't understand the `world` key on content scripts and
// warns about it at validation time. Our only MAIN-world script
// (session-renew) doesn't actually touch page globals — dispatched
// DOM events still reach jQuery handlers from the isolated world.
if (Array.isArray(manifest.content_scripts)) {
for (const cs of manifest.content_scripts) {
if (cs && typeof cs === 'object' && 'world' in cs) {
delete (cs as { world?: string }).world;
}
}
}
}
},
},
webExt: {
startUrls: ['https://www.lectio.dk/'],
},
zip: {
excludeSources: [
// Build dependencies and artifacts
'node_modules/**',
'.output/**',
'.wxt/**',
// Reference materials (flagged by Mozilla)
'lectio-html/**',
'lectio-scripts/**',
'tools/**',
// Sensitive/config files
'.env',
'.claude/**',
'.mcp.json',
// CI/CD and docs
'.github/**',
'docs/**',
'.cursor/**',
// Store listing assets (not part of extension)
'chrome-*.svg',
'firefox-*.svg',
'screenshots/**',
// Development docs
'CLAUDE.md',
'AGENTS.md',
'ARCHITECTURE.md',
'SOURCE_CODE_REVIEW.md',
'web-ext.config.ts',
'admin/**',
'supabase/**',
'website/**',
],
},
vite: () => ({
plugins: [tailwindcss()],
resolve: {
// Use posthog-node's edge build (no Node.js-specific APIs like async_hooks)
// so it works in browser extension content scripts and service workers.
conditions: ['edge', 'edge-light', 'workerd', 'browser', 'import', 'module', 'default'],
alias: {
'@': path.resolve(__dirname, './'),
'react': 'preact/compat',
'react-dom': 'preact/compat',
'react/jsx-runtime': 'preact/jsx-runtime',
},
},
}),
});