- src/lib/types.ts: message contract (both ANALYZE_TEXT shapes preserved), config/response types, storage-key constants. - src/lib/messaging.ts: single safeStorageGet/safeStorageSet/safeSendMessage/ isExtensionValid implementation replacing the three divergent copies in Options, Popup, and content. Content script keeps its refresh-toast behavior via an onContextInvalidated callback. - New '@lib' import alias (wxt force-overwrites '~' and '@' to srcDir, so those cannot point at ./src); wired in wxt.config, tsconfig, vitest. - tests/unit/messaging.test.ts: 14 unit tests over the wrappers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
35 lines
1014 B
TypeScript
35 lines
1014 B
TypeScript
import { resolve } from 'node:path';
|
|
import { defineConfig } from 'wxt';
|
|
import pkg from './package.json';
|
|
|
|
export default defineConfig({
|
|
extensionApi: 'chrome',
|
|
// Shared-code alias. Deliberately NOT "~" or "@" — WXT force-overwrites those
|
|
// to srcDir (the project root here), so they cannot point at ./src.
|
|
alias: {
|
|
'@lib': resolve(__dirname, 'src/lib'),
|
|
},
|
|
modules: ['@wxt-dev/module-react'],
|
|
manifest: {
|
|
name: 'LexAI - AI Writing Assistant',
|
|
description: 'Grammar checking and writing assistance powered by your own LLM API key',
|
|
// Single source of truth: manifest version always follows package.json,
|
|
// so a release bump is a one-file edit and versions can never drift.
|
|
version: pkg.version,
|
|
icons: {
|
|
'16': 'icon-16.png',
|
|
'32': 'icon-32.png',
|
|
'48': 'icon-48.png',
|
|
'128': 'icon-128.png',
|
|
},
|
|
permissions: [
|
|
'storage',
|
|
'activeTab',
|
|
'contextMenus',
|
|
],
|
|
host_permissions: [
|
|
'<all_urls>',
|
|
],
|
|
},
|
|
});
|