Skip to content

Comments

fix: post-process parent directories of unpacked files#9419

Merged
mmaietta merged 31 commits intomasterfrom
fix/asar-unpacked
Dec 21, 2025
Merged

fix: post-process parent directories of unpacked files#9419
mmaietta merged 31 commits intomasterfrom
fix/asar-unpacked

Conversation

@mmaietta
Copy link
Collaborator

@mmaietta mmaietta commented Dec 4, 2025

Fixes: #9242

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: f354823

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Patch
dmg-builder Patch
electron-builder-squirrel-windows Patch
electron-builder Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mmaietta mmaietta changed the title fix: do not process parent directories of unpacked files fix: post-process parent directories of unpacked files Dec 7, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where parent directories were incorrectly marked as unpacked when packaging ASAR archives. The fix removes the automatic propagation of the unpacked flag to parent directories, allowing the electron/asar library to determine directory unpacked status automatically based on their contents.

Key Changes:

  • Refactored the two-pass directory processing logic to first create parent directories with unpacked: false, then propagate the flag (though this second step appears to be unintentionally retained)
  • Simplified the isUnpacked check to take additional parameters (file and stat) for more accurate unpacking decisions
  • Refactored helper methods and code organization for better clarity

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
packages/app-builder-lib/src/asar/asarUtil.ts Refactored ASAR packaging logic to use a Map-based approach instead of arrays, changed how parent directories are marked as unpacked, and simplified various helper methods
test/snapshots/globTest.js.snap Removed "unpacked": true flags from parent directories in multiple test cases, confirming that only files (not their parent directories) should be explicitly marked as unpacked
test/snapshots/HoistedNodeModuleTest.js.snap Removed "unpacked": true flag from parent directory, consistent with other snapshot changes
.changeset/light-flies-count.md Added changeset documenting the fix as a patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mmaietta mmaietta merged commit 1c94529 into master Dec 21, 2025
33 checks passed
@mmaietta mmaietta deleted the fix/asar-unpacked branch December 21, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some files are flagged as unpack: true in asar

1 participant