fix: reference @pnpm/fs.packlist from the workspace (#10477)

This commit is contained in:
Zoltan Kochan
2026-01-17 14:35:41 +01:00
committed by GitHub
parent 623634537d
commit e3b94c06da
10 changed files with 373 additions and 367 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/tarball-fetcher": patch
"@pnpm/git-fetcher": patch
---
`@pnpm/fs.packlist` should be linked from the workspace.

View File

@@ -14,6 +14,7 @@
"@pnpm/object.key-sorting": "workspace:*",
"@pnpm/parse-overrides": "workspace:*",
"@pnpm/types": "workspace:*",
"@pnpm/workspace.find-packages": "workspace:*",
"@pnpm/workspace.read-manifest": "workspace:*",
"@types/normalize-path": "catalog:",
"is-subdir": "catalog:",

View File

@@ -5,6 +5,7 @@ import { type ProjectId, type ProjectManifest } from '@pnpm/types'
import { createUpdateOptions, type FormatPluginFnOptions } from '@pnpm/meta-updater'
import { sortDirectKeys, sortKeysByPriority } from '@pnpm/object.key-sorting'
import { parsePkgAndParentSelector } from '@pnpm/parse-overrides'
import { findWorkspacePackagesNoCheck } from '@pnpm/workspace.find-packages'
import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest'
import isSubdir from 'is-subdir'
import { loadJsonFileSync } from 'load-json-file'
@@ -26,6 +27,8 @@ export default async (workspaceDir: string) => { // eslint-disable-line
if (lockfile == null) {
throw new Error('no lockfile found')
}
const workspacePackages = await findWorkspacePackagesNoCheck(workspaceDir, { patterns: workspaceManifest?.packages })
const workspacePackageNames = new Set(workspacePackages.map(pkg => pkg.manifest.name).filter(Boolean))
return createUpdateOptions({
'package.json': (manifest: ProjectManifest & { keywords?: string[] } | null, { dir }: { dir: string }) => {
if (!manifest) {
@@ -59,7 +62,9 @@ export default async (workspaceDir: string) => { // eslint-disable-line
manifest[depType] = sortDirectKeys(manifest[depType])
for (const depName of Object.keys(manifest[depType] ?? {})) {
if (!manifest[depType]?.[depName].startsWith('workspace:')) {
manifest[depType]![depName] = 'catalog:'
// @pnpm/scripts is used before packages are compiled, so its deps should use catalog: instead of workspace:*
const useWorkspaceProtocol = workspacePackageNames.has(depName) && manifest.name !== '@pnpm/scripts'
manifest[depType]![depName] = useWorkspaceProtocol ? 'workspace:*' : 'catalog:'
}
}
}

View File

@@ -25,6 +25,9 @@
{
"path": "../packages/types"
},
{
"path": "../workspace/find-packages"
},
{
"path": "../workspace/read-manifest"
}

View File

@@ -34,7 +34,7 @@
"dependencies": {
"@pnpm/error": "workspace:*",
"@pnpm/fetcher-base": "workspace:*",
"@pnpm/fs.packlist": "catalog:",
"@pnpm/fs.packlist": "workspace:*",
"@pnpm/prepare-package": "workspace:*",
"@zkochan/rimraf": "catalog:",
"execa": "catalog:"

View File

@@ -12,6 +12,9 @@
{
"path": "../../exec/prepare-package"
},
{
"path": "../../fs/packlist"
},
{
"path": "../../packages/error"
},

View File

@@ -37,7 +37,7 @@
"@pnpm/error": "workspace:*",
"@pnpm/fetcher-base": "workspace:*",
"@pnpm/fetching-types": "workspace:*",
"@pnpm/fs.packlist": "catalog:",
"@pnpm/fs.packlist": "workspace:*",
"@pnpm/graceful-fs": "workspace:*",
"@pnpm/prepare-package": "workspace:*",
"@pnpm/types": "workspace:*",

View File

@@ -18,6 +18,9 @@
{
"path": "../../fs/graceful-fs"
},
{
"path": "../../fs/packlist"
},
{
"path": "../../network/fetch"
},

708
pnpm-lock.yaml generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -69,14 +69,12 @@ catalog:
'@commitlint/config-conventional': ^19.8.1
'@commitlint/prompt-cli': ^19.8.1
'@eslint/js': ^9.18.0
'@stylistic/eslint-plugin': ^4.4.1
'@jest/globals': 30.0.5
'@pnpm/byline': ^1.0.0
'@pnpm/colorize-semver-diff': ^1.0.1
'@pnpm/config.env-replace': ^3.0.2
'@pnpm/config.nerf-dart': ^1.0.0
'@pnpm/exec': ^2.0.0
'@pnpm/fs.packlist': 2.0.0
'@pnpm/log.group': 3.0.1
'@pnpm/logger': '>=1001.0.0 <1002.0.0'
'@pnpm/meta-updater': 2.0.6
@@ -96,6 +94,7 @@ catalog:
'@pnpm/workspace.read-manifest': ^1000.1.1
'@reflink/reflink': 0.1.19
'@rushstack/worker-pool': 0.5.26
'@stylistic/eslint-plugin': ^4.4.1
'@types/adm-zip': ^0.5.7
'@types/archy': 0.0.33
'@types/cross-spawn': ^6.0.6
@@ -133,7 +132,6 @@ catalog:
'@types/yarnpkg__lockfile': ^1.1.9
'@types/yazl': ^3.3.0
'@types/zkochan__table': npm:@types/table@6.0.0
typescript-eslint: ^8.53.0
'@typescript-eslint/utils': ^8.53.0
'@typescript/native-preview': 7.0.0-dev.20260112.1
'@yarnpkg/core': 4.2.0
@@ -296,6 +294,7 @@ catalog:
ts-jest: 29.4.1
ts-jest-resolver: 2.0.1
typescript: 5.9.2
typescript-eslint: ^8.53.0
unified: ^9.2.2
validate-npm-package-name: 6.0.2
verdaccio: 6.1.6