Skip to content

fix(zip): resolve sources file list against sourcesRoot for stats - #2628

Merged
aklinker1 merged 3 commits into
wxt-dev:mainfrom
dvd233:fix/zip-sources-file-list-2626
Oct 4, 2026
Merged

aklinker1 merged 3 commits into
wxt-dev:mainfrom
dvd233:fix/zip-sources-file-list-2626

Conversation

@dvd233

@dvd233 dvd233 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

What

Fixes #2626 — wxt zip prints one Could not get stats ... ENOENT warning per source file whenever zip.sourcesRoot is not the extension folder (e.g. a pnpm monorepo that zips workspace files for reviewers).

Root cause

zipDir() returns paths relative to zip.sourcesRoot, and zip() passes them to printFileList(log, header, sourcesRoot, files). printFileList then called lstat(file) directly, resolving the relative paths against the process cwd (the extension folder) instead of baseDir:

  • every source file logged WARN Could not get stats of '...' ENOENT;
  • sizes were missing from the listing;
  • a same-named file in the extension folder (e.g. package.json) would silently report the wrong file's size.

Fix

printFileList now resolves each entry against its baseDir before lstat and display. The other two callers (printBuildSummary, the final zip listing) already pass absolute paths and are unaffected because path.resolve(baseDir, abs) returns them unchanged.

Verification

  • Unit (red → green): new src/core/utils/log/__tests__/printFileList.test.ts — the baseDir-relative case warns with ENOENT and loses sizes on main, passes after the fix (no warnings, correct per-file sizes and Σ Total size); the absolute-path case passes before and after.
  • Real CLI A/B on a monorepo fixture (sourcesRoot: '..' with LICENSE, shared/util.ts, ext/entrypoints/background.ts):
    • Before: 3 Could not get stats ENOENT warnings, no sizes, doubled display prefixes.
    • After: no warnings, correct sizes (16 B / 43 B / 19 B, Σ 78 B), clean listing.
  • packages/wxt unit suites: src/core/utils/log + src/core/utils/__tests__ 18 files all pass; full vitest run 48 passed / 4 pre-existing environment failures (react/zip e2e and bun package-manager utils fail identically on unmodified main — they spawn real installs/builds); tsdown build, oxlint (0 errors), and Prettier all clean.

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
@dvd233
dvd233 requested a review from aklinker1 as a code owner September 22, 2026 15:15
@netlify

netlify Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 26c0820
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6ac1ddb8e92ca40008cb7262
😎 Deploy Preview https://deploy-preview-2628--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Sep 22, 2026

@fkatsuhiro fkatsuhiro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Make sense! Thank you.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 672f1b34-fbe7-4d1e-ba3c-9ff3733887d0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@aklinker1
aklinker1 enabled auto-merge (squash) October 4, 2026 05:01
@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wxt-dev/analytics

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

@wxt-dev/auto-icons

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

@wxt-dev/browser

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

@wxt-dev/i18n

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

@wxt-dev/is-background

npm i https://pkg.pr.new/@wxt-dev/is-background@2628

@wxt-dev/module-react

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

@wxt-dev/module-solid

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

@wxt-dev/module-svelte

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

@wxt-dev/module-vue

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

@wxt-dev/runner

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

@wxt-dev/storage

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

@wxt-dev/unocss

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

@wxt-dev/webextension-polyfill

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

wxt

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

commit: 26c0820

@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.52%. Comparing base (a747b9c) to head (26c0820).
⚠️ Report is 22 commits behind head on main.

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.
📢 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.

@aklinker1
aklinker1 merged commit 1e6a139 into wxt-dev:main Oct 4, 2026
28 of 29 checks passed
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for helping make WXT better!

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

Labels

pkg/wxt Includes changes to the `packages/wxt` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The zip command prints "Could not get stats" warnings when the sources root is not the extension folder

3 participants