Repository navigation
fix(zip): resolve sources file list against sourcesRoot for stats - #2628
Conversation
When zip.sourcesRoot differs from the extension directory (e.g. a pnpm monorepo where reviewers need workspace files), zipDir returns paths relative to sourcesRoot, but printFileList read stats and display names straight from the process cwd. Every source file logged a 'Could not get stats' ENOENT warning, sizes were missing, and a same-named file in the extension folder would report the wrong size. printFileList now resolves each entry against its baseDir before lstat and display. Absolute entries (build summary, final zip list) are unaffected because path.resolve returns them unchanged. Adds unit tests covering baseDir-relative entries (no warnings, correct per-file and total sizes) and absolute entries. Fixes wxt-dev#2626
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
fkatsuhiro
left a comment
There was a problem hiding this comment.
Make sense! Thank you.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
@wxt-dev/analytics
@wxt-dev/auto-icons
@wxt-dev/browser
@wxt-dev/i18n
@wxt-dev/is-background
@wxt-dev/module-react
@wxt-dev/module-solid
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/runner
@wxt-dev/storage
@wxt-dev/unocss
@wxt-dev/webextension-polyfill
wxt
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2628 +/- ##
==========================================
- Coverage 79.54% 79.52% -0.02%
==========================================
Files 135 138 +3
Lines 4048 4093 +45
Branches 943 941 -2
==========================================
+ Hits 3220 3255 +35
- Misses 732 739 +7
- Partials 96 99 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for helping make WXT better! |
What
Fixes #2626 —
wxt zipprints oneCould not get stats ... ENOENTwarning per source file wheneverzip.sourcesRootis not the extension folder (e.g. a pnpm monorepo that zips workspace files for reviewers).Root cause
zipDir()returns paths relative tozip.sourcesRoot, andzip()passes them toprintFileList(log, header, sourcesRoot, files).printFileListthen calledlstat(file)directly, resolving the relative paths against the process cwd (the extension folder) instead ofbaseDir:WARN Could not get stats of '...' ENOENT;package.json) would silently report the wrong file's size.Fix
printFileListnow resolves each entry against itsbaseDirbeforelstatand display. The other two callers (printBuildSummary, the final zip listing) already pass absolute paths and are unaffected becausepath.resolve(baseDir, abs)returns them unchanged.Verification
src/core/utils/log/__tests__/printFileList.test.ts— the baseDir-relative case warns with ENOENT and loses sizes onmain, passes after the fix (no warnings, correct per-file sizes andΣ Total size); the absolute-path case passes before and after.sourcesRoot: '..'withLICENSE,shared/util.ts,ext/entrypoints/background.ts):Could not get statsENOENT warnings, no sizes, doubled display prefixes.16 B/43 B/19 B,Σ 78 B), clean listing.packages/wxtunit suites:src/core/utils/log+src/core/utils/__tests__18 files all pass; fullvitest run48 passed / 4 pre-existing environment failures (react/zipe2e andbunpackage-manager utils fail identically on unmodifiedmain— they spawn real installs/builds);tsdownbuild, oxlint (0 errors), and Prettier all clean.