Skip to content

Conversation

@arcanis
Copy link
Member

@arcanis arcanis commented Sep 9, 2025

Zip archives may have directory entries baked within the archive:

        0  06-22-1984 21:50   node_modules/
        0  06-22-1984 21:50   node_modules/left-pad/
      646  06-22-1984 21:50   node_modules/left-pad/package.json
        0  06-22-1984 21:50   node_modules/left-pad/perf/
      216  06-22-1984 21:50   node_modules/left-pad/perf/es6Repeat.js

Or they may be missing:

      646  06-22-1984 21:50   node_modules/left-pad/package.json
      216  06-22-1984 21:50   node_modules/left-pad/perf/es6Repeat.js

In that second case we try to normalize the archive so that in both cases we end up with ["node_modules/", "node_modules/left-pad/", "node_modules/left-pad/perf/"] in the dirs set. Unfortunately the logic is bogus and we're not going over the very last component; so in this case, we would be missing the node_modules/left-pad/perf/ entry.

This is then causing issues when the package has a package.json in said directory, which happens for example for underscore (it contains a node_modules/underscore/modules/package.json file with "type": "module").

This PR fixes the issue and adds new tests.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

Benchmark for d6764b0

Click to view benchmark
Test Base PR %
vpath_edge_cases 2.7±0.08µs 2.8±0.30µs +3.70%
vpath_mixed_workload 4.9±0.19µs 4.8±0.16µs -2.04%
vpath_native 1566.2±72.80ns 1563.3±68.31ns -0.19%
vpath_virtual 3.6±0.11µs 3.6±0.18µs 0.00%
vpath_virtual_zip 2.9±0.08µs 2.9±0.10µs 0.00%
vpath_zip 2.0±0.08µs 2.0±0.12µs 0.00%

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

Benchmark for 2943924

Click to view benchmark
Test Base PR %
vpath_edge_cases 2.8±0.16µs 2.7±0.16µs -3.57%
vpath_mixed_workload 4.9±0.44µs 4.8±0.24µs -2.04%
vpath_native 1576.9±145.60ns 1583.6±108.50ns +0.42%
vpath_virtual 3.6±0.21µs 3.6±0.17µs 0.00%
vpath_virtual_zip 3.0±0.17µs 2.9±0.14µs -3.33%
vpath_zip 2.1±0.16µs 2.1±0.13µs 0.00%

@arcanis arcanis merged commit 3a51bee into main Sep 9, 2025
6 checks passed
@arcanis arcanis deleted the mael/zip-implicit-folders branch September 9, 2025 16:31
@github-actions github-actions bot mentioned this pull request Sep 7, 2025
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