diff --git a/.changeset/clever-lions-rest.md b/.changeset/clever-lions-rest.md new file mode 100644 index 0000000000..870b3bb574 --- /dev/null +++ b/.changeset/clever-lions-rest.md @@ -0,0 +1,5 @@ +--- +"dependency-path": minor +--- + +Add depPathToFilename(). diff --git a/packages/dependencies-hierarchy/package.json b/packages/dependencies-hierarchy/package.json index f6a92cdb05..7fdb6bcbda 100644 --- a/packages/dependencies-hierarchy/package.json +++ b/packages/dependencies-hierarchy/package.json @@ -36,7 +36,6 @@ "@pnpm/lockfile-utils": "workspace:2.0.20", "@pnpm/modules-yaml": "workspace:8.0.5", "@pnpm/normalize-registries": "workspace:1.0.5", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/read-modules-dir": "workspace:2.0.3", "@pnpm/read-package-json": "workspace:3.1.8", "@pnpm/types": "workspace:6.3.1", diff --git a/packages/dependencies-hierarchy/src/index.ts b/packages/dependencies-hierarchy/src/index.ts index d219e0b4dc..7c02f8a49f 100644 --- a/packages/dependencies-hierarchy/src/index.ts +++ b/packages/dependencies-hierarchy/src/index.ts @@ -13,11 +13,10 @@ import { } from '@pnpm/lockfile-utils' import { read as readModulesYaml } from '@pnpm/modules-yaml' import normalizeRegistries from '@pnpm/normalize-registries' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import readModulesDir from '@pnpm/read-modules-dir' import { safeReadPackageFromDir } from '@pnpm/read-package-json' import { DependenciesField, DEPENDENCIES_FIELDS, Registries } from '@pnpm/types' -import { refToRelative } from 'dependency-path' +import { depPathToFilename, refToRelative } from 'dependency-path' import path = require('path') import normalizePath = require('normalize-path') import realpathMissing = require('realpath-missing') @@ -394,7 +393,7 @@ function getPkgInfo ( isPeer: Boolean(opts.peers?.has(opts.alias)), isSkipped, name, - path: depPath ? path.join(opts.modulesDir, '.pnpm', pkgIdToFilename(depPath, opts.lockfileDir)) : path.join(opts.modulesDir, '..', opts.ref.substr(5)), + path: depPath ? path.join(opts.modulesDir, '.pnpm', depPathToFilename(depPath, opts.lockfileDir)) : path.join(opts.modulesDir, '..', opts.ref.substr(5)), version, } if (resolved) { diff --git a/packages/dependency-path/package.json b/packages/dependency-path/package.json index 8ae62728e3..0f91f0bb32 100644 --- a/packages/dependency-path/package.json +++ b/packages/dependency-path/package.json @@ -33,6 +33,7 @@ "dependencies": { "@pnpm/types": "workspace:6.3.1", "encode-registry": "^3.0.0", + "normalize-path": "^3.0.0", "semver": "^7.3.4" }, "devDependencies": { diff --git a/packages/dependency-path/src/index.ts b/packages/dependency-path/src/index.ts index 35b9ed31f3..77320656f2 100644 --- a/packages/dependency-path/src/index.ts +++ b/packages/dependency-path/src/index.ts @@ -1,5 +1,7 @@ import { Registries } from '@pnpm/types' import encodeRegistry = require('encode-registry') +import normalize = require('normalize-path') +import path = require('path') import semver = require('semver') export function isAbsolute (dependencyPath: string) { @@ -126,3 +128,17 @@ export function parse (dependencyPath: string) { isAbsolute: _isAbsolute, } } + +export function depPathToFilename (depPath: string, lockfileDir: string) { + if (depPath.indexOf('file:') !== 0) { + if (depPath.startsWith('/')) { + depPath = depPath.substring(1) + } + const index = depPath.lastIndexOf('/') + return `${depPath.substring(0, index)}@${depPath.substr(index + 1)}` + } + + const absolutePath = normalize(path.join(lockfileDir, depPath.slice(5))) + const lastSlash = absolutePath.lastIndexOf('/') + return `local/${encodeURIComponent(absolutePath.substr(0, lastSlash + 1))}${absolutePath.substr(lastSlash + 1)}` +} diff --git a/packages/dependency-path/test/index.ts b/packages/dependency-path/test/index.ts index 19d807ef45..c6346bd7e2 100644 --- a/packages/dependency-path/test/index.ts +++ b/packages/dependency-path/test/index.ts @@ -1,5 +1,6 @@ /// import { + depPathToFilename, isAbsolute, parse, refToAbsolute, @@ -116,3 +117,12 @@ test('resolve()', () => { expect(resolve(registries, '/@qar/qar/1.0.0')).toEqual('foo.com/@qar/qar/1.0.0') expect(resolve(registries, 'qar.com/foo/1.0.0')).toEqual('qar.com/foo/1.0.0') }) + +test('depPathToFilename()', () => { + expect(depPathToFilename('/foo/1.0.0', process.cwd())).toBe('foo@1.0.0') + expect(depPathToFilename('/@foo/bar/1.0.0', process.cwd())).toBe('@foo/bar@1.0.0') + expect(depPathToFilename('github.com/something/foo/0000', process.cwd())).toBe('github.com/something/foo@0000') + + const filename = depPathToFilename('file:./test/foo-1.0.0.tgz_foo@2.0.0', process.cwd()) + expect(filename).toMatch(/%2Ffoo-1.0.0.tgz_foo@2.0.0$/) +}) diff --git a/packages/headless/package.json b/packages/headless/package.json index d5b545cb9b..9ca23ea602 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -85,7 +85,6 @@ "@pnpm/modules-yaml": "workspace:8.0.5", "@pnpm/package-is-installable": "workspace:^4.0.18", "@pnpm/package-requester": "workspace:12.2.0", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/read-package-json": "workspace:3.1.8", "@pnpm/read-project-manifest": "workspace:1.1.5", "@pnpm/store-controller-types": "workspace:9.2.0", diff --git a/packages/headless/src/index.ts b/packages/headless/src/index.ts index 39d79974de..ec559f2fdb 100644 --- a/packages/headless/src/index.ts +++ b/packages/headless/src/index.ts @@ -47,7 +47,6 @@ import { write as writeModulesYaml, } from '@pnpm/modules-yaml' import packageIsInstallable from '@pnpm/package-is-installable' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import { fromDir as readPackageFromDir } from '@pnpm/read-package-json' import { readProjectManifestOnly, safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' import { @@ -547,7 +546,7 @@ async function lockfileToDepGraph ( const pkgSnapshot = lockfile.packages![depPath] // TODO: optimize. This info can be already returned by pkgSnapshotToResolution() const { name: pkgName, version: pkgVersion } = nameVerFromPkgSnapshot(depPath, pkgSnapshot) - const modules = path.join(opts.virtualStoreDir, pkgIdToFilename(depPath, opts.lockfileDir), 'node_modules') + const modules = path.join(opts.virtualStoreDir, dp.depPathToFilename(depPath, opts.lockfileDir), 'node_modules') const packageId = packageIdFromSnapshot(depPath, pkgSnapshot, opts.registries) const pkg = { @@ -692,7 +691,7 @@ async function getChildrenPaths ( } else if (childPkgSnapshot) { if (ctx.skipped.has(childRelDepPath)) continue const pkgName = nameVerFromPkgSnapshot(childRelDepPath, childPkgSnapshot).name - children[alias] = path.join(ctx.virtualStoreDir, pkgIdToFilename(childRelDepPath, ctx.lockfileDir), 'node_modules', pkgName) + children[alias] = path.join(ctx.virtualStoreDir, dp.depPathToFilename(childRelDepPath, ctx.lockfileDir), 'node_modules', pkgName) } else if (allDeps[alias].indexOf('file:') === 0) { children[alias] = path.resolve(ctx.lockfileDir, allDeps[alias].substr(5)) } else if (!ctx.skipped.has(childRelDepPath) && (!peerDeps || !peerDeps.has(alias))) { diff --git a/packages/hoist/package.json b/packages/hoist/package.json index 906a904663..39f13c10a8 100644 --- a/packages/hoist/package.json +++ b/packages/hoist/package.json @@ -45,7 +45,6 @@ "@pnpm/lockfile-utils": "workspace:2.0.20", "@pnpm/lockfile-walker": "workspace:3.0.7", "@pnpm/matcher": "workspace:^1.0.3", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/symlink-dependency": "workspace:3.0.12", "@pnpm/types": "workspace:6.3.1", "dependency-path": "workspace:5.0.6", diff --git a/packages/hoist/src/index.ts b/packages/hoist/src/index.ts index 8be56f75c3..03cc5468d5 100644 --- a/packages/hoist/src/index.ts +++ b/packages/hoist/src/index.ts @@ -7,7 +7,6 @@ import { import lockfileWalker, { LockfileWalkerStep } from '@pnpm/lockfile-walker' import logger, { globalWarn } from '@pnpm/logger' import matcher from '@pnpm/matcher' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import symlinkDependency from '@pnpm/symlink-dependency' import { HoistedDependencies } from '@pnpm/types' import * as dp from 'dependency-path' @@ -199,7 +198,7 @@ async function symlinkHoistedDependencies ( return } const pkgName = nameVerFromPkgSnapshot(depPath, pkgSnapshot).name - const modules = path.join(opts.virtualStoreDir, pkgIdToFilename(depPath, opts.lockfileDir), 'node_modules') + const modules = path.join(opts.virtualStoreDir, dp.depPathToFilename(depPath, opts.lockfileDir), 'node_modules') const depLocation = path.join(modules, pkgName) await Promise.all(Object.entries(pkgAliases).map(async ([pkgAlias, hoistType]) => { const targetDir = hoistType === 'public' diff --git a/packages/lockfile-to-pnp/package.json b/packages/lockfile-to-pnp/package.json index f0d92ccb3d..b37322c5ab 100644 --- a/packages/lockfile-to-pnp/package.json +++ b/packages/lockfile-to-pnp/package.json @@ -45,7 +45,6 @@ "@pnpm/config": "workspace:11.10.1", "@pnpm/lockfile-file": "workspace:3.1.2", "@pnpm/lockfile-utils": "workspace:2.0.20", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/read-project-manifest": "workspace:1.1.5", "@yarnpkg/pnp": "^2.3.2", "dependency-path": "workspace:5.0.6", diff --git a/packages/lockfile-to-pnp/src/index.ts b/packages/lockfile-to-pnp/src/index.ts index fec6712bd7..4a62a3b086 100644 --- a/packages/lockfile-to-pnp/src/index.ts +++ b/packages/lockfile-to-pnp/src/index.ts @@ -3,10 +3,9 @@ import { Lockfile, readWantedLockfile } from '@pnpm/lockfile-file' import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile-utils' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import readImporterManifest from '@pnpm/read-project-manifest' import { Registries } from '@pnpm/types' -import { refToRelative } from 'dependency-path' +import { depPathToFilename, refToRelative } from 'dependency-path' import { generateInlinedScript, PackageRegistry } from '@yarnpkg/pnp' import fs = require('mz/fs') import normalizePath = require('normalize-path') @@ -116,7 +115,7 @@ export function lockfileToPackageRegistry ( // Seems like this field should always contain a relative path let packageLocation = normalizePath(path.relative(opts.lockfileDir, path.join( opts.virtualStoreDir, - pkgIdToFilename(relDepPath, opts.lockfileDir), + depPathToFilename(relDepPath, opts.lockfileDir), 'node_modules', name ))) diff --git a/packages/modules-cleaner/package.json b/packages/modules-cleaner/package.json index da86e17bf3..8f12091160 100644 --- a/packages/modules-cleaner/package.json +++ b/packages/modules-cleaner/package.json @@ -31,7 +31,6 @@ "@pnpm/filter-lockfile": "workspace:4.0.14", "@pnpm/lockfile-types": "workspace:2.1.1", "@pnpm/lockfile-utils": "workspace:2.0.20", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/read-modules-dir": "workspace:2.0.3", "@pnpm/remove-bins": "workspace:1.0.9", "@pnpm/store-controller-types": "workspace:9.2.0", diff --git a/packages/modules-cleaner/src/prune.ts b/packages/modules-cleaner/src/prune.ts index dc1ee79c06..0937b66c8d 100644 --- a/packages/modules-cleaner/src/prune.ts +++ b/packages/modules-cleaner/src/prune.ts @@ -10,7 +10,6 @@ import { } from '@pnpm/lockfile-types' import { packageIdFromSnapshot } from '@pnpm/lockfile-utils' import logger from '@pnpm/logger' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import readModulesDir from '@pnpm/read-modules-dir' import { StoreController } from '@pnpm/store-controller-types' import { @@ -19,6 +18,7 @@ import { HoistedDependencies, Registries, } from '@pnpm/types' +import { depPathToFilename } from 'dependency-path' import removeDirectDependency from './removeDirectDependency' import path = require('path') import rimraf = require('@zkochan/rimraf') @@ -142,7 +142,7 @@ export default async function prune ( } await Promise.all(orphanDepPaths.map(async (orphanDepPath) => { - const pathToRemove = path.join(opts.virtualStoreDir, pkgIdToFilename(orphanDepPath, opts.lockfileDir)) + const pathToRemove = path.join(opts.virtualStoreDir, depPathToFilename(orphanDepPath, opts.lockfileDir)) removalLogger.debug(pathToRemove) try { await rimraf(pathToRemove) diff --git a/packages/package-requester/package.json b/packages/package-requester/package.json index 4ff723c176..7e4bd4881f 100644 --- a/packages/package-requester/package.json +++ b/packages/package-requester/package.json @@ -38,11 +38,11 @@ "@pnpm/cafs": "workspace:2.0.4", "@pnpm/core-loggers": "workspace:5.0.2", "@pnpm/fetcher-base": "workspace:9.0.3", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/read-package-json": "workspace:3.1.8", "@pnpm/resolver-base": "workspace:7.1.0", "@pnpm/store-controller-types": "workspace:9.2.0", "@pnpm/types": "workspace:6.3.1", + "dependency-path": "workspace:^5.0.6", "load-json-file": "^6.2.0", "mz": "^2.7.0", "p-defer": "^3.0.0", diff --git a/packages/package-requester/src/packageRequester.ts b/packages/package-requester/src/packageRequester.ts index 6ccfd975af..1ed9fde565 100644 --- a/packages/package-requester/src/packageRequester.ts +++ b/packages/package-requester/src/packageRequester.ts @@ -15,7 +15,6 @@ import { FetchResult, } from '@pnpm/fetcher-base' import logger from '@pnpm/logger' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import readPackage from '@pnpm/read-package-json' import { DirectoryResolution, @@ -33,6 +32,7 @@ import { WantedDependency, } from '@pnpm/store-controller-types' import { DependencyManifest } from '@pnpm/types' +import { depPathToFilename } from 'dependency-path' import * as fs from 'mz/fs' import PQueue from 'p-queue' import safeDeferredPromise from './safeDeferredPromise' @@ -274,7 +274,7 @@ function fetchToStore ( files: () => Promise finishing: () => Promise } { - const targetRelative = pkgIdToFilename(opts.pkgId, opts.lockfileDir) + const targetRelative = depPathToFilename(opts.pkgId, opts.lockfileDir) const target = path.join(ctx.storeDir, targetRelative) if (!ctx.fetchingLocker.has(opts.pkgId)) { diff --git a/packages/package-requester/test/index.ts b/packages/package-requester/test/index.ts index 86b4229e8e..0c967915f0 100644 --- a/packages/package-requester/test/index.ts +++ b/packages/package-requester/test/index.ts @@ -4,9 +4,9 @@ import { getFilePathInCafs, PackageFilesIndex } from '@pnpm/cafs' import createClient from '@pnpm/client' import { streamParser } from '@pnpm/logger' import createPackageRequester, { PackageFilesResponse, PackageResponse } from '@pnpm/package-requester' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import { DependencyManifest } from '@pnpm/types' import delay from 'delay' +import { depPathToFilename } from 'dependency-path' import path = require('path') import loadJsonFile = require('load-json-file') import fs = require('mz/fs') @@ -646,7 +646,7 @@ test('refetch package to store if it has been modified', async () => { expect(reporter).toBeCalledWith(expect.objectContaining({ level: 'warn', - message: `Refetching ${path.join(storeDir, pkgIdToFilename(pkgId, process.cwd()))} to store. It was either modified or had no integrity checksums`, + message: `Refetching ${path.join(storeDir, depPathToFilename(pkgId, process.cwd()))} to store. It was either modified or had no integrity checksums`, name: 'pnpm:package-requester', prefix: lockfileDir, })) diff --git a/packages/package-requester/tsconfig.json b/packages/package-requester/tsconfig.json index 1472a1468c..070bc77483 100644 --- a/packages/package-requester/tsconfig.json +++ b/packages/package-requester/tsconfig.json @@ -18,6 +18,9 @@ { "path": "../core-loggers" }, + { + "path": "../dependency-path" + }, { "path": "../fetcher-base" }, diff --git a/packages/plugin-commands-rebuild/package.json b/packages/plugin-commands-rebuild/package.json index 834eb14d16..f3954897e1 100644 --- a/packages/plugin-commands-rebuild/package.json +++ b/packages/plugin-commands-rebuild/package.json @@ -60,7 +60,6 @@ "@pnpm/lockfile-walker": "workspace:3.0.7", "@pnpm/modules-yaml": "workspace:8.0.5", "@pnpm/normalize-registries": "workspace:1.0.5", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/sort-packages": "workspace:1.0.15", "@pnpm/store-connection-manager": "workspace:0.3.55", "@pnpm/store-controller-types": "workspace:9.2.0", diff --git a/packages/plugin-commands-rebuild/src/implementation/index.ts b/packages/plugin-commands-rebuild/src/implementation/index.ts index 0e61bada72..3ba123ad1f 100644 --- a/packages/plugin-commands-rebuild/src/implementation/index.ts +++ b/packages/plugin-commands-rebuild/src/implementation/index.ts @@ -18,7 +18,6 @@ import { import lockfileWalker, { LockfileWalkerStep } from '@pnpm/lockfile-walker' import logger, { streamParser } from '@pnpm/logger' import { write as writeModulesYaml } from '@pnpm/modules-yaml' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import { ProjectManifest } from '@pnpm/types' import * as dp from 'dependency-path' import runGroups from 'run-groups' @@ -266,9 +265,9 @@ async function _rebuild ( async () => { const pkgSnapshot = pkgSnapshots[depPath] const pkgInfo = nameVerFromPkgSnapshot(depPath, pkgSnapshot) - const pkgRoot = path.join(ctx.virtualStoreDir, pkgIdToFilename(depPath, opts.lockfileDir), 'node_modules', pkgInfo.name) + const pkgRoot = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath, opts.lockfileDir), 'node_modules', pkgInfo.name) try { - const modules = path.join(ctx.virtualStoreDir, pkgIdToFilename(depPath, opts.lockfileDir), 'node_modules') + const modules = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath, opts.lockfileDir), 'node_modules') const binPath = path.join(pkgRoot, 'node_modules', '.bin') await linkBins(modules, binPath, { warn }) await runPostinstallHooks({ @@ -313,7 +312,7 @@ async function _rebuild ( .map((depPath) => limitLinking(() => { const pkgSnapshot = pkgSnapshots[depPath] const pkgInfo = nameVerFromPkgSnapshot(depPath, pkgSnapshot) - const modules = path.join(ctx.virtualStoreDir, pkgIdToFilename(depPath, opts.lockfileDir), 'node_modules') + const modules = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath, opts.lockfileDir), 'node_modules') const binPath = path.join(modules, pkgInfo.name, 'node_modules', '.bin') return linkBins(modules, binPath, { warn }) })) diff --git a/packages/plugin-commands-store/package.json b/packages/plugin-commands-store/package.json index 6307bf47a2..eaa107add9 100644 --- a/packages/plugin-commands-store/package.json +++ b/packages/plugin-commands-store/package.json @@ -60,7 +60,6 @@ "@pnpm/normalize-registries": "workspace:1.0.5", "@pnpm/parse-wanted-dependency": "workspace:1.0.0", "@pnpm/pick-registry-for-package": "workspace:1.0.5", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/store-connection-manager": "workspace:0.3.55", "@pnpm/store-controller-types": "workspace:9.2.0", "@pnpm/store-path": "^4.0.3", diff --git a/packages/plugin-commands-store/src/storeStatus/index.ts b/packages/plugin-commands-store/src/storeStatus/index.ts index cfa63f3929..7e90e9b9b4 100644 --- a/packages/plugin-commands-store/src/storeStatus/index.ts +++ b/packages/plugin-commands-store/src/storeStatus/index.ts @@ -2,7 +2,6 @@ import { getFilePathInCafs, PackageFilesIndex } from '@pnpm/cafs' import { getContextForSingleImporter } from '@pnpm/get-context' import { nameVerFromPkgSnapshot } from '@pnpm/lockfile-utils' import { streamParser } from '@pnpm/logger' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import * as dp from 'dependency-path' import extendOptions, { StoreStatusOptions, @@ -48,7 +47,7 @@ export default async function (maybeOpts: StoreStatusOptions) { ? getFilePathInCafs(cafsDir, integrity, 'index') : path.join(storeDir, pkgPath, 'integrity.json') const { files } = await loadJsonFile(pkgIndexFilePath) - return (await dint.check(path.join(virtualStoreDir, pkgIdToFilename(depPath, opts.dir), 'node_modules', name), files)) === false + return (await dint.check(path.join(virtualStoreDir, dp.depPathToFilename(depPath, opts.dir), 'node_modules', name), files)) === false }) if (reporter && typeof reporter === 'function') { diff --git a/packages/resolve-dependencies/package.json b/packages/resolve-dependencies/package.json index 99c99026d3..3f8fee6c76 100644 --- a/packages/resolve-dependencies/package.json +++ b/packages/resolve-dependencies/package.json @@ -37,7 +37,6 @@ "@pnpm/npm-resolver": "workspace:10.2.1", "@pnpm/package-is-installable": "workspace:4.0.18", "@pnpm/pick-registry-for-package": "workspace:1.0.5", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/prune-lockfile": "workspace:^2.0.17", "@pnpm/read-package-json": "workspace:^3.1.8", "@pnpm/resolver-base": "workspace:7.1.0", diff --git a/packages/resolve-dependencies/src/resolveDependencies.ts b/packages/resolve-dependencies/src/resolveDependencies.ts index 91e2a48850..d649266caf 100644 --- a/packages/resolve-dependencies/src/resolveDependencies.ts +++ b/packages/resolve-dependencies/src/resolveDependencies.ts @@ -17,7 +17,6 @@ import { import logger from '@pnpm/logger' import packageIsInstallable from '@pnpm/package-is-installable' import pickRegistryForPackage from '@pnpm/pick-registry-for-package' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import { DirectoryResolution, PreferredVersions, @@ -576,7 +575,7 @@ async function resolveDependency ( await exists( path.join( ctx.virtualStoreDir, - pkgIdToFilename(currentPkg.depPath, ctx.prefix), + dp.depPathToFilename(currentPkg.depPath, ctx.prefix), 'node_modules', nameVerFromPkgSnapshot(currentPkg.depPath, currentPkg.dependencyLockfile).name, 'package.json' diff --git a/packages/resolve-dependencies/src/resolvePeers.ts b/packages/resolve-dependencies/src/resolvePeers.ts index c2fa2343db..02f755dc2a 100644 --- a/packages/resolve-dependencies/src/resolvePeers.ts +++ b/packages/resolve-dependencies/src/resolvePeers.ts @@ -1,7 +1,7 @@ import PnpmError from '@pnpm/error' import logger from '@pnpm/logger' -import pkgIdToFilename from '@pnpm/pkgid-to-filename' import { Dependencies } from '@pnpm/types' +import { depPathToFilename } from 'dependency-path' import { createNodeId, splitNodeId, @@ -221,7 +221,7 @@ function resolvePeersOfNode ( let modules: string let depPath: string - const localLocation = path.join(ctx.virtualStoreDir, pkgIdToFilename(resolvedPackage.depPath, ctx.lockfileDir)) + const localLocation = path.join(ctx.virtualStoreDir, depPathToFilename(resolvedPackage.depPath, ctx.lockfileDir)) if (R.isEmpty(allResolvedPeers)) { modules = path.join(localLocation, 'node_modules') depPath = resolvedPackage.depPath diff --git a/packages/supi/package.json b/packages/supi/package.json index bbebd07de6..2b6c1589f8 100644 --- a/packages/supi/package.json +++ b/packages/supi/package.json @@ -36,7 +36,6 @@ "@pnpm/normalize-registries": "workspace:1.0.5", "@pnpm/package-requester": "workspace:12.2.0", "@pnpm/parse-wanted-dependency": "workspace:1.0.0", - "@pnpm/pkgid-to-filename": "^3.0.0", "@pnpm/prune-lockfile": "workspace:2.0.17", "@pnpm/read-modules-dir": "workspace:2.0.3", "@pnpm/read-package-json": "workspace:3.1.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 35c1cfad23..d118511509 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -348,7 +348,6 @@ importers: '@pnpm/lockfile-utils': 'link:../lockfile-utils' '@pnpm/modules-yaml': 'link:../modules-yaml' '@pnpm/normalize-registries': 'link:../normalize-registries' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/read-modules-dir': 'link:../read-modules-dir' '@pnpm/read-package-json': 'link:../read-package-json' '@pnpm/types': 'link:../types' @@ -368,7 +367,6 @@ importers: '@pnpm/logger': ^3.2.3 '@pnpm/modules-yaml': 'workspace:8.0.5' '@pnpm/normalize-registries': 'workspace:1.0.5' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/read-modules-dir': 'workspace:2.0.3' '@pnpm/read-package-json': 'workspace:3.1.8' '@pnpm/types': 'workspace:6.3.1' @@ -382,6 +380,7 @@ importers: dependencies: '@pnpm/types': 'link:../types' encode-registry: 3.0.0 + normalize-path: 3.0.0 semver: 7.3.4 devDependencies: '@types/semver': 7.3.4 @@ -391,6 +390,7 @@ importers: '@types/semver': ^7.3.4 dependency-path: 'link:' encode-registry: ^3.0.0 + normalize-path: ^3.0.0 semver: ^7.3.4 packages/error: specifiers: {} @@ -678,7 +678,6 @@ importers: '@pnpm/modules-yaml': 'link:../modules-yaml' '@pnpm/package-is-installable': 'link:../package-is-installable' '@pnpm/package-requester': 'link:../package-requester' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/read-package-json': 'link:../read-package-json' '@pnpm/read-project-manifest': 'link:../read-project-manifest' '@pnpm/store-controller-types': 'link:../store-controller-types' @@ -734,7 +733,6 @@ importers: '@pnpm/package-is-installable': 'workspace:^4.0.18' '@pnpm/package-requester': 'workspace:12.2.0' '@pnpm/package-store': 'workspace:*' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/read-package-json': 'workspace:3.1.8' '@pnpm/read-project-manifest': 'workspace:1.1.5' '@pnpm/read-projects-context': 'workspace:*' @@ -771,7 +769,6 @@ importers: '@pnpm/lockfile-utils': 'link:../lockfile-utils' '@pnpm/lockfile-walker': 'link:../lockfile-walker' '@pnpm/matcher': 'link:../matcher' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/symlink-dependency': 'link:../symlink-dependency' '@pnpm/types': 'link:../types' dependency-path: 'link:../dependency-path' @@ -787,7 +784,6 @@ importers: '@pnpm/lockfile-walker': 'workspace:3.0.7' '@pnpm/logger': ^3.2.3 '@pnpm/matcher': 'workspace:^1.0.3' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/symlink-dependency': 'workspace:3.0.12' '@pnpm/types': 'workspace:6.3.1' '@types/ramda': ^0.27.34 @@ -986,7 +982,6 @@ importers: '@pnpm/config': 'link:../config' '@pnpm/lockfile-file': 'link:../lockfile-file' '@pnpm/lockfile-utils': 'link:../lockfile-utils' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/read-project-manifest': 'link:../read-project-manifest' '@yarnpkg/pnp': 2.3.2 dependency-path: 'link:../dependency-path' @@ -1005,7 +1000,6 @@ importers: '@pnpm/lockfile-file': 'workspace:3.1.2' '@pnpm/lockfile-utils': 'workspace:2.0.20' '@pnpm/logger': ^3.2.3 - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/read-project-manifest': 'workspace:1.1.5' '@pnpm/types': 'workspace:6.3.1' '@types/mz': 0.0.32 @@ -1143,7 +1137,6 @@ importers: '@pnpm/filter-lockfile': 'link:../filter-lockfile' '@pnpm/lockfile-types': 'link:../lockfile-types' '@pnpm/lockfile-utils': 'link:../lockfile-utils' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/read-modules-dir': 'link:../read-modules-dir' '@pnpm/remove-bins': 'link:../remove-bins' '@pnpm/store-controller-types': 'link:../store-controller-types' @@ -1162,7 +1155,6 @@ importers: '@pnpm/lockfile-utils': 'workspace:2.0.20' '@pnpm/logger': ^3.2.3 '@pnpm/modules-cleaner': 'link:' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/read-modules-dir': 'workspace:2.0.3' '@pnpm/remove-bins': 'workspace:1.0.9' '@pnpm/store-controller-types': 'workspace:9.2.0' @@ -1368,11 +1360,11 @@ importers: '@pnpm/cafs': 'link:../cafs' '@pnpm/core-loggers': 'link:../core-loggers' '@pnpm/fetcher-base': 'link:../fetcher-base' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/read-package-json': 'link:../read-package-json' '@pnpm/resolver-base': 'link:../resolver-base' '@pnpm/store-controller-types': 'link:../store-controller-types' '@pnpm/types': 'link:../types' + dependency-path: 'link:../dependency-path' load-json-file: 6.2.0 mz: 2.7.0 p-defer: 3.0.0 @@ -1404,7 +1396,6 @@ importers: '@pnpm/fetcher-base': 'workspace:9.0.3' '@pnpm/logger': ^3.2.3 '@pnpm/package-requester': 'link:' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/read-package-json': 'workspace:3.1.8' '@pnpm/resolver-base': 'workspace:7.1.0' '@pnpm/store-controller-types': 'workspace:9.2.0' @@ -1415,6 +1406,7 @@ importers: '@types/ramda': ^0.27.34 '@types/ssri': ^6.0.3 delay: ^4.4.0 + dependency-path: 'workspace:^5.0.6' load-json-file: ^6.2.0 mz: ^2.7.0 ncp: ^2.0.0 @@ -1924,7 +1916,6 @@ importers: '@pnpm/lockfile-walker': 'link:../lockfile-walker' '@pnpm/modules-yaml': 'link:../modules-yaml' '@pnpm/normalize-registries': 'link:../normalize-registries' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/sort-packages': 'link:../sort-packages' '@pnpm/store-connection-manager': 'link:../store-connection-manager' '@pnpm/store-controller-types': 'link:../store-controller-types' @@ -1970,7 +1961,6 @@ importers: '@pnpm/logger': ^3.2.3 '@pnpm/modules-yaml': 'workspace:8.0.5' '@pnpm/normalize-registries': 'workspace:1.0.5' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/plugin-commands-rebuild': 'link:' '@pnpm/prepare': 'workspace:0.0.16' '@pnpm/sort-packages': 'workspace:1.0.15' @@ -2112,7 +2102,6 @@ importers: '@pnpm/normalize-registries': 'link:../normalize-registries' '@pnpm/parse-wanted-dependency': 'link:../parse-wanted-dependency' '@pnpm/pick-registry-for-package': 'link:../pick-registry-for-package' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/store-connection-manager': 'link:../store-connection-manager' '@pnpm/store-controller-types': 'link:../store-controller-types' '@pnpm/store-path': 4.0.3 @@ -2153,7 +2142,6 @@ importers: '@pnpm/normalize-registries': 'workspace:1.0.5' '@pnpm/parse-wanted-dependency': 'workspace:1.0.0' '@pnpm/pick-registry-for-package': 'workspace:1.0.5' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/plugin-commands-store': 'link:' '@pnpm/prepare': 'workspace:0.0.16' '@pnpm/store-connection-manager': 'workspace:0.3.55' @@ -2512,7 +2500,6 @@ importers: '@pnpm/npm-resolver': 'link:../npm-resolver' '@pnpm/package-is-installable': 'link:../package-is-installable' '@pnpm/pick-registry-for-package': 'link:../pick-registry-for-package' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/prune-lockfile': 'link:../prune-lockfile' '@pnpm/read-package-json': 'link:../read-package-json' '@pnpm/resolver-base': 'link:../resolver-base' @@ -2543,7 +2530,6 @@ importers: '@pnpm/npm-resolver': 'workspace:10.2.1' '@pnpm/package-is-installable': 'workspace:4.0.18' '@pnpm/pick-registry-for-package': 'workspace:1.0.5' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/prune-lockfile': 'workspace:^2.0.17' '@pnpm/read-package-json': 'workspace:^3.1.8' '@pnpm/resolve-dependencies': 'link:' @@ -2703,7 +2689,6 @@ importers: '@pnpm/normalize-registries': 'link:../normalize-registries' '@pnpm/package-requester': 'link:../package-requester' '@pnpm/parse-wanted-dependency': 'link:../parse-wanted-dependency' - '@pnpm/pkgid-to-filename': 3.0.0 '@pnpm/prune-lockfile': 'link:../prune-lockfile' '@pnpm/read-modules-dir': 'link:../read-modules-dir' '@pnpm/read-package-json': 'link:../read-package-json' @@ -2800,7 +2785,6 @@ importers: '@pnpm/package-requester': 'workspace:12.2.0' '@pnpm/package-store': 'workspace:*' '@pnpm/parse-wanted-dependency': 'workspace:1.0.0' - '@pnpm/pkgid-to-filename': ^3.0.0 '@pnpm/prepare': 'workspace:0.0.16' '@pnpm/prune-lockfile': 'workspace:2.0.17' '@pnpm/read-modules-dir': 'workspace:2.0.3' @@ -4034,14 +4018,6 @@ packages: node: '>=10' resolution: integrity: sha512-/nZCAUeKwlv1MldtOHSPDm5SuXBy4L4SoS30gYn9ti2N5XlUrVoXDE8Hq8EYfl+Knb1GQEDz04KjfFEDVsAsvg== - /@pnpm/pkgid-to-filename/3.0.0: - dependencies: - normalize-path: 3.0.0 - dev: false - engines: - node: '>=10.13' - resolution: - integrity: sha512-4XVzYoO77hziiJRVTk5pv+9KD631tlqR5+MVu2BlDyrTpgfp+7Su5XPI/2Cek46X2L71vTpYW6LMW22DpmjocA== /@pnpm/registry-mock/2.2.2: dependencies: anonymous-npm-registry-client: 0.1.2