Skip to content

refactor: Clean code and make a couple small adjusts#2081

Open
PatrykKuniczak wants to merge 63 commits intowxt-dev:mainfrom
PatrykKuniczak:chore/clean-code
Open

refactor: Clean code and make a couple small adjusts#2081
PatrykKuniczak wants to merge 63 commits intowxt-dev:mainfrom
PatrykKuniczak:chore/clean-code

Conversation

@PatrykKuniczak
Copy link
Collaborator

@PatrykKuniczak PatrykKuniczak commented Feb 8, 2026

Overview

I've cherry-picked a couple commits from #2022(only related to code style and couple small things)

  1. Make code more readable
  2. Use pathExists instead of deprecated exists
  3. Simplify some statements
  4. Use strict check === instead == for some cases

Let's read my questions(which are placed in TODO: in code) and give me answers here

Manual Testing

Let's check if project starts and works(Should, all tests passed :))

@netlify
Copy link

netlify bot commented Feb 8, 2026

Deploy Preview for creative-fairy-df92c4 failed.

Name Link
🔨 Latest commit 9d5eeb7
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/698a410ba6ff3a000815a4f3

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

❌ Patch coverage is 81.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.93%. Comparing base (3a3953e) to head (3c2159d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...src/core/builders/vite/plugins/extensionApiMock.ts 16.66% 3 Missing and 2 partials ⚠️
...src/core/builders/vite/plugins/resolveAppConfig.ts 50.00% 1 Missing and 2 partials ⚠️
...ages/wxt/src/core/utils/building/internal-build.ts 57.14% 3 Missing ⚠️
...src/core/builders/vite/plugins/devHtmlPrerender.ts 75.00% 2 Missing ⚠️
packages/wxt/src/cli/cli-utils.ts 50.00% 0 Missing and 1 partial ⚠️
packages/wxt/src/core/create-server.ts 50.00% 1 Missing ⚠️
packages/wxt/src/core/package-managers/index.ts 50.00% 1 Missing ⚠️
packages/wxt/src/core/runners/web-ext.ts 0.00% 1 Missing ⚠️
...es/wxt/src/core/utils/building/find-entrypoints.ts 80.00% 1 Missing ⚠️
...ges/wxt/src/utils/content-script-ui/shadow-root.ts 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2081      +/-   ##
==========================================
- Coverage   76.13%   75.93%   -0.20%     
==========================================
  Files         113      113              
  Lines        3050     3046       -4     
  Branches      686      685       -1     
==========================================
- Hits         2322     2313       -9     
- Misses        645      648       +3     
- Partials       83       85       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PatrykKuniczak PatrykKuniczak changed the title Chore: Clean code and make a couple small adjusts chore: Clean code and make a couple small adjusts Feb 8, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 8, 2026

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@2081

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@2081

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2081

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@2081

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@2081

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@2081

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@2081

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@2081

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2081

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@2081

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@2081

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2081

wxt

npm i https://pkg.pr.new/wxt@2081

commit: bf4be42

@PatrykKuniczak PatrykKuniczak changed the title chore: Clean code and make a couple small adjusts refactor: Clean code and make a couple small adjusts Feb 8, 2026
@PatrykKuniczak PatrykKuniczak enabled auto-merge (squash) February 8, 2026 13:33
@PatrykKuniczak
Copy link
Collaborator Author

@aklinker1 I HOPE, this is split good enough, i'll create second PR with types refactor, after this will be merged :)

Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's lots of good changes in this PR, but also lots of unnecessary ones, changes to production behavior, and breaking changes. I left lots of comments, but there were so many files I stopped leaving comments half-way through.

I asked for the original PR to be broken up because of the variety of changes, but I don't think you broke it apart enough. Probably my fault, I didn't indicate enough what should have been in each PR.

I'm going to go through and pull out all the changes I 100% want from this PR into their own PRs, then once they are merged and this PR is updated, we can talk about the rest of the changes here.

@PatrykKuniczak
Copy link
Collaborator Author

@aklinker1 Also sorry for this checks ===, i've though that need to check only strictly null, tests passed and i've though it's alright

@PatrykKuniczak
Copy link
Collaborator Author

@aklinker1 After you'll merge your PRs, i'll rebase it here, and we'll be able to rename this PR and merge a couple things, which'll be left

@aklinker1
Copy link
Member

PRs created. This is what I expect if you're doing large refactors.

image

@aklinker1
Copy link
Member

OK, PRs merged

@PatrykKuniczak
Copy link
Collaborator Author

@aklinker1 Thanks, i'm very busy on the start of this week, but i'll rebase it and make other smaller PRs, to finish this job and i'll create also a couple for types.

I have been trying my best, to fit to this project, but i need much more time, because after this week, i'll have new job and then i'll be able to work on project only on weekends and for sure, not each.

Anyway, I hope i'll be able to put some value into project :)

PatrykKuniczak and others added 23 commits February 9, 2026 21:11
Co-authored-by: Aaron <aaronklinker1@gmail.com>
Co-authored-by: Aaron <aaronklinker1@gmail.com>
Co-authored-by: Aaron <aaronklinker1@gmail.com>
Co-authored-by: Aaron <aaronklinker1@gmail.com>
}

ensureDir(resolve(outputFolder, 'icons'));
await ensureDir(resolve(outputFolder, 'icons'));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aklinker1 Are you want this await, this can slow down, but really not much.
But if it don't exist error can occur and stops everything there.

Maybe additionally covert it with try/catch and output info???


// TODO: Remove once https://github.com/wxt-dev/wxt/pull/1411 is merged
config.legacy ??= {};
// @ts-ignore: Untyped option:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, it works fine for me:

Image

Let's check on your machine

const server = await vite.createServer(config);
await server.pluginContainer.buildStart({});
const node = new ViteNodeServer(
// @ts-ignore: Some weird type error...
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here, no error:

Image

@PatrykKuniczak
Copy link
Collaborator Author

@aklinker1 One more(I hope) iteration here, let's read all of unresolved conversation and i'll be able to do sth and close this shit.

Thanks for your pacient ❤️
If in the future, i'll want to do sth like thi, i'll open issue before, sorry

@PatrykKuniczak
Copy link
Collaborator Author

@aklinker1 Let's read it last more time, and if sth can go into main let's read about it, and i'm able to make new PR with it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants