mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-26 07:27:20 -04:00
fix(lockfile-to-pnp): ensure packageLocation ends in trailing slash (#9905)
Discovered via https://github.com/pnpm/pnpm/issues/9904. PnP expects `packageLocation` to end in a trailing slash, this commit ensures that.
This commit is contained in:
7
.changeset/good-llamas-dream.md
Normal file
7
.changeset/good-llamas-dream.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/lockfile-to-pnp": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fix `.pnp.cjs` crash when importing subpath [#9904](https://github.com/pnpm/pnpm/issues/9904).
|
||||
|
||||
@@ -95,6 +95,9 @@ export function lockfileToPackageRegistry (
|
||||
if (!packageLocation.startsWith('../')) {
|
||||
packageLocation = `./${packageLocation}`
|
||||
}
|
||||
if (!packageLocation.endsWith('/')) {
|
||||
packageLocation += '/'
|
||||
}
|
||||
packageStore.set(pnpVersion, {
|
||||
packageDependencies: new Map([
|
||||
[name, pnpVersion],
|
||||
|
||||
@@ -129,7 +129,7 @@ test('lockfileToPackageRegistry', () => {
|
||||
['dep1', '1.0.0'],
|
||||
['dep2', ['foo', '2.0.0']],
|
||||
],
|
||||
packageLocation: './node_modules/.pnpm/dep1@1.0.0/node_modules/dep1',
|
||||
packageLocation: './node_modules/.pnpm/dep1@1.0.0/node_modules/dep1/',
|
||||
},
|
||||
],
|
||||
],
|
||||
@@ -144,7 +144,7 @@ test('lockfileToPackageRegistry', () => {
|
||||
['foo', '2.0.0'],
|
||||
['qar', '3.0.0'],
|
||||
],
|
||||
packageLocation: './node_modules/.pnpm/foo@2.0.0/node_modules/foo',
|
||||
packageLocation: './node_modules/.pnpm/foo@2.0.0/node_modules/foo/',
|
||||
},
|
||||
],
|
||||
],
|
||||
@@ -158,7 +158,7 @@ test('lockfileToPackageRegistry', () => {
|
||||
packageDependencies: [
|
||||
['qar', '2.0.0'],
|
||||
],
|
||||
packageLocation: './node_modules/.pnpm/qar@2.0.0/node_modules/qar',
|
||||
packageLocation: './node_modules/.pnpm/qar@2.0.0/node_modules/qar/',
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -167,7 +167,7 @@ test('lockfileToPackageRegistry', () => {
|
||||
packageDependencies: [
|
||||
['qar', '3.0.0'],
|
||||
],
|
||||
packageLocation: './node_modules/.pnpm/qar@3.0.0/node_modules/qar',
|
||||
packageLocation: './node_modules/.pnpm/qar@3.0.0/node_modules/qar/',
|
||||
},
|
||||
],
|
||||
],
|
||||
@@ -265,7 +265,7 @@ test('lockfileToPackageRegistry packages that have peer deps', () => {
|
||||
['haspeer', 'virtual:2.0.0(peer@1.0.0)#2.0.0'],
|
||||
['peer', '1.0.0'],
|
||||
],
|
||||
packageLocation: './node_modules/.pnpm/haspeer@2.0.0_peer@1.0.0/node_modules/haspeer',
|
||||
packageLocation: './node_modules/.pnpm/haspeer@2.0.0_peer@1.0.0/node_modules/haspeer/',
|
||||
},
|
||||
],
|
||||
],
|
||||
@@ -279,7 +279,7 @@ test('lockfileToPackageRegistry packages that have peer deps', () => {
|
||||
packageDependencies: [
|
||||
['peer', '1.0.0'],
|
||||
],
|
||||
packageLocation: './node_modules/.pnpm/peer@1.0.0/node_modules/peer',
|
||||
packageLocation: './node_modules/.pnpm/peer@1.0.0/node_modules/peer/',
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user