Skip to content

Commit 5a028d2

Browse files
chore: Remove unused code (#2087)
Co-authored-by: Patryk Kuniczak <p.kuniczak@gmail.com>
1 parent 07a4ba8 commit 5a028d2

10 files changed

Lines changed: 6 additions & 31 deletions

File tree

packages/wxt/e2e/utils.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,6 @@ export class TestProject {
138138
return this.serializeDir('.output', ignoreContentsOfFilenames);
139139
}
140140

141-
/**
142-
* Read all the files from the test project's `.wxt` directory and combine them into a string
143-
* that can be used in a snapshot.
144-
*/
145-
serializeWxtDir(): Promise<string> {
146-
return this.serializeDir(resolve(this.root, '.wxt/types'));
147-
}
148-
149141
/**
150142
* Deeply print the filename and contents of all files in a directory.
151143
*

packages/wxt/src/core/utils/building/detect-dev-changes.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,6 @@ interface ExtensionReload extends RebuildChange {
207207
type: 'extension-reload';
208208
}
209209

210-
// interface BrowserRestart extends RebuildChange {
211-
// type: 'browser-restart';
212-
// }
213-
214210
interface ContentScriptReload extends RebuildChange {
215211
type: 'content-script-reload';
216212
changedSteps: BuildStepOutput[];

packages/wxt/src/core/utils/building/internal-build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ function printValidationResults({
133133
}, new Map<Entrypoint, ValidationResult[]>());
134134

135135
Array.from(entrypointErrors.entries()).forEach(([entrypoint, errors]) => {
136-
wxt.logger.log(relative(cwd, entrypoint.inputPath));
137-
console.log();
136+
wxt.logger.log(relative(cwd, entrypoint.inputPath) + '\n');
137+
138138
errors.forEach((err) => {
139139
const type = err.type === 'error' ? pc.red('ERROR') : pc.yellow('WARN');
140140
const received = pc.dim(`(received: ${JSON.stringify(err.value)})`);

packages/wxt/src/core/utils/log/printHeader.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ import { version } from '../../../version';
33
import { consola } from 'consola';
44

55
export function printHeader() {
6-
console.log();
7-
consola.log(`${pc.gray('WXT')} ${pc.gray(pc.bold(version))}`);
6+
consola.log(`\n${pc.gray('WXT')} ${pc.gray(pc.bold(version))}`);
87
}

packages/wxt/src/core/utils/testing/fake-objects.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
OptionsEntrypoint,
1515
PopupEntrypoint,
1616
OutputChunk,
17-
OutputFile,
1817
OutputAsset,
1918
BuildOutput,
2019
BuildStepOutput,
@@ -208,10 +207,6 @@ export const fakeOutputAsset = fakeObjectCreator<OutputAsset>(() => ({
208207
fileName: fakeFileName(),
209208
}));
210209

211-
export function fakeOutputFile(): OutputFile {
212-
return faker.helpers.arrayElement([fakeOutputAsset(), fakeOutputChunk()]);
213-
}
214-
215210
export const fakeManifest = fakeObjectCreator<Browser.runtime.Manifest>(() => ({
216211
manifest_version: faker.helpers.arrayElement([2, 3]),
217212
name: faker.string.alphanumeric(),

packages/wxt/src/modules.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ export function addImportPreset(
170170
preset: UnimportOptions['presets'][0],
171171
): void {
172172
wxt.hooks.hook('config:resolved', (wxt) => {
173-
// In older versions of WXT, `wxt.config.imports` could be false
174-
if (!wxt.config.imports) return;
175-
176173
wxt.config.imports.presets ??= [];
177174
// De-duplicate built-in named presets
178175
if (wxt.config.imports.presets.includes(preset)) return;

packages/wxt/src/utils/content-script-ui/iframe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function createIframeUi<TMounted>(
1919
iframe.src = browser.runtime.getURL(options.page);
2020
wrapper.appendChild(iframe);
2121

22-
let mounted: TMounted | undefined = undefined;
22+
let mounted: TMounted | undefined;
2323
const mount = () => {
2424
applyPosition(wrapper, iframe, options);
2525
options.onBeforeMount?.(wrapper, iframe);

packages/wxt/src/utils/content-script-ui/integrated.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function createIntegratedUi<TMounted>(
1414
): IntegratedContentScriptUi<TMounted> {
1515
const wrapper = document.createElement(options.tag || 'div');
1616

17-
let mounted: TMounted | undefined = undefined;
17+
let mounted: TMounted | undefined;
1818
const mount = () => {
1919
applyPosition(wrapper, undefined, options);
2020
mountUi(wrapper, options);

packages/wxt/src/utils/content-script-ui/shared.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,14 @@ export function mountUi(
108108
break;
109109
default:
110110
options.append(anchor, root);
111-
break;
112111
}
113112
}
114113

115114
export function createMountFunctions<TMounted>(
116115
baseFunctions: BaseMountFunctions,
117116
options: ContentScriptUiOptions<TMounted>,
118117
): MountFunctions {
119-
let autoMountInstance: AutoMount | undefined = undefined;
118+
let autoMountInstance: AutoMount | undefined;
120119

121120
const stopAutoMount = () => {
122121
autoMountInstance?.stopAutoMount();

packages/wxt/src/utils/internal/dev-server-websocket.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ let ws: WxtWebSocket | undefined;
2929

3030
/**
3131
* Connect to the websocket and listen for messages.
32-
*
33-
* @param onMessage Optional callback that is called when a message is recieved and we've verified
34-
* it's structure is what we expect.
3532
*/
3633
export function getDevServerWebSocket(): WxtWebSocket {
3734
if (import.meta.env.COMMAND !== 'serve')

0 commit comments

Comments
 (0)