Skip to content

Commit

Permalink
fix: can't recognize one package same version but different directory
Browse files Browse the repository at this point in the history
  • Loading branch information
tjx666 committed Mar 30, 2024
1 parent 0e571eb commit 888bc54
Show file tree
Hide file tree
Showing 14 changed files with 323 additions and 4,243 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist

docs/.vitepress/dist
docs/.vitepress/cache
**/stats.html
54 changes: 36 additions & 18 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,41 @@ You can use the `jsdoc` to check option `description` and `default value`.
:::

````ts
/**
* ```plaintext
* {
* 'axios' => Map(2) {
* '1.4.0' => Map(1) {
* 'node_modules/.pnpm/axios@1.4.0/node_modules/axios' => Set(1) ['tests/fixtures/mono/packages/pkg2/index.js']
* },
* '0.27.2' => Map(1) {
* 'node_modules/.pnpm/axios@0.27.2/node_modules/axios' => Set(1) ['tests/fixtures/mono/packages/pkg1/index.js']
* }
* },
* '@yutengjing/foo' => Map(1) {
* '1.0.3' => Map(2) {
* 'node_modules/.pnpm/@yutengjing+foo@1.0.3_vue@2.6.14/node_modules/@yutengjing/foo' => Set(1) ['tests/fixtures/mono/packages/pkg1/index.js'],
* 'node_modules/.pnpm/@yutengjing+foo@1.0.3_vue@2.7.16/node_modules/@yutengjing/foo' => Set(1) ['tests/fixtures/mono/packages/pkg2/index.js']
* }
* }
* }
* ```
*/
export type PackagesInfo = Map<
// pkg name
string,
Map<
// pkg version
string,
Map<
// pkg directory
string,
// importers
Set<string>
>
>
>;

export interface Options {
/**
* Config the duplicated dependencies which will be ignored, you can pass `*` as version to ignore all versions
Expand Down Expand Up @@ -44,24 +79,7 @@ export interface Options {

/**
* Custom the error message when exists duplicated deps
*
* @example
*
* ```txt
* packageToVersionsMap structure:
*
* Map(2) {
* '@pixi/utils' => Map(2) {
* '7.0.0' => Set(1) { 'tests/fixtures/mono/packages/pkg2/index.js' },
* '7.2.4' => Set(1) { 'tests/fixtures/mono/packages/pkg1/index.js' }
* },
* 'axios' => Map(2) {
* '0.27.2' => Set(1) { 'tests/fixtures/mono/packages/pkg2/index.js' },
* '1.4.0' => Set(1) { 'tests/fixtures/mono/packages/pkg1/index.js' }
* }
* }
* ```
*/
customErrorMessage?: (packageToVersionsMap: Map<string, Map<string, Set<string>>>) => string;
customErrorMessage?: (packageToVersionsMap: PackagesInfo) => string;
}
````
12 changes: 5 additions & 7 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

## Installation

:::code-group

```sh [pnpm]
pnpm -D add unplugin-detect-duplicated-deps
```

If you are using Yarn, NPM or Bun

:::code-group
```sh [npm]
npm add -D unplugin-detect-duplicated-deps
```

```sh [yarn]
yarn add -D unplugin-detect-duplicated-deps
```

```sh [npm]
npm add -D unplugin-detect-duplicated-deps
```

```sh [bun]
bun add -D unplugin-detect-duplicated-deps
```
Expand Down
21 changes: 17 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 888bc54

Please sign in to comment.