Skip to content

Commit

Permalink
BUG: hidden app roots (v2) (#107)
Browse files Browse the repository at this point in the history
* Add `commonRoot` to `versions` metadata to indicate what installed paths are relative to.
* BUG: Detect hidden application roots for things like `yarn` workspaces that are completely flattened.
  [#103](#103)
  • Loading branch information
ryan-roemer authored Mar 26, 2019
1 parent fe5e41f commit 0c2e588
Show file tree
Hide file tree
Showing 24 changed files with 1,106 additions and 157 deletions.
20 changes: 13 additions & 7 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
History
=======

## UNRELEASED

* Add `commonRoot` to `versions` metadata to indicate what installed paths are relative to.
* BUG: Detect hidden application roots for things like `yarn` workspaces that are completely flattened.
[#103](https://github.com/FormidableLabs/inspectpack/issues/103)

## 4.1.2

- BUG: Use `name` field to better process `identifier` to remove things like
* BUG: Use `name` field to better process `identifier` to remove things like
`/PATH/TO/node_modules/font-awesome/font-awesome.css 0"`. May result in some
`baseName`s being identical despite different `identifier`s because of
loaders and generated code.

## 4.1.1

- BUG: A loader in the `identifier` field would incorrectly have all modules inferred "as a `node_modules` file", even if not. Implements a naive loader stripping heuristic to correctly assess if `node_modules` or real application source.
- Optimizes internal calls to `_isNodeModules()` from 2 to 1 for better performance.
* BUG: A loader in the `identifier` field would incorrectly have all modules inferred "as a `node_modules` file", even if not. Implements a naive loader stripping heuristic to correctly assess if `node_modules` or real application source.
* Optimizes internal calls to `_isNodeModules()` from 2 to 1 for better performance.

## 4.1.0

- Add `emitHandler` option to `DuplicatesPlugin` to allow customized output.
* Add `emitHandler` option to `DuplicatesPlugin` to allow customized output.

## 4.0.1

Expand All @@ -29,7 +35,7 @@ History
* `--action=versions`:
* _Reports_: The `tsv` and `text` reports have now changed to reflect
dependencies hierarchies as _installed_ (e.g., `[email protected] ->
[email protected] -> @scope/foo@1.1.1`) to a semever range meaning
[email protected] -> @scope/foo@1.1.1`) to a semver 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
Expand Down Expand Up @@ -57,9 +63,9 @@ History

### Miscellaneous

- Updated README.md with note that `--action=versions` is not filtered to only
* 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
* Update `--action=versions` logic to explicitly use `semver-compare` for sort
order.

## 3.0.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ Other tools that inspect Webpack bundles:

[npm_img]: https://badge.fury.io/js/inspectpack.svg
[npm_site]: http://badge.fury.io/js/inspectpack
[trav_img]: https://api.travis-ci.org/FormidableLabs/inspectpack.svg
[trav_site]: https://travis-ci.org/FormidableLabs/inspectpack
[trav_img]: https://api.travis-ci.com/FormidableLabs/inspectpack.svg
[trav_site]: https://travis-ci.com/FormidableLabs/inspectpack
[appveyor_img]: https://ci.appveyor.com/api/projects/status/github/formidablelabs/inspectpack?branch=master&svg=true
[appveyor_site]: https://ci.appveyor.com/project/FormidableLabs/inspectpack
[cov]: https://codecov.io
Expand Down
6 changes: 6 additions & 0 deletions src/lib/actions/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export const _isNodeModules = (name: string): boolean => nodeModulesParts(name).
// First, strip off anything before a `?` and `!`:
// - `REMOVE?KEEP`
// - `REMOVE!KEEP`
//
// TODO(106): Revise code and tests for `fullPath`.
// https://github.com/FormidableLabs/inspectpack/issues/106
export const _normalizeWebpackPath = (identifier: string, name?: string): string => {
const bangLastIdx = identifier.lastIndexOf("!");
const questionLastIdx = identifier.lastIndexOf("?");
Expand All @@ -63,6 +66,9 @@ export const _normalizeWebpackPath = (identifier: string, name?: string): string
candidate = candidate.substr(prefixEnd + 1);
}

// Naive heuristic: remove known starting webpack tokens.
candidate = candidate.replace(/^(multi |ignored )/, "");

// Assume a normalized then truncate to name if applicable.
//
// E.g.,
Expand Down
Loading

0 comments on commit 0c2e588

Please sign in to comment.