mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-15 09:33:45 -05:00
fix: downgrade npm-packlist to improve performance (#7301)
ref #6997 ref #7250
This commit is contained in:
8
.changeset/rude-laws-sparkle.md
Normal file
8
.changeset/rude-laws-sparkle.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@pnpm/fs.packlist": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Downgraded `npm-packlist` because the newer version significantly slows down the installation of local directory dependencies, making it unbearably slow.
|
||||
|
||||
`npm-packlist` was upgraded in [this PR](https://github.com/pnpm/pnpm/pull/7250) to fix [#6997](https://github.com/pnpm/pnpm/issues/6997). We added our own file deduplication to fix the issue of duplicate file entries.
|
||||
5
__typings__/typed.d.ts
vendored
5
__typings__/typed.d.ts
vendored
@@ -212,3 +212,8 @@ declare module '@pnpm/npm-conf/lib/types' {
|
||||
const npmTypes: npmType
|
||||
export = npmTypes
|
||||
}
|
||||
|
||||
declare module 'npm-packlist' {
|
||||
function npmPacklist (opts: { path: string }): Promise<string[]>
|
||||
export = npmPacklist
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ pnpm add @pnpm/fs.packlist
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const { packlist } = require('path')
|
||||
const { packlist } = require('@pnpm/fs.packlist')
|
||||
|
||||
const files = packlist('/package-dir')
|
||||
```
|
||||
|
||||
@@ -27,14 +27,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/pnpm/pnpm/blob/main/fs/packlist#readme",
|
||||
"dependencies": {
|
||||
"@npmcli/arborist": "npm:@pnpm/arborist__fork@7.2.1",
|
||||
"npm-packlist": "^8.0.0"
|
||||
"npm-packlist": "5.1.3"
|
||||
},
|
||||
"funding": "https://opencollective.com/pnpm",
|
||||
"devDependencies": {
|
||||
"@pnpm/fs.packlist": "workspace:*",
|
||||
"@types/npm-packlist": "^7.0.2",
|
||||
"@types/npmcli__arborist": "5.6.4"
|
||||
"@pnpm/fs.packlist": "workspace:*"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/index.js"
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import Arborist from '@npmcli/arborist'
|
||||
import npmPacklist from 'npm-packlist'
|
||||
|
||||
export async function packlist (pkgDir: string) {
|
||||
const arborist = new Arborist(({ path: pkgDir }))
|
||||
const tree = await arborist.loadActual()
|
||||
return npmPacklist(tree)
|
||||
export async function packlist (pkgDir: string): Promise<string[]> {
|
||||
const files = await npmPacklist({ path: pkgDir })
|
||||
// There's a bug in the npm-packlist version that we use,
|
||||
// it sometimes returns duplicates.
|
||||
// Related issue: https://github.com/pnpm/pnpm/issues/6997
|
||||
// Unfortunately, we cannot upgrade the library
|
||||
// newer versions of npm-packlist are very slow.
|
||||
return Array.from(new Set(files.map((file) => file.replace(/^\.[/\\]/, ''))))
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@
|
||||
"is-port-reachable",
|
||||
"load-json-file",
|
||||
"mem",
|
||||
"npm-packlist",
|
||||
"node-fetch",
|
||||
"normalize-newline",
|
||||
"p-any",
|
||||
|
||||
868
pnpm-lock.yaml
generated
868
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user