Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Multiple package roots incorrectly collapse / don't prefix. #90

Closed
4 tasks
ryan-roemer opened this issue Oct 19, 2018 · 0 comments · Fixed by #88
Closed
4 tasks

BUG: Multiple package roots incorrectly collapse / don't prefix. #90

ryan-roemer opened this issue Oct 19, 2018 · 0 comments · Fixed by #88

Comments

@ryan-roemer
Copy link
Member

We have an existing multiple-roots test scenario that is wrong in the new plugin:

Plugin

Notice the two foo/index.js (I, 54) for 1.1.1. There should be a separate package2 root, that we need to handle differently

## bundle.js
foo (Found 2 resolved, 2 installed. Latest version 1.1.1.)
  3.3.3
    ~/different-foo/~/foo
      * Dependency graph
        [email protected] -> different-foo@^1.0.1 -> foo@^3.0.1
      * Duplicated files in bundle.js
        foo/index.js (S, 64)

  1.1.1
    ~/foo
      * Dependency graph
        [email protected] -> foo@^1.0.0
      * Duplicated files in bundle.js
        foo/index.js (I, 54)
        foo/index.js (I, 54)

CLI

Versions:

$ node bin/inspectpack.js \
  --action=versions \
  --stats=test/fixtures/multiple-roots/dist-development-4/stats.json \
  -f text

inspectpack --action=versions
=============================

## Summary
* Packages w/ Skews:        1
* Total skewed versions:    2
* Total installed packages: 2
* Total depended packages:  2
* Total bundled files:      4

## `bundle.js`
* foo
  * 1.1.1
    * ~/foo
      * Num deps: 1, files: 2
      * [email protected] -> foo@^1.0.0
  * 3.3.3
    * ~/different-foo/~/foo
      * Num deps: 1, files: 2
      * [email protected] -> different-foo@^1.0.1 -> foo@^3.0.1

Duplicates:

$ node bin/inspectpack.js \
  --action=duplicates \
  --stats=test/fixtures/multiple-roots/dist-development-4/stats.json \
  -f text

inspectpack --action=duplicates
===============================

## Summary
* Extra Files (unique):         2
* Extra Sources (non-unique):   3
* Extra Bytes (non-unique):     172

## `bundle.js`
* foo/index.js
  * Meta: Files 2, Sources 3, Bytes 172
  0. (Files 1, Sources 1, Bytes 64)
    (64) /Users/rye/scm/fmd/inspectpack/test/fixtures/multiple-roots/node_modules/different-foo/node_modules/foo/index.js
  1. (Files 1, Sources 2, Bytes 108)
    (54) /Users/rye/scm/fmd/inspectpack/test/fixtures/multiple-roots/packages/package1/node_modules/foo/index.js
    (54) /Users/rye/scm/fmd/inspectpack/test/fixtures/multiple-roots/packages/package2/node_modules/foo/index.js

Task

Deal with this scenario:

  • ./packages/package1/node_modules/foo/index.js
  • ./packages/package2/node_modules/foo/index.js
  • ./node_modules/different-foo/node_modules/foo/index.js

in the following way:

  • Fix for CLI
  • Fix for Plugin
  • Without collapsing different things on disk.
  • Some sensible way of distinguishing package1 from package2.
ryan-roemer added a commit that referenced this issue Oct 29, 2018
### Breaking changes
 * `--action=versions`:
    * _Reports_: The `tsv` and `text` reports have now changed to reflect
      dependencies hierarchies as _installed_ (e.g., `[email protected] ->
      [email protected] -> @scope/[email protected]`) to a semever range meaning
      something like as _depended_ (e.g., `[email protected] -> flattened-foo@^1.1.0
      -> @scope/foo@^1.1.1`). We expect that this change will provide much more
      useful information as to how and why your dependency graph impacts what is
      installed on disk in `node_modules` and ultimately what ends up in your
      webpack bundle.
    * _Metadata_: The following `meta` fields have been renamed to be easier
      to understand.
        * `skewedPackages` → `packages`: Number of packages with skews.
        * `skewedVersions` → `resolved`: Number of unique resolved versions.
        * `installedPackages` → `installed`: Number of on-disk installs.
        * `dependedPackages` → `depended`: Number of dependency paths.

### Features
* Add `range` information to all dependency items returned internally for
  dependencies utilities and ultimately all the way to `versions` data.
* Add `installed` aggregate statistic to `versions` metadata.
* Add `DuplicatesPlugin` webpack plugin.

### Fixes
* BUG: Per-asset `meta` stats were never set (all `0`) before in data.
* BUG: Multiple package roots incorrectly collapse / don't prefix. Fixes #90 

### Miscellaneous
- Updated README.md with note that `--action=versions` is not filtered to only
  packages that would have files show up in the `--action=duplicates` report.
- Update `--action=versions` logic to explicitly use `semver-compare` for sort
  order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant