chore: Remove unused code (#2087)

Co-authored-by: Patryk Kuniczak <p.kuniczak@gmail.com>
This commit is contained in:
Aaron
2026-02-09 01:45:11 -06:00
committed by GitHub
parent 07a4ba8bc5
commit 5a028d2551
10 changed files with 6 additions and 31 deletions
-8
View File
@@ -138,14 +138,6 @@ export class TestProject {
return this.serializeDir('.output', ignoreContentsOfFilenames);
}
/**
* Read all the files from the test project's `.wxt` directory and combine them into a string
* that can be used in a snapshot.
*/
serializeWxtDir(): Promise<string> {
return this.serializeDir(resolve(this.root, '.wxt/types'));
}
/**
* Deeply print the filename and contents of all files in a directory.
*
@@ -207,10 +207,6 @@ interface ExtensionReload extends RebuildChange {
type: 'extension-reload';
}
// interface BrowserRestart extends RebuildChange {
// type: 'browser-restart';
// }
interface ContentScriptReload extends RebuildChange {
type: 'content-script-reload';
changedSteps: BuildStepOutput[];
@@ -133,8 +133,8 @@ function printValidationResults({
}, new Map<Entrypoint, ValidationResult[]>());
Array.from(entrypointErrors.entries()).forEach(([entrypoint, errors]) => {
wxt.logger.log(relative(cwd, entrypoint.inputPath));
console.log();
wxt.logger.log(relative(cwd, entrypoint.inputPath) + '\n');
errors.forEach((err) => {
const type = err.type === 'error' ? pc.red('ERROR') : pc.yellow('WARN');
const received = pc.dim(`(received: ${JSON.stringify(err.value)})`);
@@ -3,6 +3,5 @@ import { version } from '../../../version';
import { consola } from 'consola';
export function printHeader() {
console.log();
consola.log(`${pc.gray('WXT')} ${pc.gray(pc.bold(version))}`);
consola.log(`\n${pc.gray('WXT')} ${pc.gray(pc.bold(version))}`);
}
@@ -14,7 +14,6 @@ import {
OptionsEntrypoint,
PopupEntrypoint,
OutputChunk,
OutputFile,
OutputAsset,
BuildOutput,
BuildStepOutput,
@@ -208,10 +207,6 @@ export const fakeOutputAsset = fakeObjectCreator<OutputAsset>(() => ({
fileName: fakeFileName(),
}));
export function fakeOutputFile(): OutputFile {
return faker.helpers.arrayElement([fakeOutputAsset(), fakeOutputChunk()]);
}
export const fakeManifest = fakeObjectCreator<Browser.runtime.Manifest>(() => ({
manifest_version: faker.helpers.arrayElement([2, 3]),
name: faker.string.alphanumeric(),
-3
View File
@@ -170,9 +170,6 @@ export function addImportPreset(
preset: UnimportOptions['presets'][0],
): void {
wxt.hooks.hook('config:resolved', (wxt) => {
// In older versions of WXT, `wxt.config.imports` could be false
if (!wxt.config.imports) return;
wxt.config.imports.presets ??= [];
// De-duplicate built-in named presets
if (wxt.config.imports.presets.includes(preset)) return;
@@ -19,7 +19,7 @@ export function createIframeUi<TMounted>(
iframe.src = browser.runtime.getURL(options.page);
wrapper.appendChild(iframe);
let mounted: TMounted | undefined = undefined;
let mounted: TMounted | undefined;
const mount = () => {
applyPosition(wrapper, iframe, options);
options.onBeforeMount?.(wrapper, iframe);
@@ -14,7 +14,7 @@ export function createIntegratedUi<TMounted>(
): IntegratedContentScriptUi<TMounted> {
const wrapper = document.createElement(options.tag || 'div');
let mounted: TMounted | undefined = undefined;
let mounted: TMounted | undefined;
const mount = () => {
applyPosition(wrapper, undefined, options);
mountUi(wrapper, options);
@@ -108,7 +108,6 @@ export function mountUi(
break;
default:
options.append(anchor, root);
break;
}
}
@@ -116,7 +115,7 @@ export function createMountFunctions<TMounted>(
baseFunctions: BaseMountFunctions,
options: ContentScriptUiOptions<TMounted>,
): MountFunctions {
let autoMountInstance: AutoMount | undefined = undefined;
let autoMountInstance: AutoMount | undefined;
const stopAutoMount = () => {
autoMountInstance?.stopAutoMount();
@@ -29,9 +29,6 @@ let ws: WxtWebSocket | undefined;
/**
* Connect to the websocket and listen for messages.
*
* @param onMessage Optional callback that is called when a message is recieved and we've verified
* it's structure is what we expect.
*/
export function getDevServerWebSocket(): WxtWebSocket {
if (import.meta.env.COMMAND !== 'serve')