From 51a10725cff6f7305e39410cd8cd3b0091372d4a Mon Sep 17 00:00:00 2001 From: Aaron Klinker Date: Sun, 25 Jun 2023 10:53:13 -0500 Subject: [PATCH] chore: Rename package to wxt --- .gitignore | 2 +- README.md | 15 ++++++--------- demo/package.json | 10 +++++----- demo/tsconfig.json | 2 +- demo/{exvite.config.ts => wxt.config.ts} | 2 +- e2e/tests/auto-imports.test.ts | 20 ++++++++++---------- e2e/tests/remote-code.test.ts | 2 +- e2e/utils.ts | 16 ++++++++-------- package.json | 6 +++--- pnpm-lock.yaml | 4 ++-- src/cli/commands/build.ts | 6 +++--- src/cli/commands/dev.ts | 6 +++--- src/cli/commands/init.ts | 2 +- src/cli/commands/prepare.ts | 4 ++-- src/cli/commands/publish.ts | 2 +- src/cli/index.ts | 2 +- src/cli/utils/printHeader.ts | 2 +- src/index.ts | 14 +++++++++----- src/types/external.ts | 8 ++++---- src/types/internal.ts | 6 +++--- src/utils/auto-imports.ts | 4 ++-- src/utils/buildEntrypoints.ts | 4 ++-- src/utils/createFsCache.ts | 6 +++--- src/utils/generateTypesDir.ts | 14 +++++++------- src/utils/getInternalConfig.ts | 17 ++++++----------- src/utils/importTsFile.ts | 4 ++-- src/vite-plugins/devHtmlPrerender.ts | 2 +- src/vite-plugins/download.ts | 2 +- src/vite-plugins/multipageMove.ts | 2 +- src/vite-plugins/unimport.ts | 2 +- src/vite-plugins/virtualEntrypoint.ts | 9 +++------ 31 files changed, 95 insertions(+), 102 deletions(-) rename demo/{exvite.config.ts => wxt.config.ts} (87%) diff --git a/.gitignore b/.gitignore index a22e25dc..3b711e9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ .DS_Store .env .env.* -.exvite .idea .output +.wxt *.log /.vscode/ /docs/.vitepress/cache diff --git a/README.md b/README.md index eea8a220..7835a268 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,23 @@ -# Exvite +# WXT -> Next generation framework for building web extensions. Powered by [Vite](https://vitejs.dev/) - -Name ideas: - -cyfer, wavex, webext, aura, iron, reyna, aggron, wxt, yiga +> Next gen framework for building web extensions. Powered by [Vite](https://vitejs.dev/) ## Features - [x] Supports all browsers - [x] MV2 & MV3 support - [x] Directory based entrypoints -- [x] Virtual content script and background entryoints for default behaviors +- [x] Virtual content script and background entryoints with default behaviors - [ ] Great DX - [x] Auto-imports - [x] TypeScript, - [x] HMR for HTML pages - - [ ] auto-reload for background and content scripts + - [ ] Auto-reload for background and content scripts +- [x] Unit and E2E tests - [ ] Open browser during development with extension installed - [x] Download and bundle remote dependencies - [x] Supports all major frontend frameworks (Vue, React, Svelte) -- [ ] Project bootstrap - [ ] Automated publishing +- [ ] Project bootstrap - [ ] Bundle analysis - [ ] ~~_Infer permissions from code_~~ Maybe in the future... diff --git a/demo/package.json b/demo/package.json index aab52a30..795934b0 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,18 +1,18 @@ { "name": "Demo Extension", "version": "1.0.0", - "description": "Demo extension for exvite", + "description": "Demo extension for WXT", "type": "module", "scripts": { - "dev": "pnpm -w build && exvite", - "build": "pnpm -w build && exvite build", - "prepare": "pnpm -w build && exvite prepare" + "dev": "pnpm -w build && wxt", + "build": "pnpm -w build && wxt build", + "prepare": "pnpm -w build && wxt prepare" }, "dependencies": { "webextension-polyfill": "^0.10.0" }, "devDependencies": { "@types/webextension-polyfill": "^0.10.0", - "exvite": "workspace:*" + "wxt": "workspace:*" } } diff --git a/demo/tsconfig.json b/demo/tsconfig.json index 7e9e895a..de6d2ff3 100644 --- a/demo/tsconfig.json +++ b/demo/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": ["../tsconfig.base.json", "./src/.exvite/tsconfig.json"] + "extends": ["../tsconfig.base.json", "./src/.wxt/tsconfig.json"] } diff --git a/demo/exvite.config.ts b/demo/wxt.config.ts similarity index 87% rename from demo/exvite.config.ts rename to demo/wxt.config.ts index a7f328bb..73ee77c1 100644 --- a/demo/exvite.config.ts +++ b/demo/wxt.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'exvite'; +import { defineConfig } from 'wxt'; export default defineConfig({ srcDir: 'src', diff --git a/e2e/tests/auto-imports.test.ts b/e2e/tests/auto-imports.test.ts index 46dac3d2..04ff06e3 100644 --- a/e2e/tests/auto-imports.test.ts +++ b/e2e/tests/auto-imports.test.ts @@ -16,11 +16,11 @@ describe('Auto Imports', () => { await project.build(); - expect(await project.serializeFile('.exvite/types/paths.d.ts')) + expect(await project.serializeFile('.wxt/types/paths.d.ts')) .toMatchInlineSnapshot(` - ".exvite/types/paths.d.ts + ".wxt/types/paths.d.ts ---------------------------------------- - // Generated by exvite + // Generated by wxt type EntrypointPath = | \\"/background.js\\" | \\"/content-scripts/overlay.js\\" @@ -35,18 +35,18 @@ describe('Auto Imports', () => { await project.build(); - expect(await project.serializeFile('.exvite/types/imports.d.ts')) + expect(await project.serializeFile('.wxt/types/imports.d.ts')) .toMatchInlineSnapshot(` - ".exvite/types/imports.d.ts + ".wxt/types/imports.d.ts ---------------------------------------- - // Generated by exvite + // Generated by wxt export {} declare global { const browser: typeof import('webextension-polyfill') - const defineBackgroundScript: typeof import('exvite/client')['defineBackgroundScript'] - const defineConfig: typeof import('exvite')['defineConfig'] - const defineContentScript: typeof import('exvite/client')['defineContentScript'] - const mountContentScriptUi: typeof import('exvite/client')['mountContentScriptUi'] + const defineBackgroundScript: typeof import('wxt/client')['defineBackgroundScript'] + const defineConfig: typeof import('wxt')['defineConfig'] + const defineContentScript: typeof import('wxt/client')['defineContentScript'] + const mountContentScriptUi: typeof import('wxt/client')['mountContentScriptUi'] } " `); diff --git a/e2e/tests/remote-code.test.ts b/e2e/tests/remote-code.test.ts index 0d65dfc5..ab49c355 100644 --- a/e2e/tests/remote-code.test.ts +++ b/e2e/tests/remote-code.test.ts @@ -16,7 +16,7 @@ describe('Remote Code', () => { ); expect(output).not.toContain(url); expect( - await project.fileExists(`.exvite/cache/${encodeURIComponent(url)}`), + await project.fileExists(`.wxt/cache/${encodeURIComponent(url)}`), ).toBe(true); }); }); diff --git a/e2e/utils.ts b/e2e/utils.ts index 2844af80..3b4c0260 100644 --- a/e2e/utils.ts +++ b/e2e/utils.ts @@ -10,7 +10,7 @@ export class TestProject { private readonly root: string; constructor(root = 'e2e/project') { - // We can't put each test's project inside e2e/project directly, otherwise the exvite.config.ts + // We can't put each test's project inside e2e/project directly, otherwise the wxt.config.ts // file is cached and cannot be different between each test. Instead, we add a random ID to the // end to make each test's path unique. const id = Math.random().toString(32).substring(3); @@ -23,7 +23,7 @@ export class TestProject { description: 'Example description', version: '0.0.0-test', dependencies: { - exvite: '../../..', + wxt: '../../..', }, }, null, @@ -33,13 +33,13 @@ export class TestProject { } /** - * Add a `exvite.config.ts` to the project with specific contents. + * Add a `wxt.config.ts` to the project with specific contents. */ setConfigFileConfig(config: UserConfig = {}) { this.config = config; this.files.push([ - 'exvite.config.ts', - `import { defineConfig } from 'exvite'\n\nexport default defineConfig(${JSON.stringify( + 'wxt.config.ts', + `import { defineConfig } from 'wxt'\n\nexport default defineConfig(${JSON.stringify( config, null, 2, @@ -86,12 +86,12 @@ export class TestProject { } /** - * Read all the files from the test project's `.exvite` directory and combine them into a string + * Read all the files from the test project's `.wxt` directory and combine them into a string * that can be used in a snapshot. */ - serializeExviteDir(): Promise { + serializeWxtDir(): Promise { return this.serializeDir( - resolve(this.config?.srcDir ?? this.root, '.exvite/types'), + resolve(this.config?.srcDir ?? this.root, '.wxt/types'), ); } diff --git a/package.json b/package.json index 6d63cc5d..7300f333 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "exvite", + "name": "wxt", "type": "module", "version": "0.1.0", - "description": "Modern JS framework for building web extensions", + "description": "Next gen framework for building web extensions", "keywords": [ "vite", "chrome", @@ -34,7 +34,7 @@ } }, "scripts": { - "exvite": "tsx src/cli/index.ts", + "wxt": "tsx src/cli/index.ts", "build": "run-s -s build:*", "build:js": "tsup src/index.ts --sourcemap --dts --format esm,cjs", "build:cli": "tsup src/cli/index.ts -d dist/cli --sourcemap", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fb8ef81b..d4253211 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,13 +61,13 @@ importers: demo: specifiers: '@types/webextension-polyfill': ^0.10.0 - exvite: workspace:* + wxt: workspace:* webextension-polyfill: ^0.10.0 dependencies: webextension-polyfill: 0.10.0 devDependencies: '@types/webextension-polyfill': 0.10.0 - exvite: link:.. + wxt: link:.. packages: /@ampproject/remapping/2.2.1: diff --git a/src/cli/commands/build.ts b/src/cli/commands/build.ts index 0f7ea388..5aea9503 100644 --- a/src/cli/commands/build.ts +++ b/src/cli/commands/build.ts @@ -1,12 +1,12 @@ -import * as exvite from '../..'; +import * as wxt from '../..'; import { getInternalConfig } from '../../utils/getInternalConfig'; import { defineCommand } from '../utils/defineCommand'; export const build = defineCommand( async (root: any, { mode, config: configFile }: any) => { - const cliConfig: exvite.InlineConfig = { root, mode, configFile }; + const cliConfig: wxt.InlineConfig = { root, mode, configFile }; const config = await getInternalConfig(cliConfig, mode); - await exvite.build(config); + await wxt.build(config); }, ); diff --git a/src/cli/commands/dev.ts b/src/cli/commands/dev.ts index 3c9da881..a6003fd7 100644 --- a/src/cli/commands/dev.ts +++ b/src/cli/commands/dev.ts @@ -1,14 +1,14 @@ -import * as exvite from '../..'; +import * as wxt from '../..'; import { defineCommand } from '../utils/defineCommand'; export const dev = defineCommand( async (root: any, { mode, config: configFile }: any) => { - const cliConfig: exvite.InlineConfig = { + const cliConfig: wxt.InlineConfig = { mode, root, configFile, }; - const server = await exvite.createServer(cliConfig); + const server = await wxt.createServer(cliConfig); await server.listen(server.port); server.logger.success(`Started dev server @ ${server.origin}`); diff --git a/src/cli/commands/init.ts b/src/cli/commands/init.ts index 2d38a08c..45253a39 100644 --- a/src/cli/commands/init.ts +++ b/src/cli/commands/init.ts @@ -2,5 +2,5 @@ import { consola } from 'consola'; import { defineCommand } from '../utils/defineCommand'; export const init = defineCommand(async (directory: any) => { - consola.warn('exvite init: Not implemented'); + consola.warn('wxt init: Not implemented'); }); diff --git a/src/cli/commands/prepare.ts b/src/cli/commands/prepare.ts index d6a41125..1c341fd2 100644 --- a/src/cli/commands/prepare.ts +++ b/src/cli/commands/prepare.ts @@ -2,11 +2,11 @@ import { getInternalConfig } from '../../utils/getInternalConfig'; import { findEntrypoints } from '../../utils/findEntrypoints'; import { generateTypesDir } from '../../utils/generateTypesDir'; import { defineCommand } from '../utils/defineCommand'; -import * as exvite from '../..'; +import * as wxt from '../..'; export const prepare = defineCommand( async (root: any, { mode, config: configFile }: any) => { - const cliConfig: exvite.InlineConfig = { root, mode, configFile }; + const cliConfig: wxt.InlineConfig = { root, mode, configFile }; const config = await getInternalConfig(cliConfig, 'build'); config.logger.info('Generating types...'); diff --git a/src/cli/commands/publish.ts b/src/cli/commands/publish.ts index acd8088a..281be606 100644 --- a/src/cli/commands/publish.ts +++ b/src/cli/commands/publish.ts @@ -3,6 +3,6 @@ import { defineCommand } from '../utils/defineCommand'; export const publish = defineCommand( async (root: any, { config: configFile }: any) => { - consola.warn('exvite publish: Not implemented'); + consola.warn('wxt publish: Not implemented'); }, ); diff --git a/src/cli/index.ts b/src/cli/index.ts index d20cd846..d4feaac8 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -4,7 +4,7 @@ import cac from 'cac'; import { version } from '../../package.json'; import * as commands from './commands'; -const cli = cac('exvite'); +const cli = cac('wxt'); cli.help(); cli.version(version); diff --git a/src/cli/utils/printHeader.ts b/src/cli/utils/printHeader.ts index d82278f0..35c4d934 100644 --- a/src/cli/utils/printHeader.ts +++ b/src/cli/utils/printHeader.ts @@ -3,5 +3,5 @@ import { version } from '../..'; import { consola } from 'consola'; export function printHeader() { - consola.log(`\n${pc.gray('Exvite')} ${pc.gray(pc.bold(version))}`); + consola.log(`\n${pc.gray('WXT')} ${pc.gray(pc.bold(version))}`); } diff --git a/src/index.ts b/src/index.ts index 23db49bf..7f49a896 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { BuildOutput, - ExviteDevServer, + WxtDevServer, InlineConfig, InternalConfig, } from './types'; @@ -30,7 +30,7 @@ export async function build(config: InlineConfig): Promise { export async function createServer( config?: InlineConfig, -): Promise { +): Promise { const port = await findOpenPort(3000, 3010); const hostname = 'localhost'; const origin = `http://${hostname}:${port}`; @@ -53,7 +53,7 @@ export async function createServer( if ( !path.startsWith(internalConfig.srcDir) || path.startsWith(internalConfig.outBaseDir) || - path.startsWith(internalConfig.exviteDir) + path.startsWith(internalConfig.wxtDir) ) return; @@ -61,7 +61,7 @@ export async function createServer( `${pc.green(eventName + ':')} ${relative(process.cwd(), path)}`, ); }); - const server: ExviteDevServer = { + const server: WxtDevServer = { ...viteServer, logger: internalConfig.logger, port, @@ -79,7 +79,11 @@ export async function createServer( async function buildInternal(config: InternalConfig): Promise { const verb = config.command === 'serve' ? 'Pre-rendering' : 'Building'; const target = `${config.browser}-mv${config.manifestVersion}`; - config.logger.info(`${verb} ${pc.cyan(target)} for ${pc.cyan(config.mode)}`); + config.logger.info( + `${verb} ${pc.cyan(target)} for ${pc.cyan(config.mode)} with ${pc.green( + `Vite ${vite.version}`, + )}`, + ); const startTime = Date.now(); // Cleanup diff --git a/src/types/external.ts b/src/types/external.ts index e6f691d0..736af75c 100644 --- a/src/types/external.ts +++ b/src/types/external.ts @@ -20,17 +20,17 @@ export interface InlineConfig { logger?: Logger; vite?: Omit; manifest?: UserManifest; - server?: ExviteDevServer; + server?: WxtDevServer; } -export interface ExviteInlineViteConfig +export interface WxtInlineViteConfig extends Omit { build?: Omit; } export type BuildOutput = (vite.Rollup.OutputChunk | vite.Rollup.OutputAsset)[]; -export interface ExviteDevServer extends vite.ViteDevServer { +export interface WxtDevServer extends vite.ViteDevServer { logger: Logger; port: number; hostname: string; @@ -152,7 +152,7 @@ export interface BackgroundScriptDefintition { } /** - * Manifest customization available in the `exvite.config.ts` file. Any missing fields like "name" + * Manifest customization available in the `wxt.config.ts` file. Any missing fields like "name" * and "version" are managed automatically, and don't need to be listed here. */ export type UserManifest = Omit< diff --git a/src/types/internal.ts b/src/types/internal.ts index b479dc65..bb8a05f8 100644 --- a/src/types/internal.ts +++ b/src/types/internal.ts @@ -1,7 +1,7 @@ import * as vite from 'vite'; import { Entrypoint, - ExviteDevServer, + WxtDevServer, Logger, TargetBrowser, TargetManifestVersion, @@ -13,7 +13,7 @@ export interface InternalConfig { root: string; srcDir: string; publicDir: string; - exviteDir: string; + wxtDir: string; typesDir: string; entrypointsDir: string; outBaseDir: string; @@ -32,7 +32,7 @@ export interface InternalConfig { vite: vite.InlineConfig; manifest: UserManifest; fsCache: FsCache; - server?: ExviteDevServer; + server?: WxtDevServer; } export type EntrypointGroup = Entrypoint | Entrypoint[]; diff --git a/src/utils/auto-imports.ts b/src/utils/auto-imports.ts index 4b33971a..f1c859fb 100644 --- a/src/utils/auto-imports.ts +++ b/src/utils/auto-imports.ts @@ -9,9 +9,9 @@ export function getUnimportOptions( debugLog: config.logger.debug, imports: [ { name: '*', as: 'browser', from: 'webextension-polyfill' }, - { name: 'defineConfig', from: 'exvite' }, + { name: 'defineConfig', from: 'wxt' }, ], - presets: [{ package: 'exvite/client' }], + presets: [{ package: 'wxt/client' }], warn: config.logger.warn, dirs: ['components', 'composables', 'hooks', 'utils'], }; diff --git a/src/utils/buildEntrypoints.ts b/src/utils/buildEntrypoints.ts index 4166d9c5..3a4a1636 100644 --- a/src/utils/buildEntrypoints.ts +++ b/src/utils/buildEntrypoints.ts @@ -40,7 +40,7 @@ async function buildSingleEntrypoint( // Should this entrypoint be wrapped by the vite-plugins/virtualEntrypoint plugin? const isVirtual = ['background', 'content-script'].includes(entrypoint.type); const entry = isVirtual - ? `virtual:exvite-${entrypoint.type}?${entrypoint.inputPath}` + ? `virtual:wxt-${entrypoint.type}?${entrypoint.inputPath}` : entrypoint.inputPath; const libMode: vite.InlineConfig = { @@ -106,7 +106,7 @@ async function buildMultipleEntrypoints( function getBuildOutput( result: Awaited>, ): BuildOutput { - if ('on' in result) throw Error('exvite does not support vite watch mode.'); + if ('on' in result) throw Error('wxt does not support vite watch mode.'); if (Array.isArray(result)) return result.flatMap(({ output }) => output); return result.output; } diff --git a/src/utils/createFsCache.ts b/src/utils/createFsCache.ts index cf99e130..b70bef55 100644 --- a/src/utils/createFsCache.ts +++ b/src/utils/createFsCache.ts @@ -3,14 +3,14 @@ import { FsCache } from '../types'; import { dirname, resolve } from 'path'; /** - * A basic file system cache stored at `/.exvite/cache/`. Just caches a string in a + * A basic file system cache stored at `/.wxt/cache/`. Just caches a string in a * file for the given key. * * @param srcDir Absolute path to source directory. See `InternalConfig.srcDir` */ -export function createFsCache(exviteDir: string): FsCache { +export function createFsCache(wxtDir: string): FsCache { const getPath = (key: string) => - resolve(exviteDir, 'cache', encodeURIComponent(key)); + resolve(wxtDir, 'cache', encodeURIComponent(key)); return { async set(key: string, value: string): Promise { diff --git a/src/utils/generateTypesDir.ts b/src/utils/generateTypesDir.ts index 86e73aa7..ce30151f 100644 --- a/src/utils/generateTypesDir.ts +++ b/src/utils/generateTypesDir.ts @@ -35,7 +35,7 @@ async function writeImportsDeclarationFile( await fs.writeFile( filePath, - ['// Generated by exvite', await unimport.generateTypeDeclarations()].join( + ['// Generated by wxt', await unimport.generateTypeDeclarations()].join( '\n', ) + '\n', ); @@ -52,7 +52,7 @@ async function writePathsDeclarationFile( await fs.writeFile( filePath, [ - '// Generated by exvite', + '// Generated by wxt', 'type EntrypointPath =', ...entrypoints .map((entry) => { @@ -78,7 +78,7 @@ async function writeGlobalsDeclarationFile( await fs.writeFile( filePath, [ - '// Generated by exvite', + '// Generated by wxt', 'export {}', 'declare global {', ...globals.map((global) => ` const ${global.name}: ${global.type};`), @@ -93,12 +93,12 @@ async function writeMainDeclarationFile( references: string[], config: InternalConfig, ): Promise { - const dir = config.exviteDir; - const filePath = resolve(dir, 'exvite.d.ts'); + const dir = config.wxtDir; + const filePath = resolve(dir, 'wxt.d.ts'); await fs.writeFile( filePath, [ - '// Generated by exvite', + '// Generated by wxt', ...references.map( (ref) => `/// `, ), @@ -111,7 +111,7 @@ async function writeTsConfigFile( mainReference: string, config: InternalConfig, ) { - const dir = config.exviteDir; + const dir = config.wxtDir; await fs.writeFile( resolve(dir, 'tsconfig.json'), `{ diff --git a/src/utils/getInternalConfig.ts b/src/utils/getInternalConfig.ts index 403f0f8b..98b27167 100644 --- a/src/utils/getInternalConfig.ts +++ b/src/utils/getInternalConfig.ts @@ -48,7 +48,7 @@ export async function getInternalConfig( if (config.configFile !== false) { userConfig = await importTsFile( root, - path.resolve(root, config.configFile ?? 'exvite.config.ts'), + path.resolve(root, config.configFile ?? 'wxt.config.ts'), ); } @@ -65,17 +65,17 @@ export async function getInternalConfig( userConfig.entrypointsDir ?? 'entrypoints', ); const publicDir = resolve(srcDir, userConfig.publicDir ?? 'public'); - const exviteDir = resolve(srcDir, '.exvite'); - const typesDir = resolve(exviteDir, 'types'); + const wxtDir = resolve(srcDir, '.wxt'); + const typesDir = resolve(wxtDir, 'types'); const finalConfig: InternalConfig = { ...merged, srcDir, entrypointsDir, publicDir, - exviteDir, + wxtDir: wxtDir, typesDir, - fsCache: createFsCache(exviteDir), + fsCache: createFsCache(wxtDir), }; // Customize the default vite config @@ -112,10 +112,5 @@ export async function getInternalConfig( */ type InternalConfigNoUserDirs = Omit< InternalConfig, - | 'srcDir' - | 'publicDir' - | 'entrypointsDir' - | 'exviteDir' - | 'typesDir' - | 'fsCache' + 'srcDir' | 'publicDir' | 'entrypointsDir' | 'wxtDir' | 'typesDir' | 'fsCache' >; diff --git a/src/utils/importTsFile.ts b/src/utils/importTsFile.ts index 02962c71..7749e73a 100644 --- a/src/utils/importTsFile.ts +++ b/src/utils/importTsFile.ts @@ -6,7 +6,7 @@ import { scanExports } from 'unimport'; export async function importTsFile(root: string, path: string): Promise { const clientImports = await scanExports( - resolve(root, 'node_modules/exvite/dist/client/index.js'), + resolve(root, 'node_modules/wxt/dist/client/index.js'), ); const jiti = createJITI(__filename, { cache: false, @@ -21,7 +21,7 @@ export async function importTsFile(root: string, path: string): Promise { '', ); - // Append any exvite/client functions so babel doesn't complain about undefined variables + // Append any wxt/client functions so babel doesn't complain about undefined variables if (opts.filename === path) { // TODO: Only append import if it isn't already imported const imports = diff --git a/src/vite-plugins/devHtmlPrerender.ts b/src/vite-plugins/devHtmlPrerender.ts index 7290860c..2c81396f 100644 --- a/src/vite-plugins/devHtmlPrerender.ts +++ b/src/vite-plugins/devHtmlPrerender.ts @@ -10,7 +10,7 @@ import { dirname, isAbsolute, relative, resolve } from 'path'; export function devHtmlPrerender(config: InternalConfig): vite.Plugin { return { apply: 'build', - name: 'exvite:dev-html-prerender', + name: 'wxt:dev-html-prerender', async transform(html, id) { const server = config.server; if (config.command !== 'serve' || server == null || !id.endsWith('.html')) diff --git a/src/vite-plugins/download.ts b/src/vite-plugins/download.ts index 7c7c77f5..ef89f8fd 100644 --- a/src/vite-plugins/download.ts +++ b/src/vite-plugins/download.ts @@ -11,7 +11,7 @@ import { fetchCached } from '../utils/network'; */ export function download(config: InternalConfig): Plugin { return { - name: 'exvite:download', + name: 'wxt:download', resolveId(id) { if (id.startsWith('url:')) return '\0' + id; }, diff --git a/src/vite-plugins/multipageMove.ts b/src/vite-plugins/multipageMove.ts index 616d5bd4..c54f5b26 100644 --- a/src/vite-plugins/multipageMove.ts +++ b/src/vite-plugins/multipageMove.ts @@ -20,7 +20,7 @@ export function multipageMove( config: InternalConfig, ): vite.Plugin { return { - name: 'exvite:multipage-move', + name: 'wxt:multipage-move', async writeBundle(_, bundle) { for (const oldBundlePath in bundle) { // oldBundlePath = 'entrypoints/popup.html' or 'entrypoints/o ptions/index.html' diff --git a/src/vite-plugins/unimport.ts b/src/vite-plugins/unimport.ts index 6690e348..16818ac3 100644 --- a/src/vite-plugins/unimport.ts +++ b/src/vite-plugins/unimport.ts @@ -11,7 +11,7 @@ export function unimport(config: InternalConfig): Plugin { const unimport = createUnimport(options); return { - name: 'exvite:unimport', + name: 'wxt:unimport', async config() { await unimport.scanImportsFromDir(undefined, { cwd: config.srcDir }); }, diff --git a/src/vite-plugins/virtualEntrypoint.ts b/src/vite-plugins/virtualEntrypoint.ts index 66225b5f..cf8fe6e6 100644 --- a/src/vite-plugins/virtualEntrypoint.ts +++ b/src/vite-plugins/virtualEntrypoint.ts @@ -10,11 +10,11 @@ export function virtualEntrypoin( type: Entrypoint['type'], config: InternalConfig, ): Plugin { - const virtualId = `virtual:exvite-${type}?`; + const virtualId = `virtual:wxt-${type}?`; const resolvedVirtualId = `\0${virtualId}`; return { - name: `exvite:virtual-entrypoint`, + name: `wxt:virtual-entrypoint`, resolveId(id) { // Id doesn't start with prefix, it looks like this: // /path/to/project/virtual:background?/path/to/project/entrypoints/background.ts @@ -29,10 +29,7 @@ export function virtualEntrypoin( const inputPath = id.replace(resolvedVirtualId, ''); const template = await fs.readFile( - resolve( - config.root, - `node_modules/exvite/templates/virtual-${type}.ts`, - ), + resolve(config.root, `node_modules/wxt/templates/virtual-${type}.ts`), 'utf-8', ); return template.replaceAll('{{moduleId}}', inputPath);