From d381a6001c61e50d5223c68136951c428ae70022 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Mon, 1 Jan 2024 10:44:30 +0100 Subject: [PATCH] feat!: use dependency path format from lockfile v6 (#7470) Drop lockfile v5 support. --- .changeset/light-jobs-speak.md | 19 + .../has-major-outdated-deps/pnpm-lock.yaml | 17 +- .../node_modules/.pnpm/lock.yaml | 21 +- .../has-not-outdated-deps/pnpm-lock.yaml | 17 +- .../node_modules/.pnpm/lock.yaml | 17 +- .../pnpm-lock.yaml | 17 +- .../pkg-with-external-lockfile/pnpm-lock.yaml | 525 +++++++++--------- exec/plugin-commands-rebuild/test/index.ts | 10 +- lockfile/audit/test/index.ts | 8 +- .../filter-lockfile/test/filterByImporters.ts | 54 +- .../test/filterByImportersAndEngine.ts | 110 ++-- .../inlineSpecifiersLockfileConverters.ts | 129 +---- lockfile/lockfile-file/src/write.ts | 21 +- .../test/__snapshots__/write.test.ts.snap | 20 +- .../test/lockfileV6Converters.test.ts | 38 +- .../test/normalizeLockfile.test.ts | 18 +- lockfile/lockfile-file/test/write.test.ts | 18 +- lockfile/lockfile-to-pnp/src/index.ts | 2 +- lockfile/lockfile-to-pnp/test/index.ts | 24 +- .../test/nameVerFromPkgSnapshot.ts | 6 +- .../test/pkgSnapshotToResolution.ts | 6 +- lockfile/merge-lockfile-changes/src/index.ts | 4 +- lockfile/merge-lockfile-changes/test/index.ts | 108 ++-- lockfile/prune-lockfile/test/index.ts | 148 ++--- .../makeVirtualNodeModules.test.ts.snap | 6 +- packages/calc-dep-state/test/index.ts | 16 +- .../test/lockfileToDepGraph.test.ts | 24 +- packages/constants/src/index.ts | 3 +- packages/dependency-path/src/index.ts | 38 +- packages/dependency-path/test/index.ts | 97 +--- .../test/fixtures/fixture/pnpm-lock.yaml | 79 +-- .../make-dedicated-lockfile/test/index.ts | 8 +- pkg-manager/core/src/install/index.ts | 4 +- pkg-manager/core/test/install/aliases.ts | 2 +- pkg-manager/core/test/install/errors.ts | 4 +- pkg-manager/core/test/install/fixLockfile.ts | 2 +- pkg-manager/core/test/install/fromRepo.ts | 4 +- .../test/install/gitBranchLockfile.test.ts | 2 +- pkg-manager/core/test/install/hoist.ts | 12 +- pkg-manager/core/test/install/hooks.ts | 2 +- .../core/test/install/lifecycleScripts.ts | 12 +- pkg-manager/core/test/install/local.ts | 2 +- pkg-manager/core/test/install/misc.ts | 10 +- .../core/test/install/multipleImporters.ts | 4 +- .../core/test/install/optionalDependencies.ts | 26 +- .../core/test/install/peerDependencies.ts | 10 +- pkg-manager/core/test/install/reporting.ts | 2 +- pkg-manager/core/test/install/sideEffects.ts | 4 +- pkg-manager/core/test/lockfile.ts | 2 +- pkg-manager/core/test/uninstall.ts | 2 +- pkg-manager/get-context/src/readLockfiles.ts | 5 +- pkg-manager/headless/test/index.ts | 22 +- pkg-manager/package-requester/test/index.ts | 8 +- .../test/dedupe.ts | 14 +- .../test/linkRecursive.ts | 2 +- .../resolve-dependencies/src/depPathToRef.ts | 2 +- pnpm/test/monorepo/index.ts | 2 +- resolving/npm-resolver/src/createNpmPkgId.ts | 2 +- resolving/npm-resolver/test/index.ts | 80 +-- .../npm-resolver/test/publishedBy.test.ts | 4 +- .../dependencies-hierarchy/test/index.ts | 2 +- .../license-scanner/test/getPkgInfo.spec.ts | 4 +- .../license-scanner/test/licenses.spec.ts | 10 +- reviewing/outdated/test/outdated.spec.ts | 40 +- store/server/test/index.ts | 2 +- 65 files changed, 864 insertions(+), 1069 deletions(-) create mode 100644 .changeset/light-jobs-speak.md diff --git a/.changeset/light-jobs-speak.md b/.changeset/light-jobs-speak.md new file mode 100644 index 00000000000..6e5456dde93 --- /dev/null +++ b/.changeset/light-jobs-speak.md @@ -0,0 +1,19 @@ +--- +"@pnpm/reviewing.dependencies-hierarchy": major +"@pnpm/merge-lockfile-changes": major +"@pnpm/license-scanner": major +"@pnpm/filter-lockfile": major +"@pnpm/lockfile-to-pnp": major +"@pnpm/lockfile-walker": major +"@pnpm/dependency-path": major +"@pnpm/lockfile-utils": major +"@pnpm/prune-lockfile": major +"@pnpm/lockfile-file": major +"@pnpm/npm-resolver": major +"@pnpm/outdated": major +"@pnpm/make-dedicated-lockfile": minor +"@pnpm/mount-modules": minor +"@pnpm/constants": major +--- + +Support for lockfile v5 is dropped. Use pnpm v8 to convert lockfile v5 to lockfile v6 [#7470](https://github.com/pnpm/pnpm/pull/7470). diff --git a/__fixtures__/has-major-outdated-deps/pnpm-lock.yaml b/__fixtures__/has-major-outdated-deps/pnpm-lock.yaml index b007cfd6c6e..dc4e68291eb 100644 --- a/__fixtures__/has-major-outdated-deps/pnpm-lock.yaml +++ b/__fixtures__/has-major-outdated-deps/pnpm-lock.yaml @@ -1,21 +1,22 @@ +lockfileVersion: '6.0' dependencies: - is-negative: 1.0.0 + is-negative: + version: 1.0.0 + specifier: 1.0.0 devDependencies: - is-positive: 2.0.0 -lockfileVersion: 5.1 + is-positive: + version: 2.0.0 + specifier: 2.0.0 packages: - /is-negative/1.0.0: + /is-negative@1.0.0: dev: false engines: node: '>=0.10.0' resolution: integrity: sha512-1aKMsFUc7vYQGzt//8zhkjRWPoYkajY/I5MJEvrc0pDoHXrW7n5ri8DYxhy3rR+Dk0QFl7GjHHsZU1sppQrWtw== - /is-positive/2.0.0: + /is-positive@2.0.0: dev: true engines: node: '>=0.10.0' resolution: integrity: sha512-uJQLtRnc7RP/Xo8tjkK9MJsWdnuKhiD5e8x+idmkUqr2p0R+n/ZdDFG1LEt98WwoRzWhSefhPnyLBleKZhg/Lg== -specifiers: - is-negative: 1.0.0 - is-positive: 2.0.0 diff --git a/__fixtures__/has-not-outdated-deps/node_modules/.pnpm/lock.yaml b/__fixtures__/has-not-outdated-deps/node_modules/.pnpm/lock.yaml index e6f727bb714..d8a36876447 100644 --- a/__fixtures__/has-not-outdated-deps/node_modules/.pnpm/lock.yaml +++ b/__fixtures__/has-not-outdated-deps/node_modules/.pnpm/lock.yaml @@ -1,16 +1,17 @@ +lockfileVersion: '6.0' dependencies: - is-negative: 2.1.0 - is-positive: 3.1.0 -lockfileVersion: 5.1 + is-negative: + version: 2.1.0 + specifier: ^2.1.0 + is-positive: + version: 3.1.0 + specifier: ^3.1.0 packages: - /is-negative/2.1.0: + /is-negative@2.1.0: dev: false resolution: - integrity: sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc= - /is-positive/3.1.0: + integrity: sha512-+iCKT4ZcvjRnjkHnQjZ8/qfciLLGD8BFKS0GNR5VjDU6jEiwh899R0GSMkaYcuTNd7fEKXb3Qib0webe6HczNw== + /is-positive@3.1.0: dev: false resolution: - integrity: sha1-hX21hKG6XRyymAUn/DtsQ103sP0= -specifiers: - is-negative: ^2.1.0 - is-positive: ^3.1.0 + integrity: sha512-8ND1j3y9/HP94TOvGzr69/FgbkX2ruOldhLEsTWwcJVfo4oRjwemJmJxt7RJkKYH8tz7vYBP9JcKQY8CLuJ90Q== diff --git a/__fixtures__/has-not-outdated-deps/pnpm-lock.yaml b/__fixtures__/has-not-outdated-deps/pnpm-lock.yaml index 3c0a9760dff..d8a36876447 100644 --- a/__fixtures__/has-not-outdated-deps/pnpm-lock.yaml +++ b/__fixtures__/has-not-outdated-deps/pnpm-lock.yaml @@ -1,16 +1,17 @@ +lockfileVersion: '6.0' dependencies: - is-negative: 2.1.0 - is-positive: 3.1.0 -lockfileVersion: 5.1 + is-negative: + version: 2.1.0 + specifier: ^2.1.0 + is-positive: + version: 3.1.0 + specifier: ^3.1.0 packages: - /is-negative/2.1.0: + /is-negative@2.1.0: dev: false resolution: integrity: sha512-+iCKT4ZcvjRnjkHnQjZ8/qfciLLGD8BFKS0GNR5VjDU6jEiwh899R0GSMkaYcuTNd7fEKXb3Qib0webe6HczNw== - /is-positive/3.1.0: + /is-positive@3.1.0: dev: false resolution: integrity: sha512-8ND1j3y9/HP94TOvGzr69/FgbkX2ruOldhLEsTWwcJVfo4oRjwemJmJxt7RJkKYH8tz7vYBP9JcKQY8CLuJ90Q== -specifiers: - is-negative: ^2.1.0 - is-positive: ^3.1.0 diff --git a/__fixtures__/has-outdated-deps-and-external-shrinkwrap/node_modules/.pnpm/lock.yaml b/__fixtures__/has-outdated-deps-and-external-shrinkwrap/node_modules/.pnpm/lock.yaml index cc7dff5dc03..5b85490c9a3 100644 --- a/__fixtures__/has-outdated-deps-and-external-shrinkwrap/node_modules/.pnpm/lock.yaml +++ b/__fixtures__/has-outdated-deps-and-external-shrinkwrap/node_modules/.pnpm/lock.yaml @@ -1,16 +1,17 @@ +lockfileVersion: '6.0' importers: pkg: dependencies: - is-negative: 1.0.0 - is-positive: 1.0.0 - specifiers: - is-negative: ^1.0.0 - is-positive: ^1.0.0 -lockfileVersion: 5 + is-negative: + version: 1.0.0 + specifier: ^1.0.0 + is-positive: + version: 1.0.0 + specifier: ^1.0.0 packages: - /is-negative/1.0.0: + /is-negative@1.0.0: resolution: integrity: sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc= - /is-positive/1.0.0: + /is-positive@1.0.0: resolution: integrity: sha1-iACYVrZKLx632LsBeUGEJK4EUss= diff --git a/__fixtures__/has-outdated-deps-and-external-shrinkwrap/pnpm-lock.yaml b/__fixtures__/has-outdated-deps-and-external-shrinkwrap/pnpm-lock.yaml index 9fe46bf3467..21aad2133c3 100644 --- a/__fixtures__/has-outdated-deps-and-external-shrinkwrap/pnpm-lock.yaml +++ b/__fixtures__/has-outdated-deps-and-external-shrinkwrap/pnpm-lock.yaml @@ -1,16 +1,17 @@ +lockfileVersion: '6.0' importers: pkg: dependencies: - is-negative: 1.1.0 - is-positive: 3.1.0 - specifiers: - is-negative: ^1.1.0 - is-positive: ^3.1.0 -lockfileVersion: 5 + is-negative: + version: 1.1.0 + specifier: ^1.1.0 + is-positive: + version: 3.1.0 + specifier: ^3.1.0 packages: - /is-negative/1.1.0: + /is-negative@1.1.0: resolution: integrity: sha512-+iCKT4ZcvjRnjkHnQjZ8/qfciLLGD8BFKS0GNR5VjDU6jEiwh899R0GSMkaYcuTNd7fEKXb3Qib0webe6HczNw== - /is-positive/3.1.0: + /is-positive@3.1.0: resolution: integrity: sha512-8ND1j3y9/HP94TOvGzr69/FgbkX2ruOldhLEsTWwcJVfo4oRjwemJmJxt7RJkKYH8tz7vYBP9JcKQY8CLuJ90Q== diff --git a/__fixtures__/pkg-with-external-lockfile/pnpm-lock.yaml b/__fixtures__/pkg-with-external-lockfile/pnpm-lock.yaml index e483c9f8ca8..26b0bdbc51f 100644 --- a/__fixtures__/pkg-with-external-lockfile/pnpm-lock.yaml +++ b/__fixtures__/pkg-with-external-lockfile/pnpm-lock.yaml @@ -1,25 +1,34 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + importers: + pkg: dependencies: - express: 4.17.1 - specifiers: - express: 4.17.1 -lockfileVersion: 5.1 + express: + specifier: 4.17.1 + version: 4.17.1 + packages: - /accepts/1.3.7: + + /accepts@1.3.7: + resolution: {integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==} + engines: {node: '>= 0.6'} dependencies: mime-types: 2.1.27 negotiator: 0.6.2 dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== - /array-flatten/1.1.1: + + /array-flatten@1.1.1: + resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} dev: false - resolution: - integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - /body-parser/1.19.0: + + /body-parser@1.19.0: + resolution: {integrity: sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==} + engines: {node: '>= 0.8'} dependencies: bytes: 3.1.0 content-type: 1.0.4 @@ -31,78 +40,77 @@ packages: qs: 6.7.0 raw-body: 2.4.0 type-is: 1.6.18 - dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== - /bytes/3.1.0: - dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== - /content-disposition/0.5.3: + transitivePeerDependencies: + - supports-color + dev: false + + /bytes@3.1.0: + resolution: {integrity: sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==} + engines: {node: '>= 0.8'} + dev: false + + /content-disposition@0.5.3: + resolution: {integrity: sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==} + engines: {node: '>= 0.6'} dependencies: safe-buffer: 5.1.2 dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== - /content-type/1.0.4: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== - /cookie-signature/1.0.6: - dev: false - resolution: - integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - /cookie/0.4.0: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== - /debug/2.6.9: + + /content-type@1.0.4: + resolution: {integrity: sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==} + engines: {node: '>= 0.6'} + dev: false + + /cookie-signature@1.0.6: + resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} + dev: false + + /cookie@0.4.0: + resolution: {integrity: sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==} + engines: {node: '>= 0.6'} + dev: false + + /debug@2.6.9: + resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: false - resolution: - integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - /depd/1.1.2: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== - /destroy/1.0.4: - dev: false - resolution: - integrity: sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg== - /ee-first/1.1.1: - dev: false - resolution: - integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - /encodeurl/1.0.2: - dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - /escape-html/1.0.3: - dev: false - resolution: - integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - /etag/1.8.1: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - /express/4.17.1: + + /depd@1.1.2: + resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} + engines: {node: '>= 0.6'} + dev: false + + /destroy@1.0.4: + resolution: {integrity: sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==} + dev: false + + /ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + dev: false + + /encodeurl@1.0.2: + resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} + engines: {node: '>= 0.8'} + dev: false + + /escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + dev: false + + /etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + dev: false + + /express@4.17.1: + resolution: {integrity: sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==} + engines: {node: '>= 0.10.0'} dependencies: accepts: 1.3.7 array-flatten: 1.1.1 @@ -134,12 +142,13 @@ packages: type-is: 1.6.18 utils-merge: 1.0.1 vary: 1.1.2 + transitivePeerDependencies: + - supports-color dev: false - engines: - node: '>= 0.10.0' - resolution: - integrity: sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== - /finalhandler/1.1.2: + + /finalhandler@1.1.2: + resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} + engines: {node: '>= 0.8'} dependencies: debug: 2.6.9 encodeurl: 1.0.2 @@ -148,24 +157,23 @@ packages: parseurl: 1.3.3 statuses: 1.5.0 unpipe: 1.0.0 - dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== - /forwarded/0.1.2: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-Ua9xNhH0b8pwE3yRbFfXJvfdWF0UHNCdeyb2sbi9Ul/M+r3PTdrz7Cv4SCfZRMjmzEM9PhraqfZFbGTIg3OMyA== - /fresh/0.5.2: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - /http-errors/1.7.2: + transitivePeerDependencies: + - supports-color + dev: false + + /forwarded@0.1.2: + resolution: {integrity: sha512-Ua9xNhH0b8pwE3yRbFfXJvfdWF0UHNCdeyb2sbi9Ul/M+r3PTdrz7Cv4SCfZRMjmzEM9PhraqfZFbGTIg3OMyA==} + engines: {node: '>= 0.6'} + dev: false + + /fresh@0.5.2: + resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + engines: {node: '>= 0.6'} + dev: false + + /http-errors@1.7.2: + resolution: {integrity: sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==} + engines: {node: '>= 0.6'} dependencies: depd: 1.1.2 inherits: 2.0.3 @@ -173,11 +181,10 @@ packages: statuses: 1.5.0 toidentifier: 1.0.0 dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== - /http-errors/1.7.3: + + /http-errors@1.7.3: + resolution: {integrity: sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==} + engines: {node: '>= 0.6'} dependencies: depd: 1.1.2 inherits: 2.0.4 @@ -185,142 +192,127 @@ packages: statuses: 1.5.0 toidentifier: 1.0.0 dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== - /iconv-lite/0.4.24: + + /iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} dependencies: safer-buffer: 2.1.2 dev: false - engines: - node: '>=0.10.0' - resolution: - integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - /inherits/2.0.3: - dev: false - resolution: - integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== - /inherits/2.0.4: - dev: false - resolution: - integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - /ipaddr.js/1.9.1: - dev: false - engines: - node: '>= 0.10' - resolution: - integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - /media-typer/0.3.0: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - /merge-descriptors/1.0.1: - dev: false - resolution: - integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== - /methods/1.1.2: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - /mime-db/1.44.0: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== - /mime-types/2.1.27: + + /inherits@2.0.3: + resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==} + dev: false + + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: false + + /ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + dev: false + + /media-typer@0.3.0: + resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} + engines: {node: '>= 0.6'} + dev: false + + /merge-descriptors@1.0.1: + resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} + dev: false + + /methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + dev: false + + /mime-db@1.44.0: + resolution: {integrity: sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==} + engines: {node: '>= 0.6'} + dev: false + + /mime-types@2.1.27: + resolution: {integrity: sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==} + engines: {node: '>= 0.6'} dependencies: mime-db: 1.44.0 dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== - /mime/1.6.0: - dev: false - engines: - node: '>=4' + + /mime@1.6.0: + resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} + engines: {node: '>=4'} hasBin: true - resolution: - integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - /ms/2.0.0: - dev: false - resolution: - integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - /ms/2.1.1: - dev: false - resolution: - integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - /negotiator/0.6.2: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== - /on-finished/2.3.0: + dev: false + + /ms@2.0.0: + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} + dev: false + + /ms@2.1.1: + resolution: {integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==} + dev: false + + /negotiator@0.6.2: + resolution: {integrity: sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==} + engines: {node: '>= 0.6'} + dev: false + + /on-finished@2.3.0: + resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} + engines: {node: '>= 0.8'} dependencies: ee-first: 1.1.1 dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww== - /parseurl/1.3.3: - dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - /path-to-regexp/0.1.7: - dev: false - resolution: - integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== - /proxy-addr/2.0.6: + + /parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + dev: false + + /path-to-regexp@0.1.7: + resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} + dev: false + + /proxy-addr@2.0.6: + resolution: {integrity: sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==} + engines: {node: '>= 0.10'} dependencies: forwarded: 0.1.2 ipaddr.js: 1.9.1 dev: false - engines: - node: '>= 0.10' - resolution: - integrity: sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw== - /qs/6.7.0: - dev: false - engines: - node: '>=0.6' - resolution: - integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== - /range-parser/1.2.1: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - /raw-body/2.4.0: + + /qs@6.7.0: + resolution: {integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==} + engines: {node: '>=0.6'} + dev: false + + /range-parser@1.2.1: + resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} + engines: {node: '>= 0.6'} + dev: false + + /raw-body@2.4.0: + resolution: {integrity: sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==} + engines: {node: '>= 0.8'} dependencies: bytes: 3.1.0 http-errors: 1.7.2 iconv-lite: 0.4.24 unpipe: 1.0.0 dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== - /safe-buffer/5.1.2: + + /safe-buffer@5.1.2: + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} dev: false - resolution: - integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - /safer-buffer/2.1.2: + + /safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: false - resolution: - integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - /send/0.17.1: + + /send@0.17.1: + resolution: {integrity: sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==} + engines: {node: '>= 0.8.0'} dependencies: debug: 2.6.9 depd: 1.1.2 @@ -335,62 +327,55 @@ packages: on-finished: 2.3.0 range-parser: 1.2.1 statuses: 1.5.0 + transitivePeerDependencies: + - supports-color dev: false - engines: - node: '>= 0.8.0' - resolution: - integrity: sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== - /serve-static/1.14.1: + + /serve-static@1.14.1: + resolution: {integrity: sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==} + engines: {node: '>= 0.8.0'} dependencies: encodeurl: 1.0.2 escape-html: 1.0.3 parseurl: 1.3.3 send: 0.17.1 - dev: false - engines: - node: '>= 0.8.0' - resolution: - integrity: sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== - /setprototypeof/1.1.1: - dev: false - resolution: - integrity: sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== - /statuses/1.5.0: - dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== - /toidentifier/1.0.0: - dev: false - engines: - node: '>=0.6' - resolution: - integrity: sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== - /type-is/1.6.18: + transitivePeerDependencies: + - supports-color + dev: false + + /setprototypeof@1.1.1: + resolution: {integrity: sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==} + dev: false + + /statuses@1.5.0: + resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} + engines: {node: '>= 0.6'} + dev: false + + /toidentifier@1.0.0: + resolution: {integrity: sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==} + engines: {node: '>=0.6'} + dev: false + + /type-is@1.6.18: + resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} + engines: {node: '>= 0.6'} dependencies: media-typer: 0.3.0 mime-types: 2.1.27 dev: false - engines: - node: '>= 0.6' - resolution: - integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - /unpipe/1.0.0: - dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== - /utils-merge/1.0.1: - dev: false - engines: - node: '>= 0.4.0' - resolution: - integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - /vary/1.1.2: - dev: false - engines: - node: '>= 0.8' - resolution: - integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== + + /unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + dev: false + + /utils-merge@1.0.1: + resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} + engines: {node: '>= 0.4.0'} + dev: false + + /vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + dev: false diff --git a/exec/plugin-commands-rebuild/test/index.ts b/exec/plugin-commands-rebuild/test/index.ts index 53dafc2c260..e9a436be5c1 100644 --- a/exec/plugin-commands-rebuild/test/index.ts +++ b/exec/plugin-commands-rebuild/test/index.ts @@ -36,7 +36,7 @@ test('rebuilds dependencies', async () => { let modules = await project.readModulesManifest() expect(modules!.pendingBuilds).toStrictEqual([ - '/@pnpm.e2e/pre-and-postinstall-scripts-example/1.0.0', + '/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', 'github.com/pnpm/test-git-fetch/299c6d89507571462b992b92407a8a07663e32ee', ]) @@ -78,7 +78,7 @@ test('rebuilds dependencies', async () => { const cacheIntegrityPath = getFilePathInCafs(cafsDir, getIntegrity('@pnpm.e2e/pre-and-postinstall-scripts-example', '1.0.0'), 'index') const cacheIntegrity = await loadJsonFile(cacheIntegrityPath) // eslint-disable-line @typescript-eslint/no-explicit-any expect(cacheIntegrity!.sideEffects).toBeTruthy() - const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin/1.0.0': {} })}` + const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin@1.0.0': {} })}` expect(cacheIntegrity).toHaveProperty(['sideEffects', sideEffectsKey, 'generated-by-postinstall.js']) delete cacheIntegrity!.sideEffects[sideEffectsKey]['generated-by-postinstall.js'] }) @@ -110,7 +110,7 @@ test('skipIfHasSideEffectsCache', async () => { let modules = await project.readModulesManifest() expect(modules!.pendingBuilds).toStrictEqual([ - '/@pnpm.e2e/pre-and-postinstall-scripts-example/1.0.0', + '/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', ]) const modulesManifest = await project.readModulesManifest() @@ -224,7 +224,7 @@ test('rebuild with pending option', async () => { let modules = await project.readModulesManifest() expect(modules!.pendingBuilds).toStrictEqual([ - '/@pnpm.e2e/pre-and-postinstall-scripts-example/1.0.0', + '/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', 'github.com/pnpm-e2e/install-scripts-example/b6cfdb8af6f8d5ebc5e7de6831af9d38084d765b', ]) @@ -415,4 +415,4 @@ test('never build neverBuiltDependencies', async () => { 'node_modules/@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js' ) ).toBeTruthy() -}) \ No newline at end of file +}) diff --git a/lockfile/audit/test/index.ts b/lockfile/audit/test/index.ts index 734e9339346..a16c7cbae6b 100644 --- a/lockfile/audit/test/index.ts +++ b/lockfile/audit/test/index.ts @@ -22,12 +22,12 @@ describe('audit', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'bar-integrity', }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.0.0', }, @@ -89,12 +89,12 @@ describe('audit', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'bar-integrity', }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.0.0', }, diff --git a/lockfile/filter-lockfile/test/filterByImporters.ts b/lockfile/filter-lockfile/test/filterByImporters.ts index 3b971adb2b7..d3c7b4d2b3d 100644 --- a/lockfile/filter-lockfile/test/filterByImporters.ts +++ b/lockfile/filter-lockfile/test/filterByImporters.ts @@ -32,18 +32,18 @@ test('filterByImporters(): only prod dependencies of one importer', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, @@ -52,7 +52,7 @@ test('filterByImporters(): only prod dependencies of one importer', () => { }, resolution: { integrity: '' }, }, - '/project-2-prod-dep/1.0.0': { + '/project-2-prod-dep@1.0.0': { resolution: { integrity: '' }, }, }, @@ -94,10 +94,10 @@ test('filterByImporters(): only prod dependencies of one importer', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, @@ -131,7 +131,7 @@ test('filterByImporters(): fail on missing packages when failOnMissingDependenci }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, @@ -156,7 +156,7 @@ test('filterByImporters(): fail on missing packages when failOnMissingDependenci err = _ } expect(err).not.toBeNull() - expect(err.message).toEqual(`Broken lockfile: no entry for '/prod-dep-dep/1.0.0' in ${WANTED_LOCKFILE}`) + expect(err.message).toEqual(`Broken lockfile: no entry for '/prod-dep-dep@1.0.0' in ${WANTED_LOCKFILE}`) }) test('filterByImporters(): do not fail on missing packages when failOnMissingDependencies is false', () => { @@ -177,7 +177,7 @@ test('filterByImporters(): do not fail on missing packages when failOnMissingDep }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, @@ -217,7 +217,7 @@ test('filterByImporters(): do not fail on missing packages when failOnMissingDep }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, @@ -258,18 +258,18 @@ test('filterByImporters(): do not include skipped packages', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, @@ -278,7 +278,7 @@ test('filterByImporters(): do not include skipped packages', () => { }, resolution: { integrity: '' }, }, - '/project-2-prod-dep/1.0.0': { + '/project-2-prod-dep@1.0.0': { resolution: { integrity: '' }, }, }, @@ -291,7 +291,7 @@ test('filterByImporters(): do not include skipped packages', () => { devDependencies: true, optionalDependencies: true, }, - skipped: new Set(['/optional-dep/1.0.0']), + skipped: new Set(['/optional-dep@1.0.0']), } ) @@ -324,14 +324,14 @@ test('filterByImporters(): do not include skipped packages', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, @@ -367,19 +367,19 @@ test('filterByImporters(): exclude orphan packages', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/orphan/1.0.0': { + '/orphan@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, resolution: { integrity: '' }, }, - '/project-2-prod-dep/1.0.0': { + '/project-2-prod-dep@1.0.0': { resolution: { integrity: '' }, }, }, @@ -421,16 +421,16 @@ test('filterByImporters(): exclude orphan packages', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { 'prod-dep-dep': '1.0.0', }, resolution: { integrity: '' }, }, - '/project-2-prod-dep/1.0.0': { + '/project-2-prod-dep@1.0.0': { resolution: { integrity: '' }, }, }, diff --git a/lockfile/filter-lockfile/test/filterByImportersAndEngine.ts b/lockfile/filter-lockfile/test/filterByImportersAndEngine.ts index f9adda22c14..c72a1741d52 100644 --- a/lockfile/filter-lockfile/test/filterByImportersAndEngine.ts +++ b/lockfile/filter-lockfile/test/filterByImportersAndEngine.ts @@ -24,7 +24,7 @@ afterEach(() => { }) test('filterByImportersAndEngine(): skip packages that are not installable', () => { - const skippedPackages = new Set(['/preserve-existing-skipped/1.0.0']) + const skippedPackages = new Set(['/preserve-existing-skipped@1.0.0']) const filteredLockfile = filterLockfileByImportersAndEngine( { importers: { @@ -57,22 +57,22 @@ test('filterByImportersAndEngine(): skip packages that are not installable', () }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/not-skipped-optional/1.0.0': { + '/not-skipped-optional@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { dependencies: { bar: '1.0.0', foo: '1.0.0', @@ -83,10 +83,10 @@ test('filterByImportersAndEngine(): skip packages that are not installable', () optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { bar: '1.0.0', 'prod-dep-dep': '1.0.0', @@ -96,7 +96,7 @@ test('filterByImportersAndEngine(): skip packages that are not installable', () }, resolution: { integrity: '' }, }, - '/project-2-prod-dep/1.0.0': { + '/project-2-prod-dep@1.0.0': { resolution: { integrity: '' }, }, }, @@ -157,22 +157,22 @@ test('filterByImportersAndEngine(): skip packages that are not installable', () }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/not-skipped-optional/1.0.0': { + '/not-skipped-optional@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { dependencies: { bar: '1.0.0', foo: '1.0.0', @@ -183,10 +183,10 @@ test('filterByImportersAndEngine(): skip packages that are not installable', () optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { bar: '1.0.0', 'prod-dep-dep': '1.0.0', @@ -198,7 +198,7 @@ test('filterByImportersAndEngine(): skip packages that are not installable', () }, }, }) - expect(Array.from(skippedPackages)).toStrictEqual(['/preserve-existing-skipped/1.0.0', '/optional-dep/1.0.0', '/foo/1.0.0']) + expect(Array.from(skippedPackages)).toStrictEqual(['/preserve-existing-skipped@1.0.0', '/optional-dep@1.0.0', '/foo@1.0.0']) }) test('filterByImportersAndEngine(): filter the packages that set os and cpu', () => { @@ -211,7 +211,7 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', () }, }) - const skippedPackages = new Set(['/preserve-existing-skipped/1.0.0']) + const skippedPackages = new Set(['/preserve-existing-skipped@1.0.0']) const filteredLockfile = filterLockfileByImportersAndEngine( { importers: { @@ -244,22 +244,22 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', () }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/not-skipped-optional/1.0.0': { + '/not-skipped-optional@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { dependencies: { bar: '1.0.0', foo: '1.0.0', @@ -269,10 +269,10 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', () optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { bar: '1.0.0', 'prod-dep-dep': '1.0.0', @@ -282,7 +282,7 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', () }, resolution: { integrity: '' }, }, - '/project-2-prod-dep/1.0.0': { + '/project-2-prod-dep@1.0.0': { resolution: { integrity: '' }, }, }, @@ -343,22 +343,22 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', () }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/not-skipped-optional/1.0.0': { + '/not-skipped-optional@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { dependencies: { bar: '1.0.0', foo: '1.0.0', @@ -368,10 +368,10 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', () optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { bar: '1.0.0', 'prod-dep-dep': '1.0.0', @@ -383,11 +383,11 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', () }, }, }) - expect(Array.from(skippedPackages)).toStrictEqual(['/preserve-existing-skipped/1.0.0', '/optional-dep/1.0.0', '/foo/1.0.0']) + expect(Array.from(skippedPackages)).toStrictEqual(['/preserve-existing-skipped@1.0.0', '/optional-dep@1.0.0', '/foo@1.0.0']) }) test('filterByImportersAndEngine(): filter the packages that set libc', () => { - const skippedPackages = new Set(['/preserve-existing-skipped/1.0.0']) + const skippedPackages = new Set(['/preserve-existing-skipped@1.0.0']) const filteredLockfile = filterLockfileByImportersAndEngine( { importers: { @@ -420,22 +420,22 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/not-skipped-optional/1.0.0': { + '/not-skipped-optional@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { dependencies: { bar: '1.0.0', foo: '1.0.0', @@ -444,10 +444,10 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => { optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { bar: '1.0.0', 'prod-dep-dep': '1.0.0', @@ -457,7 +457,7 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => { }, resolution: { integrity: '' }, }, - '/project-2-prod-dep/1.0.0': { + '/project-2-prod-dep@1.0.0': { resolution: { integrity: '' }, }, }, @@ -518,22 +518,22 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/dev-dep/1.0.0': { + '/dev-dep@1.0.0': { dev: true, resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/not-skipped-optional/1.0.0': { + '/not-skipped-optional@1.0.0': { optional: true, resolution: { integrity: '' }, }, - '/optional-dep/1.0.0': { + '/optional-dep@1.0.0': { dependencies: { bar: '1.0.0', foo: '1.0.0', @@ -542,10 +542,10 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => { optional: true, resolution: { integrity: '' }, }, - '/prod-dep-dep/1.0.0': { + '/prod-dep-dep@1.0.0': { resolution: { integrity: '' }, }, - '/prod-dep/1.0.0': { + '/prod-dep@1.0.0': { dependencies: { bar: '1.0.0', 'prod-dep-dep': '1.0.0', @@ -557,7 +557,7 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => { }, }, }) - expect(Array.from(skippedPackages)).toStrictEqual(['/preserve-existing-skipped/1.0.0', '/optional-dep/1.0.0', '/foo/1.0.0']) + expect(Array.from(skippedPackages)).toStrictEqual(['/preserve-existing-skipped@1.0.0', '/optional-dep@1.0.0', '/foo@1.0.0']) }) test('filterByImportersAndEngine(): includes linked packages', () => { @@ -594,10 +594,10 @@ test('filterByImportersAndEngine(): includes linked packages', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: '' }, }, }, @@ -661,10 +661,10 @@ test('filterByImportersAndEngine(): includes linked packages', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: '' }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: '' }, }, }, diff --git a/lockfile/lockfile-file/src/experiments/inlineSpecifiersLockfileConverters.ts b/lockfile/lockfile-file/src/experiments/inlineSpecifiersLockfileConverters.ts index f0b67c921c9..5e864925040 100644 --- a/lockfile/lockfile-file/src/experiments/inlineSpecifiersLockfileConverters.ts +++ b/lockfile/lockfile-file/src/experiments/inlineSpecifiersLockfileConverters.ts @@ -1,4 +1,3 @@ -import * as dp from '@pnpm/dependency-path' import type { Lockfile, ProjectSnapshot, ResolvedDependencies } from '@pnpm/lockfile-types' import { INLINE_SPECIFIERS_FORMAT_LOCKFILE_VERSION_SUFFIX, @@ -15,42 +14,8 @@ export function isExperimentalInlineSpecifiersFormat ( } export function convertToInlineSpecifiersFormat (lockfile: Lockfile): InlineSpecifiersLockfile { - let importers = lockfile.importers - let packages = lockfile.packages - if (lockfile.lockfileVersion.toString().startsWith('6.')) { - importers = Object.fromEntries( - Object.entries(lockfile.importers ?? {}) - .map(([importerId, pkgSnapshot]: [string, ProjectSnapshot]) => { - const newSnapshot = { ...pkgSnapshot } - if (newSnapshot.dependencies != null) { - newSnapshot.dependencies = mapValues(newSnapshot.dependencies, convertOldRefToNewRef) - } - if (newSnapshot.optionalDependencies != null) { - newSnapshot.optionalDependencies = mapValues(newSnapshot.optionalDependencies, convertOldRefToNewRef) - } - if (newSnapshot.devDependencies != null) { - newSnapshot.devDependencies = mapValues(newSnapshot.devDependencies, convertOldRefToNewRef) - } - return [importerId, newSnapshot] - }) - ) - packages = Object.fromEntries( - Object.entries(lockfile.packages ?? {}) - .map(([depPath, pkgSnapshot]) => { - const newSnapshot = { ...pkgSnapshot } - if (newSnapshot.dependencies != null) { - newSnapshot.dependencies = mapValues(newSnapshot.dependencies, convertOldRefToNewRef) - } - if (newSnapshot.optionalDependencies != null) { - newSnapshot.optionalDependencies = mapValues(newSnapshot.optionalDependencies, convertOldRefToNewRef) - } - return [convertOldDepPathToNewDepPath(depPath), newSnapshot] - }) - ) - } const newLockfile = { ...lockfile, - packages, lockfileVersion: lockfile.lockfileVersion.toString().startsWith('6.') ? lockfile.lockfileVersion.toString() : ( @@ -58,44 +23,11 @@ export function convertToInlineSpecifiersFormat (lockfile: Lockfile): InlineSpec ? lockfile.lockfileVersion.toString() : `${lockfile.lockfileVersion}${INLINE_SPECIFIERS_FORMAT_LOCKFILE_VERSION_SUFFIX}` ), - importers: mapValues(importers, convertProjectSnapshotToInlineSpecifiersFormat), - } - if (lockfile.lockfileVersion.toString().startsWith('6.') && newLockfile.time) { - newLockfile.time = Object.fromEntries( - Object.entries(newLockfile.time) - .map(([depPath, time]) => [convertOldDepPathToNewDepPath(depPath), time]) - ) + importers: mapValues(lockfile.importers, convertProjectSnapshotToInlineSpecifiersFormat), } return newLockfile } -function convertOldDepPathToNewDepPath (oldDepPath: string) { - const parsedDepPath = dp.parse(oldDepPath) - if (!parsedDepPath.name || !parsedDepPath.version) return oldDepPath - let newDepPath = `/${parsedDepPath.name}@${parsedDepPath.version}` - if (parsedDepPath.peersSuffix) { - if (parsedDepPath.peersSuffix.startsWith('(')) { - newDepPath += parsedDepPath.peersSuffix - } else { - newDepPath += `_${parsedDepPath.peersSuffix}` - } - } - if (parsedDepPath.host) { - newDepPath = `${parsedDepPath.host}${newDepPath}` - } - return newDepPath -} - -function convertOldRefToNewRef (oldRef: string) { - if (oldRef.startsWith('link:') || oldRef.startsWith('file:')) { - return oldRef - } - if (oldRef.includes('/')) { - return convertOldDepPathToNewDepPath(oldRef) - } - return oldRef -} - export function revertFromInlineSpecifiersFormatIfNecessary (lockfile: Lockfile | InlineSpecifiersLockfile): Lockfile { return isExperimentalInlineSpecifiersFormat(lockfile) ? revertFromInlineSpecifiersFormat(lockfile) @@ -111,71 +43,14 @@ export function revertFromInlineSpecifiersFormat (lockfile: InlineSpecifiersLock throw new Error(`Unable to revert lockfile from inline specifiers format. Invalid version parsed: ${originalVersionStr}`) } - let revertedImporters = mapValues(importers, revertProjectSnapshot) - let packages = lockfile.packages - if (originalVersionStr.startsWith('6.')) { - revertedImporters = Object.fromEntries( - Object.entries(revertedImporters ?? {}) - .map(([importerId, pkgSnapshot]: [string, ProjectSnapshot]) => { - const newSnapshot = { ...pkgSnapshot } - if (newSnapshot.dependencies != null) { - newSnapshot.dependencies = mapValues(newSnapshot.dependencies, convertNewRefToOldRef) - } - if (newSnapshot.optionalDependencies != null) { - newSnapshot.optionalDependencies = mapValues(newSnapshot.optionalDependencies, convertNewRefToOldRef) - } - if (newSnapshot.devDependencies != null) { - newSnapshot.devDependencies = mapValues(newSnapshot.devDependencies, convertNewRefToOldRef) - } - return [importerId, newSnapshot] - }) - ) - packages = Object.fromEntries( - Object.entries(lockfile.packages ?? {}) - .map(([depPath, pkgSnapshot]) => { - const newSnapshot = { ...pkgSnapshot } - if (newSnapshot.dependencies != null) { - newSnapshot.dependencies = mapValues(newSnapshot.dependencies, convertNewRefToOldRef) - } - if (newSnapshot.optionalDependencies != null) { - newSnapshot.optionalDependencies = mapValues(newSnapshot.optionalDependencies, convertNewRefToOldRef) - } - return [convertLockfileV6DepPathToV5DepPath(depPath), newSnapshot] - }) - ) - } const newLockfile = { ...rest, lockfileVersion: lockfileVersion.endsWith(INLINE_SPECIFIERS_FORMAT_LOCKFILE_VERSION_SUFFIX) ? originalVersion : lockfileVersion, - packages, - importers: revertedImporters, - } - if (originalVersionStr.startsWith('6.') && newLockfile.time) { - newLockfile.time = Object.fromEntries( - Object.entries(newLockfile.time) - .map(([depPath, time]) => [convertLockfileV6DepPathToV5DepPath(depPath), time]) - ) + importers: mapValues(importers, revertProjectSnapshot), } return newLockfile } -export function convertLockfileV6DepPathToV5DepPath (newDepPath: string) { - if (!newDepPath.includes('@', 2) || newDepPath.startsWith('file:')) return newDepPath - const index = newDepPath.indexOf('@', newDepPath.indexOf('/@') + 2) - if (newDepPath.includes('(') && index > dp.indexOfPeersSuffix(newDepPath)) return newDepPath - return `${newDepPath.substring(0, index)}/${newDepPath.substring(index + 1)}` -} - -function convertNewRefToOldRef (oldRef: string) { - if (oldRef.startsWith('link:') || oldRef.startsWith('file:')) { - return oldRef - } - if (oldRef.includes('@')) { - return convertLockfileV6DepPathToV5DepPath(oldRef) - } - return oldRef -} - function convertProjectSnapshotToInlineSpecifiersFormat ( projectSnapshot: ProjectSnapshot ): InlineSpecifiersProjectSnapshot { diff --git a/lockfile/lockfile-file/src/write.ts b/lockfile/lockfile-file/src/write.ts index 73e1619e91a..5c90e0ce7bf 100644 --- a/lockfile/lockfile-file/src/write.ts +++ b/lockfile/lockfile-file/src/write.ts @@ -4,7 +4,6 @@ import { DEPENDENCIES_FIELDS } from '@pnpm/types' import { type Lockfile, type ProjectSnapshot } from '@pnpm/lockfile-types' import { WANTED_LOCKFILE } from '@pnpm/constants' import rimraf from '@zkochan/rimraf' -import * as dp from '@pnpm/dependency-path' import yaml from 'js-yaml' import equals from 'ramda/src/equals' import pickBy from 'ramda/src/pickBy' @@ -146,7 +145,7 @@ export function normalizeLockfile (lockfile: Lockfile, opts: NormalizeLockfileOp } } if (lockfileToSave.time) { - lockfileToSave.time = (lockfileToSave.lockfileVersion.toString().startsWith('6.') ? pruneTimeInLockfileV6 : pruneTime)(lockfileToSave.time, lockfile.importers) + lockfileToSave.time = pruneTimeInLockfileV6(lockfileToSave.time, lockfile.importers) } if ((lockfileToSave.overrides != null) && isEmpty(lockfileToSave.overrides)) { delete lockfileToSave.overrides @@ -204,24 +203,6 @@ function refToRelative ( return reference } -function pruneTime (time: Record, importers: Record): Record { - const rootDepPaths = new Set() - for (const importer of Object.values(importers)) { - for (const depType of DEPENDENCIES_FIELDS) { - for (let [depName, ref] of Object.entries(importer[depType] ?? {})) { - // @ts-expect-error - if (ref['version']) ref = ref['version'] - const suffixStart = ref.indexOf('_') - const refWithoutPeerSuffix = suffixStart === -1 ? ref : ref.slice(0, suffixStart) - const depPath = dp.refToRelative(refWithoutPeerSuffix, depName) - if (!depPath) continue - rootDepPaths.add(depPath) - } - } - } - return pickBy((t, depPath) => rootDepPaths.has(depPath), time) -} - export async function writeLockfiles ( opts: { forceSharedFormat?: boolean diff --git a/lockfile/lockfile-file/test/__snapshots__/write.test.ts.snap b/lockfile/lockfile-file/test/__snapshots__/write.test.ts.snap index f072e187bac..6ee88b73674 100644 --- a/lockfile/lockfile-file/test/__snapshots__/write.test.ts.snap +++ b/lockfile/lockfile-file/test/__snapshots__/write.test.ts.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`writeLockfiles() 1`] = ` -"lockfileVersion: 5.4 - -specifiers: - is-negative: ^1.0.0 - is-positive: ^1.0.0 +"lockfileVersion: '6.0' dependencies: - is-negative: 1.0.0 - is-positive: 1.0.0 + is-negative: + specifier: ^1.0.0 + version: 1.0.0 + is-positive: + specifier: ^1.0.0 + version: 1.0.0 packages: - /is-negative/1.0.0: + /is-negative@1.0.0: resolution: {integrity: sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=} engines: {node: '>=10', npm: "\\nfoo\\n"} cpu: [x86] @@ -22,10 +22,10 @@ packages: dependencies: is-positive: 2.0.0 - /is-positive/1.0.0: + /is-positive@1.0.0: resolution: {integrity: sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=} - /is-positive/2.0.0: + /is-positive@2.0.0: resolution: {integrity: sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=} " `; diff --git a/lockfile/lockfile-file/test/lockfileV6Converters.test.ts b/lockfile/lockfile-file/test/lockfileV6Converters.test.ts index b962c67d3a8..6336f618375 100644 --- a/lockfile/lockfile-file/test/lockfileV6Converters.test.ts +++ b/lockfile/lockfile-file/test/lockfileV6Converters.test.ts @@ -2,7 +2,7 @@ import { convertToInlineSpecifiersFormat, revertFromInlineSpecifiersFormat } fro test('convertToInlineSpecifiersFormat()', () => { const lockfileV5 = { - lockfileVersion: 5.0, + lockfileVersion: '6.0', importers: { project1: { specifiers: { @@ -16,21 +16,21 @@ test('convertToInlineSpecifiersFormat()', () => { tarball: '@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz', }, devDependencies: { - bar: '/@bar/bar/1.0.0_@babel+core@2.0.0', + bar: '/@bar/bar@1.0.0(@babel/core@2.0.0)', }, optionalDependencies: { - qar: 'reg.com/qar/1.0.0', + qar: 'reg.com/qar@1.0.0', }, }, }, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: '' }, }, - '/@bar/bar/1.0.0_@babel+core@2.0.0': { + '/@bar/bar@1.0.0(@babel/core@2.0.0)': { resolution: { integrity: '' }, }, - 'reg.com/qar/1.0.0': { + 'reg.com/qar@1.0.0': { resolution: { integrity: '' }, }, '@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz': { @@ -39,7 +39,7 @@ test('convertToInlineSpecifiersFormat()', () => { }, } const lockfileV6 = { - lockfileVersion: '5-inlineSpecifiers', + lockfileVersion: '6.0', importers: { project1: { dependencies: { @@ -55,25 +55,25 @@ test('convertToInlineSpecifiersFormat()', () => { devDependencies: { bar: { specifier: '^1.0.0', - version: '/@bar/bar/1.0.0_@babel+core@2.0.0', + version: '/@bar/bar@1.0.0(@babel/core@2.0.0)', }, }, optionalDependencies: { qar: { specifier: '^1.0.0', - version: 'reg.com/qar/1.0.0', + version: 'reg.com/qar@1.0.0', }, }, }, }, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: '' }, }, - '/@bar/bar/1.0.0_@babel+core@2.0.0': { + '/@bar/bar@1.0.0(@babel/core@2.0.0)': { resolution: { integrity: '' }, }, - 'reg.com/qar/1.0.0': { + 'reg.com/qar@1.0.0': { resolution: { integrity: '' }, }, '@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz': { @@ -101,21 +101,21 @@ test('convertToInlineSpecifiersFormat() with lockfile v6', () => { tarball: '@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz', }, devDependencies: { - bar: '/@bar/bar/1.0.0_@babel+core@2.0.0', + bar: '/@bar/bar@1.0.0(@babel/core@2.0.0)', }, optionalDependencies: { - qar: 'reg.com/qar/1.0.0', + qar: 'reg.com/qar@1.0.0', }, }, }, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: '' }, }, - '/@bar/bar/1.0.0_@babel+core@2.0.0': { + '/@bar/bar@1.0.0(@babel/core@2.0.0)': { resolution: { integrity: '' }, }, - 'reg.com/qar/1.0.0': { + 'reg.com/qar@1.0.0': { resolution: { integrity: '' }, }, '@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz': { @@ -140,7 +140,7 @@ test('convertToInlineSpecifiersFormat() with lockfile v6', () => { devDependencies: { bar: { specifier: '^1.0.0', - version: '/@bar/bar@1.0.0_@babel+core@2.0.0', + version: '/@bar/bar@1.0.0(@babel/core@2.0.0)', }, }, optionalDependencies: { @@ -155,7 +155,7 @@ test('convertToInlineSpecifiersFormat() with lockfile v6', () => { '/foo@1.0.0': { resolution: { integrity: '' }, }, - '/@bar/bar@1.0.0_@babel+core@2.0.0': { + '/@bar/bar@1.0.0(@babel/core@2.0.0)': { resolution: { integrity: '' }, }, 'reg.com/qar@1.0.0': { diff --git a/lockfile/lockfile-file/test/normalizeLockfile.test.ts b/lockfile/lockfile-file/test/normalizeLockfile.test.ts index 7b2377af942..e48f31bce45 100644 --- a/lockfile/lockfile-file/test/normalizeLockfile.test.ts +++ b/lockfile/lockfile-file/test/normalizeLockfile.test.ts @@ -91,7 +91,7 @@ test('redundant fields are removed from "time"', () => { bar: '1.0.0', }, devDependencies: { - foo: '1.0.0_react@18.0.0', + foo: '1.0.0(react@18.0.0)', }, optionalDependencies: { qar: '1.0.0', @@ -104,10 +104,10 @@ test('redundant fields are removed from "time"', () => { }, }, time: { - '/bar/1.0.0': '2021-02-11T22:54:29.120Z', - '/foo/1.0.0': '2021-02-11T22:54:29.120Z', - '/qar/1.0.0': '2021-02-11T22:54:29.120Z', - '/zoo/1.0.0': '2021-02-11T22:54:29.120Z', + '/bar@1.0.0': '2021-02-11T22:54:29.120Z', + '/foo@1.0.0': '2021-02-11T22:54:29.120Z', + '/qar@1.0.0': '2021-02-11T22:54:29.120Z', + '/zoo@1.0.0': '2021-02-11T22:54:29.120Z', }, }, { forceSharedFormat: false, @@ -120,7 +120,7 @@ test('redundant fields are removed from "time"', () => { bar: '1.0.0', }, devDependencies: { - foo: '1.0.0_react@18.0.0', + foo: '1.0.0(react@18.0.0)', }, optionalDependencies: { qar: '1.0.0', @@ -133,9 +133,9 @@ test('redundant fields are removed from "time"', () => { }, }, time: { - '/bar/1.0.0': '2021-02-11T22:54:29.120Z', - '/foo/1.0.0': '2021-02-11T22:54:29.120Z', - '/qar/1.0.0': '2021-02-11T22:54:29.120Z', + '/bar@1.0.0': '2021-02-11T22:54:29.120Z', + '/foo@1.0.0': '2021-02-11T22:54:29.120Z', + '/qar@1.0.0': '2021-02-11T22:54:29.120Z', }, }) }) diff --git a/lockfile/lockfile-file/test/write.test.ts b/lockfile/lockfile-file/test/write.test.ts index 89e733d7982..4b2460e0d88 100644 --- a/lockfile/lockfile-file/test/write.test.ts +++ b/lockfile/lockfile-file/test/write.test.ts @@ -29,7 +29,7 @@ test('writeLockfiles()', async () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { os: ['darwin'], dependencies: { 'is-positive': '2.0.0', @@ -44,12 +44,12 @@ test('writeLockfiles()', async () => { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/2.0.0': { + '/is-positive@2.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, @@ -109,7 +109,7 @@ test('write does not use yaml anchors/aliases', async () => { }, lockfileVersion: LOCKFILE_VERSION, packages: yaml` - /react-dnd/2.5.4/react@15.6.1: + /react-dnd@2.5.4(react@15.6.1): dependencies: disposables: 1.0.2 dnd-core: 2.5.4 @@ -124,7 +124,7 @@ test('write does not use yaml anchors/aliases', async () => { react: '1' resolution: integrity: sha512-y9YmnusURc+3KPgvhYKvZ9oCucj51MSZWODyaeV0KFU0cquzA7dCD1g/OIYUKtNoZ+MXtacDngkdud2TklMSjw== - /react-dnd/2.5.4/react@15.6.2: + /react-dnd@2.5.4(react@15.6.2): dependencies: disposables: 1.0.2 dnd-core: 2.5.4 @@ -169,19 +169,19 @@ test('writeLockfiles() does not fail if the lockfile has undefined properties', }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { // eslint-disable-next-line dependencies: undefined as any, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/2.0.0': { + '/is-positive@2.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, @@ -213,7 +213,7 @@ test('writeLockfiles() when useGitBranchLockfile', async () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, diff --git a/lockfile/lockfile-to-pnp/src/index.ts b/lockfile/lockfile-to-pnp/src/index.ts index eaf7a08434a..87bfde62421 100644 --- a/lockfile/lockfile-to-pnp/src/index.ts +++ b/lockfile/lockfile-to-pnp/src/index.ts @@ -131,6 +131,6 @@ function toPackageDependenciesMap ( function toPnPVersion (version: string, peersSuffix: string | undefined) { return peersSuffix - ? `virtual:${version}_${peersSuffix}#${version}` + ? `virtual:${version}${peersSuffix}#${version}` : version } diff --git a/lockfile/lockfile-to-pnp/test/index.ts b/lockfile/lockfile-to-pnp/test/index.ts index 0473886069f..b1bf86ecc2f 100644 --- a/lockfile/lockfile-to-pnp/test/index.ts +++ b/lockfile/lockfile-to-pnp/test/index.ts @@ -8,7 +8,7 @@ test('lockfileToPackageRegistry', () => { importer1: { dependencies: { dep1: '1.0.0', - dep2: '/foo/2.0.0', + dep2: '/foo@2.0.0', }, optionalDependencies: { qar: '2.0.0', @@ -24,15 +24,15 @@ test('lockfileToPackageRegistry', () => { }, lockfileVersion: 5, packages: { - '/dep1/1.0.0': { + '/dep1@1.0.0': { dependencies: { - dep2: '/foo/2.0.0', + dep2: '/foo@2.0.0', }, resolution: { integrity: '', }, }, - '/foo/2.0.0': { + '/foo@2.0.0': { dependencies: { qar: '3.0.0', }, @@ -40,12 +40,12 @@ test('lockfileToPackageRegistry', () => { integrity: '', }, }, - '/qar/2.0.0': { + '/qar@2.0.0': { resolution: { integrity: '', }, }, - '/qar/3.0.0': { + '/qar@3.0.0': { resolution: { integrity: '', }, @@ -178,7 +178,7 @@ test('lockfileToPackageRegistry packages that have peer deps', () => { importers: { importer: { dependencies: { - haspeer: '2.0.0_peer@1.0.0', + haspeer: '2.0.0(peer@1.0.0)', peer: '1.0.0', }, specifiers: {}, @@ -186,7 +186,7 @@ test('lockfileToPackageRegistry packages that have peer deps', () => { }, lockfileVersion: 5, packages: { - '/haspeer/2.0.0_peer@1.0.0': { + '/haspeer@2.0.0(peer@1.0.0)': { dependencies: { peer: '1.0.0', }, @@ -197,7 +197,7 @@ test('lockfileToPackageRegistry packages that have peer deps', () => { integrity: '', }, }, - '/peer/1.0.0': { + '/peer@1.0.0': { resolution: { integrity: '', }, @@ -244,7 +244,7 @@ test('lockfileToPackageRegistry packages that have peer deps', () => { { packageDependencies: [ ['importer', 'importer'], - ['haspeer', 'virtual:2.0.0_peer@1.0.0#2.0.0'], + ['haspeer', 'virtual:2.0.0(peer@1.0.0)#2.0.0'], ['peer', '1.0.0'], ], packageLocation: './importer', @@ -256,10 +256,10 @@ test('lockfileToPackageRegistry packages that have peer deps', () => { 'haspeer', [ [ - 'virtual:2.0.0_peer@1.0.0#2.0.0', + 'virtual:2.0.0(peer@1.0.0)#2.0.0', { packageDependencies: [ - ['haspeer', 'virtual:2.0.0_peer@1.0.0#2.0.0'], + ['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', diff --git a/lockfile/lockfile-utils/test/nameVerFromPkgSnapshot.ts b/lockfile/lockfile-utils/test/nameVerFromPkgSnapshot.ts index 697cb317b64..abb60bb2e91 100644 --- a/lockfile/lockfile-utils/test/nameVerFromPkgSnapshot.ts +++ b/lockfile/lockfile-utils/test/nameVerFromPkgSnapshot.ts @@ -14,7 +14,7 @@ test('nameVerFromPkgSnapshot()', () => { version: '1.0.0', }) - expect(nameVerFromPkgSnapshot('/foo/1.0.0', { + expect(nameVerFromPkgSnapshot('/foo@1.0.0', { resolution: { integrity: 'AAA', }, @@ -24,13 +24,13 @@ test('nameVerFromPkgSnapshot()', () => { version: '1.0.0', }) - expect(nameVerFromPkgSnapshot('/foo/1.0.0_bar@2.0.0', { + expect(nameVerFromPkgSnapshot('/foo@1.0.0(bar@2.0.0)', { resolution: { integrity: 'AAA', }, })).toEqual({ name: 'foo', - peersSuffix: 'bar@2.0.0', + peersSuffix: '(bar@2.0.0)', version: '1.0.0', }) }) diff --git a/lockfile/lockfile-utils/test/pkgSnapshotToResolution.ts b/lockfile/lockfile-utils/test/pkgSnapshotToResolution.ts index 4f922fbb063..110e11a1937 100644 --- a/lockfile/lockfile-utils/test/pkgSnapshotToResolution.ts +++ b/lockfile/lockfile-utils/test/pkgSnapshotToResolution.ts @@ -1,7 +1,7 @@ import { pkgSnapshotToResolution } from '@pnpm/lockfile-utils' test('pkgSnapshotToResolution()', () => { - expect(pkgSnapshotToResolution('/foo/1.0.0', { + expect(pkgSnapshotToResolution('/foo@1.0.0', { resolution: { integrity: 'AAAA', }, @@ -10,7 +10,7 @@ test('pkgSnapshotToResolution()', () => { tarball: 'https://registry.npmjs.org/foo/-/foo-1.0.0.tgz', }) - expect(pkgSnapshotToResolution('/@mycompany/mypackage/2.0.0', { + expect(pkgSnapshotToResolution('/@mycompany/mypackage@2.0.0', { resolution: { integrity: 'AAAA', tarball: '@mycompany/mypackage/-/@mycompany/mypackage-2.0.0.tgz', @@ -20,7 +20,7 @@ test('pkgSnapshotToResolution()', () => { tarball: 'https://mycompany.jfrog.io/mycompany/api/npm/npm-local/@mycompany/mypackage/-/@mycompany/mypackage-2.0.0.tgz', }) - expect(pkgSnapshotToResolution('/@mycompany/mypackage/2.0.0', { + expect(pkgSnapshotToResolution('/@mycompany/mypackage@2.0.0', { resolution: { integrity: 'AAAA', tarball: '@mycompany/mypackage/-/@mycompany/mypackage-2.0.0.tgz', diff --git a/lockfile/merge-lockfile-changes/src/index.ts b/lockfile/merge-lockfile-changes/src/index.ts index 3c31f6b0e21..4e5f711a07e 100644 --- a/lockfile/merge-lockfile-changes/src/index.ts +++ b/lockfile/merge-lockfile-changes/src/index.ts @@ -84,8 +84,8 @@ function takeChangedValue (ourValue: T, theirValue: T): T { function mergeVersions (ourValue: string, theirValue: string) { if (ourValue === theirValue || !theirValue) return ourValue if (!ourValue) return theirValue - const [ourVersion] = ourValue.split('_') - const [theirVersion] = theirValue.split('_') + const [ourVersion] = ourValue.split('(') + const [theirVersion] = theirValue.split('(') if (semver.gt(ourVersion, theirVersion)) { return ourValue } diff --git a/lockfile/merge-lockfile-changes/test/index.ts b/lockfile/merge-lockfile-changes/test/index.ts index c7411dcf8c2..88f8685cc24 100644 --- a/lockfile/merge-lockfile-changes/test/index.ts +++ b/lockfile/merge-lockfile-changes/test/index.ts @@ -14,7 +14,7 @@ const simpleLockfile = { }, lockfileVersion: 5.2, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, @@ -31,8 +31,8 @@ test('picks the newer version when dependencies differ inside importer', () => { ...simpleLockfile.importers['.'], dependencies: { foo: '1.2.0', - bar: '3.0.0_qar@1.0.0', - zoo: '4.0.0_qar@1.0.0', + bar: '3.0.0(qar@1.0.0)', + zoo: '4.0.0(qar@1.0.0)', }, }, }, @@ -44,16 +44,16 @@ test('picks the newer version when dependencies differ inside importer', () => { ...simpleLockfile.importers['.'], dependencies: { foo: '1.1.0', - bar: '4.0.0_qar@1.0.0', - zoo: '3.0.0_qar@1.0.0', + bar: '4.0.0(qar@1.0.0)', + zoo: '3.0.0(qar@1.0.0)', }, }, }, } ) expect(mergedLockfile.importers['.'].dependencies?.foo).toBe('1.2.0') - expect(mergedLockfile.importers['.'].dependencies?.bar).toBe('4.0.0_qar@1.0.0') - expect(mergedLockfile.importers['.'].dependencies?.zoo).toBe('4.0.0_qar@1.0.0') + expect(mergedLockfile.importers['.'].dependencies?.bar).toBe('4.0.0(qar@1.0.0)') + expect(mergedLockfile.importers['.'].dependencies?.zoo).toBe('4.0.0(qar@1.0.0)') }) test('picks the newer version when dependencies differ inside package', () => { @@ -68,7 +68,7 @@ test('picks the newer version when dependencies differ inside package', () => { }, lockfileVersion: 5.2, packages: { - '/a/1.0.0': { + '/a@1.0.0': { dependencies: { foo: '1.0.0', }, @@ -76,7 +76,7 @@ test('picks the newer version when dependencies differ inside package', () => { integrity: '', }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: '', }, @@ -88,19 +88,19 @@ test('picks the newer version when dependencies differ inside package', () => { ...base, packages: { ...base.packages, - '/a/1.0.0': { + '/a@1.0.0': { dependencies: { linked: 'link:../1', foo: '1.2.0', - bar: '3.0.0_qar@1.0.0', - zoo: '4.0.0_qar@1.0.0', + bar: '3.0.0(qar@1.0.0)', + zoo: '4.0.0(qar@1.0.0)', qar: '1.0.0', }, resolution: { integrity: '', }, }, - '/bar/3.0.0_qar@1.0.0': { + '/bar@3.0.0(qar@1.0.0)': { dependencies: { qar: '1.0.0', }, @@ -108,7 +108,7 @@ test('picks the newer version when dependencies differ inside package', () => { integrity: '', }, }, - '/zoo/4.0.0_qar@1.0.0': { + '/zoo@4.0.0(qar@1.0.0)': { dependencies: { qar: '1.0.0', }, @@ -116,12 +116,12 @@ test('picks the newer version when dependencies differ inside package', () => { integrity: '', }, }, - '/foo/1.2.0': { + '/foo@1.2.0': { resolution: { integrity: '', }, }, - '/qar/1.0.0': { + '/qar@1.0.0': { resolution: { integrity: '', }, @@ -132,19 +132,19 @@ test('picks the newer version when dependencies differ inside package', () => { ...base, packages: { ...base.packages, - '/a/1.0.0': { + '/a@1.0.0': { dependencies: { linked: 'link:../1', foo: '1.1.0', - bar: '4.0.0_qar@1.0.0', - zoo: '3.0.0_qar@1.0.0', + bar: '4.0.0(qar@1.0.0)', + zoo: '3.0.0(qar@1.0.0)', qar: '1.0.0', }, resolution: { integrity: '', }, }, - '/bar/4.0.0_qar@1.0.0': { + '/bar@4.0.0(qar@1.0.0)': { dependencies: { qar: '1.0.0', }, @@ -152,7 +152,7 @@ test('picks the newer version when dependencies differ inside package', () => { integrity: '', }, }, - '/zoo/3.0.0_qar@1.0.0': { + '/zoo@3.0.0(qar@1.0.0)': { dependencies: { qar: '1.0.0', }, @@ -160,12 +160,12 @@ test('picks the newer version when dependencies differ inside package', () => { integrity: '', }, }, - '/foo/1.1.0': { + '/foo@1.1.0': { resolution: { integrity: '', }, }, - '/qar/1.0.0': { + '/qar@1.0.0': { resolution: { integrity: '', }, @@ -173,20 +173,20 @@ test('picks the newer version when dependencies differ inside package', () => { }, } ) - expect(mergedLockfile.packages?.['/a/1.0.0'].dependencies?.linked).toBe('link:../1') - expect(mergedLockfile.packages?.['/a/1.0.0'].dependencies?.foo).toBe('1.2.0') - expect(mergedLockfile.packages?.['/a/1.0.0'].dependencies?.bar).toBe('4.0.0_qar@1.0.0') - expect(mergedLockfile.packages?.['/a/1.0.0'].dependencies?.zoo).toBe('4.0.0_qar@1.0.0') + expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.linked).toBe('link:../1') + expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.foo).toBe('1.2.0') + expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.bar).toBe('4.0.0(qar@1.0.0)') + expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.zoo).toBe('4.0.0(qar@1.0.0)') expect(Object.keys(mergedLockfile.packages ?? {}).sort()).toStrictEqual([ - '/a/1.0.0', - '/bar/3.0.0_qar@1.0.0', - '/bar/4.0.0_qar@1.0.0', - '/foo/1.0.0', - '/foo/1.1.0', - '/foo/1.2.0', - '/qar/1.0.0', - '/zoo/3.0.0_qar@1.0.0', - '/zoo/4.0.0_qar@1.0.0', + '/a@1.0.0', + '/bar@3.0.0(qar@1.0.0)', + '/bar@4.0.0(qar@1.0.0)', + '/foo@1.0.0', + '/foo@1.1.0', + '/foo@1.2.0', + '/qar@1.0.0', + '/zoo@3.0.0(qar@1.0.0)', + '/zoo@4.0.0(qar@1.0.0)', ]) }) @@ -195,7 +195,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { { ...simpleLockfile, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.0.0', }, @@ -203,7 +203,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, @@ -213,7 +213,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { { ...simpleLockfile, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.1.0', }, @@ -221,7 +221,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.1.0': { + '/bar@1.1.0': { dependencies: { qar: '1.0.0', }, @@ -229,7 +229,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/qar/1.0.0': { + '/qar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, @@ -241,7 +241,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { expect(mergedLockfile).toStrictEqual({ ...simpleLockfile, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.1.0', }, @@ -249,12 +249,12 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.1.0': { + '/bar@1.1.0': { dependencies: { qar: '1.0.0', }, @@ -262,7 +262,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/qar/1.0.0': { + '/qar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, @@ -276,7 +276,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { { ...simpleLockfile, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.0.0', }, @@ -284,7 +284,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, @@ -294,7 +294,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { { ...simpleLockfile, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.1.0', }, @@ -302,7 +302,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.1.0': { + '/bar@1.1.0': { dependencies: { qar: '1.0.0', }, @@ -310,7 +310,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/qar/1.0.0': { + '/qar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, @@ -322,7 +322,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { expect(mergedLockfile).toStrictEqual({ ...simpleLockfile, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.1.0', }, @@ -330,12 +330,12 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/bar/1.1.0': { + '/bar@1.1.0': { dependencies: { qar: '1.0.0', }, @@ -343,7 +343,7 @@ test('prefers our lockfile resolutions when it has newer packages', () => { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, }, - '/qar/1.0.0': { + '/qar@1.0.0': { resolution: { integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==', }, diff --git a/lockfile/prune-lockfile/test/index.ts b/lockfile/prune-lockfile/test/index.ts index e4d58ee1127..7eeb5f7d65d 100644 --- a/lockfile/prune-lockfile/test/index.ts +++ b/lockfile/prune-lockfile/test/index.ts @@ -26,13 +26,13 @@ test('remove one redundant package', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/2.0.0': { + '/is-positive@2.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -59,7 +59,7 @@ test('remove one redundant package', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -114,7 +114,7 @@ test('keep all', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { dependencies: { 'is-positive': '2.0.0', }, @@ -123,13 +123,13 @@ test('keep all', () => { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/2.0.0': { + '/is-positive@2.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -159,7 +159,7 @@ test('keep all', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { dependencies: { 'is-positive': '2.0.0', }, @@ -168,13 +168,13 @@ test('keep all', () => { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/2.0.0': { + '/is-positive@2.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -204,13 +204,13 @@ test('optional dependency should have optional = true', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/foo-child/1.0.0': { + '/foo-child@1.0.0': { optional: true, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { 'foo-child': '1.0.0', }, @@ -219,13 +219,13 @@ test('optional dependency should have optional = true', () => { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/parent-of-foo/1.0.0': { + '/parent-of-foo@1.0.0': { dependencies: { foo: '1.0.0', }, @@ -234,7 +234,7 @@ test('optional dependency should have optional = true', () => { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/pkg-with-good-optional/1.0.0': { + '/pkg-with-good-optional@1.0.0': { dev: false, optionalDependencies: { foo: '1.0.0', @@ -275,13 +275,13 @@ test('optional dependency should have optional = true', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/foo-child/1.0.0': { + '/foo-child@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { 'foo-child': '1.0.0', }, @@ -290,14 +290,14 @@ test('optional dependency should have optional = true', () => { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, optional: true, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/parent-of-foo/1.0.0': { + '/parent-of-foo@1.0.0': { dependencies: { foo: '1.0.0', }, @@ -306,7 +306,7 @@ test('optional dependency should have optional = true', () => { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/pkg-with-good-optional/1.0.0': { + '/pkg-with-good-optional@1.0.0': { dev: false, optionalDependencies: { foo: '1.0.0', @@ -336,13 +336,13 @@ test('optional dependency should not have optional = true if used not only as op }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/pkg-with-good-optional/1.0.0': { + '/pkg-with-good-optional@1.0.0': { dev: false, optionalDependencies: { 'is-positive': '1.0.0', @@ -375,13 +375,13 @@ test('optional dependency should not have optional = true if used not only as op }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/pkg-with-good-optional/1.0.0': { + '/pkg-with-good-optional@1.0.0': { dev: false, optionalDependencies: { 'is-positive': '1.0.0', @@ -412,12 +412,12 @@ test('dev dependency should have dev = true', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/pkg-with-good-optional/1.0.0': { + '/pkg-with-good-optional@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -451,13 +451,13 @@ test('dev dependency should have dev = true', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: true, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/pkg-with-good-optional/1.0.0': { + '/pkg-with-good-optional@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -485,12 +485,12 @@ test('dev dependency should not have dev = true if it is used not only as dev', }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/some-pkg/1.0.0': { + '/some-pkg@1.0.0': { dependencies: { 'is-positive': '1.0.0', }, @@ -527,12 +527,12 @@ test('dev dependency should not have dev = true if it is used not only as dev', }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/some-pkg/1.0.0': { + '/some-pkg@1.0.0': { dependencies: { 'is-positive': '1.0.0', }, @@ -559,7 +559,7 @@ test('the dev field should be updated to dev = false if it is not a dev dependen }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/a/1.0.0': { + '/a@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, @@ -585,7 +585,7 @@ test('the dev field should be updated to dev = false if it is not a dev dependen }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/a/1.0.0': { + '/a@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -608,21 +608,21 @@ test('subdependency is both optional and dev', () => { prod-parent: ^1.0.0 lockfileVersion: 5 packages: - /parent/1.0.0: + /parent@1.0.0: optionalDependencies: subdep: 1.0.0 subdep2: 1.0.0 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /prod-parent/1.0.0: + /prod-parent@1.0.0: dependencies: subdep2: 1.0.0 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /subdep/1.0.0: + /subdep@1.0.0: resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /subdep2/1.0.0: + /subdep2@1.0.0: resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= `, { @@ -647,25 +647,25 @@ test('subdependency is both optional and dev', () => { prod-parent: ^1.0.0 lockfileVersion: 5 packages: - /parent/1.0.0: + /parent@1.0.0: dev: true optionalDependencies: subdep: 1.0.0 subdep2: 1.0.0 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /prod-parent/1.0.0: + /prod-parent@1.0.0: dev: false dependencies: subdep2: 1.0.0 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /subdep/1.0.0: + /subdep@1.0.0: dev: true optional: true resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /subdep2/1.0.0: + /subdep2@1.0.0: resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= `) @@ -676,7 +676,7 @@ test('dev = true is removed if dependency is used both as dev and prod dependenc importers: .: dependencies: - foo: /inflight/1.0.6 + foo: /inflight@1.0.6 devDependencies: inflight: 1.0.6 specifiers: @@ -684,20 +684,20 @@ test('dev = true is removed if dependency is used both as dev and prod dependenc inflight: ^1.0.6 lockfileVersion: 5 packages: - /inflight/1.0.6: + /inflight@1.0.6: dev: true dependencies: once: 1.4.0 wrappy: 1.0.2 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /once/1.4.0: + /once@1.4.0: dev: true dependencies: wrappy: 1.0.2 resolution: integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - /wrappy/1.0.2: + /wrappy@1.0.2: dev: true resolution: integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= @@ -715,7 +715,7 @@ test('dev = true is removed if dependency is used both as dev and prod dependenc importers: .: dependencies: - foo: /inflight/1.0.6 + foo: /inflight@1.0.6 devDependencies: inflight: 1.0.6 specifiers: @@ -723,18 +723,18 @@ test('dev = true is removed if dependency is used both as dev and prod dependenc inflight: ^1.0.6 lockfileVersion: 5 packages: - /inflight/1.0.6: + /inflight@1.0.6: dependencies: once: 1.4.0 wrappy: 1.0.2 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /once/1.4.0: + /once@1.4.0: dependencies: wrappy: 1.0.2 resolution: integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - /wrappy/1.0.2: + /wrappy@1.0.2: resolution: integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= `) @@ -745,7 +745,7 @@ test('optional = true is removed if dependency is used both as optional and prod importers: .: dependencies: - foo: /inflight/1.0.6 + foo: /inflight@1.0.6 optionalDependencies: inflight: 1.0.6 specifiers: @@ -753,20 +753,20 @@ test('optional = true is removed if dependency is used both as optional and prod inflight: ^1.0.6 lockfileVersion: 5 packages: - /inflight/1.0.6: + /inflight@1.0.6: optional: true dependencies: once: 1.4.0 wrappy: 1.0.2 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /once/1.4.0: + /once@1.4.0: optional: true dependencies: wrappy: 1.0.2 resolution: integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - /wrappy/1.0.2: + /wrappy@1.0.2: optional: true resolution: integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= @@ -784,7 +784,7 @@ test('optional = true is removed if dependency is used both as optional and prod importers: .: dependencies: - foo: /inflight/1.0.6 + foo: /inflight@1.0.6 optionalDependencies: inflight: 1.0.6 specifiers: @@ -792,20 +792,20 @@ test('optional = true is removed if dependency is used both as optional and prod inflight: ^1.0.6 lockfileVersion: 5 packages: - /inflight/1.0.6: + /inflight@1.0.6: dev: false dependencies: once: 1.4.0 wrappy: 1.0.2 resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - /once/1.4.0: + /once@1.4.0: dev: false dependencies: wrappy: 1.0.2 resolution: integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - /wrappy/1.0.2: + /wrappy@1.0.2: dev: false resolution: integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= @@ -834,17 +834,17 @@ test('remove dependencies that are not in the package', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/fsevents/1.0.0': { + '/fsevents@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, @@ -877,7 +877,7 @@ test(`ignore dependencies that are in package.json but are not in ${WANTED_LOCKF }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -905,7 +905,7 @@ test(`ignore dependencies that are in package.json but are not in ${WANTED_LOCKF }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -930,7 +930,7 @@ test('keep lockfileMinorVersion, if present', () => { }, lockfileVersion: 5.2, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -957,7 +957,7 @@ test('keep lockfileMinorVersion, if present', () => { }, lockfileVersion: 5.2, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -982,7 +982,7 @@ test('keep linked package even if it is not in package.json', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -1010,7 +1010,7 @@ test('keep linked package even if it is not in package.json', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -1042,19 +1042,19 @@ test("prune: don't remove package used by another importer", () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/2.0.0': { + '/is-positive@2.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -1087,13 +1087,13 @@ test("prune: don't remove package used by another importer", () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-negative/1.0.0': { + '/is-negative@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -1117,13 +1117,13 @@ test('pruneSharedLockfile: remove one redundant package', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', }, }, - '/is-positive/2.0.0': { + '/is-positive@2.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', @@ -1143,7 +1143,7 @@ test('pruneSharedLockfile: remove one redundant package', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: false, resolution: { integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=', diff --git a/modules-mounter/daemon/test/__snapshots__/makeVirtualNodeModules.test.ts.snap b/modules-mounter/daemon/test/__snapshots__/makeVirtualNodeModules.test.ts.snap index 955218f240b..3072f3585dd 100644 --- a/modules-mounter/daemon/test/__snapshots__/makeVirtualNodeModules.test.ts.snap +++ b/modules-mounter/daemon/test/__snapshots__/makeVirtualNodeModules.test.ts.snap @@ -12,7 +12,7 @@ exports[`makeVirtualNodeModules 1`] = ` "@zkochan": { "entries": { "git-config": { - "depPath": "/@zkochan/git-config/0.1.0", + "depPath": "/@zkochan/git-config@0.1.0", "entryType": "index", }, }, @@ -33,7 +33,7 @@ exports[`makeVirtualNodeModules 1`] = ` "node_modules": { "entries": { "ini": { - "depPath": "/ini/1.3.8", + "depPath": "/ini@1.3.8", "entryType": "index", }, }, @@ -47,7 +47,7 @@ exports[`makeVirtualNodeModules 1`] = ` "node_modules": { "entries": { "is-positive": { - "depPath": "/is-positive/1.0.0", + "depPath": "/is-positive@1.0.0", "entryType": "index", }, }, diff --git a/packages/calc-dep-state/test/index.ts b/packages/calc-dep-state/test/index.ts index fb0836a557b..ecb2d48657a 100644 --- a/packages/calc-dep-state/test/index.ts +++ b/packages/calc-dep-state/test/index.ts @@ -2,28 +2,28 @@ import { calcDepState } from '@pnpm/calc-dep-state' import { ENGINE_NAME } from '@pnpm/constants' const depsGraph = { - 'registry/foo/1.0.0': { - depPath: '/foo/1.0.0', + 'registry/foo@1.0.0': { + depPath: '/foo@1.0.0', children: { - bar: 'registry/bar/1.0.0', + bar: 'registry/bar@1.0.0', }, }, - 'registry/bar/1.0.0': { - depPath: '/bar/1.0.0', + 'registry/bar@1.0.0': { + depPath: '/bar@1.0.0', children: { - foo: 'registry/foo/1.0.0', + foo: 'registry/foo@1.0.0', }, }, } test('calcDepState()', () => { - expect(calcDepState(depsGraph, {}, '/registry/foo/1.0.0', { + expect(calcDepState(depsGraph, {}, '/registry/foo@1.0.0', { isBuilt: true, })).toBe(`${ENGINE_NAME}-{}`) }) test('calcDepState() when scripts are ignored', () => { - expect(calcDepState(depsGraph, {}, '/registry/foo/1.0.0', { + expect(calcDepState(depsGraph, {}, '/registry/foo@1.0.0', { isBuilt: false, })).toBe(ENGINE_NAME) }) diff --git a/packages/calc-dep-state/test/lockfileToDepGraph.test.ts b/packages/calc-dep-state/test/lockfileToDepGraph.test.ts index 8ff9f3d11eb..e03bf7df7d2 100644 --- a/packages/calc-dep-state/test/lockfileToDepGraph.test.ts +++ b/packages/calc-dep-state/test/lockfileToDepGraph.test.ts @@ -5,7 +5,7 @@ test('lockfileToDepGraph', () => { lockfileVersion: '6.0', importers: {}, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.0.0', }, @@ -16,7 +16,7 @@ test('lockfileToDepGraph', () => { integrity: '', }, }, - '/bar/1.0.0': { + '/bar@1.0.0': { dependencies: { qar: '1.0.0', }, @@ -24,29 +24,29 @@ test('lockfileToDepGraph', () => { integrity: '', }, }, - '/qar/1.0.0': { + '/qar@1.0.0': { resolution: { integrity: '', }, }, }, })).toStrictEqual({ - '/bar/1.0.0': { + '/bar@1.0.0': { children: { - qar: '/qar/1.0.0', + qar: '/qar@1.0.0', }, - depPath: '/bar/1.0.0', + depPath: '/bar@1.0.0', }, - '/foo/1.0.0': { + '/foo@1.0.0': { children: { - bar: '/bar/1.0.0', - qar: '/qar/1.0.0', + bar: '/bar@1.0.0', + qar: '/qar@1.0.0', }, - depPath: '/foo/1.0.0', + depPath: '/foo@1.0.0', }, - '/qar/1.0.0': { + '/qar@1.0.0': { children: {}, - depPath: '/qar/1.0.0', + depPath: '/qar@1.0.0', }, }) }) diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index d0abf24177f..c510b4e0134 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -1,6 +1,5 @@ export const WANTED_LOCKFILE = 'pnpm-lock.yaml' -export const LOCKFILE_VERSION = 5.4 -export const LOCKFILE_VERSION_V6 = '6.0' +export const LOCKFILE_VERSION = '6.0' export const ENGINE_NAME = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}` export const LAYOUT_VERSION = 5 diff --git a/packages/dependency-path/src/index.ts b/packages/dependency-path/src/index.ts index bfdadf4dc5f..39247dd8df8 100644 --- a/packages/dependency-path/src/index.ts +++ b/packages/dependency-path/src/index.ts @@ -50,10 +50,6 @@ export function tryGetPackageId (registries: Registries, relDepPath: string) { if (sepIndex !== -1) { return resolve(registries, relDepPath.substring(0, sepIndex)) } - const underscoreIndex = relDepPath.indexOf('_', relDepPath.lastIndexOf('/')) - if (underscoreIndex !== -1) { - return resolve(registries, relDepPath.slice(0, underscoreIndex)) - } return resolve(registries, relDepPath) } @@ -104,7 +100,7 @@ export function refToRelative ( return reference } if (!reference.includes('/') || reference.includes('(') && reference.lastIndexOf('/', reference.indexOf('(')) === -1) { - return `/${pkgName}/${reference}` + return `/${pkgName}@${reference}` } return reference } @@ -117,18 +113,12 @@ export function parse (dependencyPath: string) { dependencyPath === null ? 'null' : typeof dependencyPath }\``) } - const _isAbsolute = isAbsolute(dependencyPath) - const parts = dependencyPath.split('/') - if (!_isAbsolute) parts.shift() - const host = _isAbsolute ? parts.shift() : undefined - if (parts.length === 0) return { - host, - isAbsolute: _isAbsolute, - } - const name = parts[0][0] === '@' - ? `${parts.shift()}/${parts.shift()}` - : parts.shift() - let version = parts.join('/') + const sepIndex = dependencyPath.indexOf('@', 2) + if (sepIndex === -1) { + return {} + } + const name = dependencyPath.substring(1, sepIndex) + let version = dependencyPath.substring(sepIndex + 1) if (version) { let peerSepIndex!: number let peersSuffix: string | undefined @@ -138,27 +128,16 @@ export function parse (dependencyPath: string) { peersSuffix = version.substring(peerSepIndex) version = version.substring(0, peerSepIndex) } - } else { - peerSepIndex = version.indexOf('_') - if (peerSepIndex !== -1) { - peersSuffix = version.substring(peerSepIndex + 1) - version = version.substring(0, peerSepIndex) - } } if (semver.valid(version)) { return { - host, - isAbsolute: _isAbsolute, name, peersSuffix, version, } } } - if (!_isAbsolute) throw new Error(`${dependencyPath} is an invalid relative dependency path`) return { - host, - isAbsolute: _isAbsolute, } } @@ -182,7 +161,8 @@ function depPathToFilenameUnescaped (depPath: string) { if (depPath[0] === '/') { depPath = depPath.substring(1) } - const index = depPath.lastIndexOf('/', depPath.includes('(') ? depPath.indexOf('(') - 1 : depPath.length) + const index = depPath.indexOf('@', 1) + if (index === -1) return depPath return `${depPath.substring(0, index)}@${depPath.slice(index + 1)}` } return depPath.replace(':', '+') diff --git a/packages/dependency-path/test/index.ts b/packages/dependency-path/test/index.ts index 53e75432177..884688baec6 100644 --- a/packages/dependency-path/test/index.ts +++ b/packages/dependency-path/test/index.ts @@ -21,97 +21,35 @@ test('parse()', () => { expect(() => parse({} as any)).toThrow(/got `object`/) expect(() => parse(1 as any)).toThrow(/got `number`/) /* eslint-enable @typescript-eslint/no-explicit-any */ - expect(parse('/foo/1.0.0')).toStrictEqual({ - host: undefined, - isAbsolute: false, + expect(parse('/foo@1.0.0')).toStrictEqual({ name: 'foo', peersSuffix: undefined, version: '1.0.0', }) - expect(parse('/@foo/bar/1.0.0')).toStrictEqual({ - host: undefined, - isAbsolute: false, + expect(parse('/@foo/bar@1.0.0')).toStrictEqual({ name: '@foo/bar', peersSuffix: undefined, version: '1.0.0', }) - expect(parse('registry.npmjs.org/foo/1.0.0')).toStrictEqual({ - host: 'registry.npmjs.org', - isAbsolute: true, + expect(parse('/foo@1.0.0(@types/babel__core@7.1.14)')).toStrictEqual({ name: 'foo', - peersSuffix: undefined, - version: '1.0.0', - }) - - expect(parse('registry.npmjs.org/@foo/bar/1.0.0')).toStrictEqual({ - host: 'registry.npmjs.org', - isAbsolute: true, - name: '@foo/bar', - peersSuffix: undefined, - version: '1.0.0', - }) - - expect(parse('github.com/kevva/is-positive')).toStrictEqual({ - host: 'github.com', - isAbsolute: true, - }) - - expect(parse('example.com/foo/1.0.0')).toStrictEqual({ - host: 'example.com', - isAbsolute: true, - name: 'foo', - peersSuffix: undefined, - version: '1.0.0', - }) - - expect(parse('example.com/foo/1.0.0_bar@2.0.0')).toStrictEqual({ - host: 'example.com', - isAbsolute: true, - name: 'foo', - peersSuffix: 'bar@2.0.0', - version: '1.0.0', - }) - - expect(parse('/foo/1.0.0_@types+babel__core@7.1.14')).toStrictEqual({ - host: undefined, - isAbsolute: false, - name: 'foo', - peersSuffix: '@types+babel__core@7.1.14', + peersSuffix: '(@types/babel__core@7.1.14)', version: '1.0.0', }) - expect(parse('example.com/foo/1.0.0(bar@2.0.0)')).toStrictEqual({ - host: 'example.com', - isAbsolute: true, - name: 'foo', - peersSuffix: '(bar@2.0.0)', - version: '1.0.0', - }) - - expect(parse('/foo/1.0.0(@types/babel__core@7.1.14)(foo@1.0.0)')).toStrictEqual({ - host: undefined, - isAbsolute: false, + expect(parse('/foo@1.0.0(@types/babel__core@7.1.14)(foo@1.0.0)')).toStrictEqual({ name: 'foo', peersSuffix: '(@types/babel__core@7.1.14)(foo@1.0.0)', version: '1.0.0', }) - expect(parse('/@(-.-)/foo/1.0.0(@types/babel__core@7.1.14)(foo@1.0.0)')).toStrictEqual({ - host: undefined, - isAbsolute: false, + expect(parse('/@(-.-)/foo@1.0.0(@types/babel__core@7.1.14)(foo@1.0.0)')).toStrictEqual({ name: '@(-.-)/foo', peersSuffix: '(@types/babel__core@7.1.14)(foo@1.0.0)', version: '1.0.0', }) - - expect(() => parse('/foo/bar')).toThrow(/\/foo\/bar is an invalid relative dependency path/) - - expect(parse('file:project(foo@1.0.0)')).toStrictEqual({ - host: 'file:project(foo@1.0.0)', - isAbsolute: true, - }) }) test('refToAbsolute()', () => { @@ -137,8 +75,8 @@ test('refToRelative()', () => { // linked dependencies don't have a relative path expect(refToRelative('link:../foo', 'foo')).toBeNull() expect(refToRelative('file:../tarball.tgz', 'foo')).toEqual('file:../tarball.tgz') - expect(refToRelative('1.3.0(@foo/bar@1.0.0)', '@qar/bar')).toEqual('/@qar/bar/1.3.0(@foo/bar@1.0.0)') - expect(refToRelative('1.3.0(@foo/bar@1.0.0)(@foo/qar@1.0.0)', '@qar/bar')).toEqual('/@qar/bar/1.3.0(@foo/bar@1.0.0)(@foo/qar@1.0.0)') + expect(refToRelative('1.3.0(@foo/bar@1.0.0)', '@qar/bar')).toEqual('/@qar/bar@1.3.0(@foo/bar@1.0.0)') + expect(refToRelative('1.3.0(@foo/bar@1.0.0)(@foo/qar@1.0.0)', '@qar/bar')).toEqual('/@qar/bar@1.3.0(@foo/bar@1.0.0)(@foo/qar@1.0.0)') }) test('relative()', () => { @@ -163,22 +101,21 @@ test('resolve()', () => { }) test('depPathToFilename()', () => { - expect(depPathToFilename('/foo/1.0.0')).toBe('foo@1.0.0') - expect(depPathToFilename('/@foo/bar/1.0.0')).toBe('@foo+bar@1.0.0') - expect(depPathToFilename('github.com/something/foo/0000?v=1')).toBe('github.com+something+foo@0000+v=1') - expect(depPathToFilename('\\//:*?"<>|')).toBe('++@+++++++') - expect(depPathToFilename('/foo/1.0.0(react@16.0.0)(react-dom@16.0.0)')).toBe('foo@1.0.0_react@16.0.0_react-dom@16.0.0') + expect(depPathToFilename('/foo@1.0.0')).toBe('foo@1.0.0') + expect(depPathToFilename('/@foo/bar@1.0.0')).toBe('@foo+bar@1.0.0') + expect(depPathToFilename('github.com/something/foo/0000?v=1')).toBe('github.com+something+foo+0000+v=1') + expect(depPathToFilename('\\//:*?"<>|')).toBe('++++++++++') + expect(depPathToFilename('/foo@1.0.0(react@16.0.0)(react-dom@16.0.0)')).toBe('foo@1.0.0_react@16.0.0_react-dom@16.0.0') const filename = depPathToFilename('file:test/foo-1.0.0.tgz_foo@2.0.0') expect(filename).toBe('file+test+foo-1.0.0.tgz_foo@2.0.0') expect(filename).not.toContain(':') - expect(depPathToFilename('abcd/'.repeat(200))).toBe('abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abc_e5jega7r3xmarw3h6f277a3any') - expect(depPathToFilename('/JSONSteam/1.0.0')).toBe('JSONSteam@1.0.0_jmswpk4sf667aelr6wp2xd3p54') + expect(depPathToFilename('abcd/'.repeat(200))).toBe('abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abcd+abc_jvx2blbax4cyhfgrgozfgpdv24') // cspell:disable-line + expect(depPathToFilename('/JSONSteam@1.0.0')).toBe('JSONSteam@1.0.0_jmswpk4sf667aelr6wp2xd3p54') // cspell:disable-line }) test('tryGetPackageId', () => { - expect(tryGetPackageId({ default: 'https://registry.npmjs.org/' }, '/foo/1.0.0_@types+babel__core@7.1.14')).toEqual('registry.npmjs.org/foo/1.0.0') - expect(tryGetPackageId({ default: 'https://registry.npmjs.org/' }, '/foo/1.0.0(@types/babel__core@7.1.14)')).toEqual('registry.npmjs.org/foo/1.0.0') - expect(tryGetPackageId({ default: 'https://registry.npmjs.org/' }, '/@(-.-)/foo/1.0.0(@types/babel__core@7.1.14)')).toEqual('registry.npmjs.org/@(-.-)/foo/1.0.0') + expect(tryGetPackageId({ default: 'https://registry.npmjs.org/' }, '/foo@1.0.0(@types/babel__core@7.1.14)')).toEqual('registry.npmjs.org/foo@1.0.0') + expect(tryGetPackageId({ default: 'https://registry.npmjs.org/' }, '/@(-.-)/foo@1.0.0(@types/babel__core@7.1.14)')).toEqual('registry.npmjs.org/@(-.-)/foo@1.0.0') }) diff --git a/packages/make-dedicated-lockfile/test/fixtures/fixture/pnpm-lock.yaml b/packages/make-dedicated-lockfile/test/fixtures/fixture/pnpm-lock.yaml index a038a24b5c3..c71bea17e95 100644 --- a/packages/make-dedicated-lockfile/test/fixtures/fixture/pnpm-lock.yaml +++ b/packages/make-dedicated-lockfile/test/fixtures/fixture/pnpm-lock.yaml @@ -1,32 +1,38 @@ -lockfileVersion: 5.3 +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false importers: packages/is-negative: - specifiers: - is-positive: workspace:^ - ramda: 0.26.0 - request: 2.0.0 dependencies: - is-positive: link:../is-positive - ramda: 0.26.0 - request: 2.0.0 + is-positive: + specifier: workspace:^ + version: link:../is-positive + ramda: + specifier: 0.26.0 + version: 0.26.0 + request: + specifier: ^2.0.0 + version: 2.0.0 packages/is-negative/example: - specifiers: - lodash: 1.0.0 dependencies: - lodash: 1.0.0 + lodash: + specifier: 1.0.0 + version: 1.0.0 packages/is-positive: - specifiers: - express: 1.0.0 dependencies: - express: 1.0.0 + express: + specifier: 1.0.0 + version: 1.0.0 packages: - /connect/3.7.0: + /connect@3.7.0: resolution: {integrity: sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==} engines: {node: '>= 0.10.0'} dependencies: @@ -34,37 +40,46 @@ packages: finalhandler: 1.1.2 parseurl: 1.3.3 utils-merge: 1.0.1 + transitivePeerDependencies: + - supports-color dev: false - /debug/2.6.9: + /debug@2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: false - /ee-first/1.1.1: + /ee-first@1.1.1: resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} dev: false - /encodeurl/1.0.2: + /encodeurl@1.0.2: resolution: {integrity: sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=} engines: {node: '>= 0.8'} dev: false - /escape-html/1.0.3: + /escape-html@1.0.3: resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=} dev: false - /express/1.0.0: + /express@1.0.0: resolution: {integrity: sha1-SKQ9eKluuSMvYx0jzI3o+FTY4Ok=} engines: {node: '>= 0.2.0'} deprecated: express 1.x series is deprecated hasBin: true dependencies: connect: 3.7.0 + transitivePeerDependencies: + - supports-color dev: false - /finalhandler/1.1.2: + /finalhandler@1.1.2: resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} engines: {node: '>= 0.8'} dependencies: @@ -75,50 +90,52 @@ packages: parseurl: 1.3.3 statuses: 1.5.0 unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color dev: false - /lodash/1.0.0: + /lodash@1.0.0: resolution: {integrity: sha1-JTXC99y2k3zujSZyxfcTju4N9qk=} engines: {'0': node, '1': rhino} dev: false - /ms/2.0.0: + /ms@2.0.0: resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=} dev: false - /on-finished/2.3.0: + /on-finished@2.3.0: resolution: {integrity: sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=} engines: {node: '>= 0.8'} dependencies: ee-first: 1.1.1 dev: false - /parseurl/1.3.3: + /parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} dev: false - /ramda/0.26.0: + /ramda@0.26.0: resolution: {integrity: sha512-maK1XqpgsOo5DwjhROjqDvpm1vkphLQbpleVv+b3t5Y9uOQ0t8hTHT582+mDs7RLrex1kd4lWYizNXWLVjsq9w==} dev: false - /request/2.0.0: - resolution: {integrity: sha1-6OzcsS3tA7eVqh3g9Er926uY89s=} + /request@2.0.0: + resolution: {integrity: sha512-/YiTJ2FZtvOWFhRE+HHiq3GxpX4e1RMEnqYYQM/0xhQRzQ/dgdHrfK+WB4uRW3OWrcTjWA6uE8GSMhwbm7dLLw==} engines: {'0': node >= 0.3.6} deprecated: request has been deprecated, see https://github.com/request/request/issues/3142 dev: false - /statuses/1.5.0: + /statuses@1.5.0: resolution: {integrity: sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=} engines: {node: '>= 0.6'} dev: false - /unpipe/1.0.0: + /unpipe@1.0.0: resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=} engines: {node: '>= 0.8'} dev: false - /utils-merge/1.0.1: + /utils-merge@1.0.1: resolution: {integrity: sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=} engines: {node: '>= 0.4.0'} dev: false diff --git a/packages/make-dedicated-lockfile/test/index.ts b/packages/make-dedicated-lockfile/test/index.ts index 4280cb364bd..e2e4c94b530 100644 --- a/packages/make-dedicated-lockfile/test/index.ts +++ b/packages/make-dedicated-lockfile/test/index.ts @@ -17,9 +17,9 @@ test('makeDedicatedLockfile()', async () => { const lockfile = await readWantedLockfile(projectDir, { ignoreIncompatible: false }) expect(Object.keys(lockfile?.importers ?? {})).toStrictEqual(['.', 'example']) expect(Object.keys(lockfile?.packages ?? {})).toStrictEqual([ - '/is-positive/1.0.0', - '/lodash/1.0.0', - '/ramda/0.26.0', - '/request/2.0.0', + '/is-positive@1.0.0', + '/lodash@1.0.0', + '/ramda@0.26.0', + '/request@2.0.0', ]) }) diff --git a/pkg-manager/core/src/install/index.ts b/pkg-manager/core/src/install/index.ts index 60608ee7e26..03e3af43ad7 100644 --- a/pkg-manager/core/src/install/index.ts +++ b/pkg-manager/core/src/install/index.ts @@ -5,7 +5,6 @@ import { createAllowBuildFunction } from '@pnpm/builder.policy' import { LAYOUT_VERSION, LOCKFILE_VERSION, - LOCKFILE_VERSION_V6, WANTED_LOCKFILE, } from '@pnpm/constants' import { @@ -382,7 +381,6 @@ export async function mutateModules ( ctx.existsNonEmptyWantedLockfile && ( ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION || - ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION_V6 || ctx.wantedLockfile.lockfileVersion === '6.1' ) && await allProjectsAreUpToDate(Object.values(ctx.projects), { @@ -1078,7 +1076,7 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => { : newLockfile if (opts.updateLockfileMinorVersion) { - newLockfile.lockfileVersion = LOCKFILE_VERSION_V6 + newLockfile.lockfileVersion = LOCKFILE_VERSION } const depsStateCache: DepsStateCache = {} diff --git a/pkg-manager/core/test/install/aliases.ts b/pkg-manager/core/test/install/aliases.ts index 97e4a575b44..ad04e4e0921 100644 --- a/pkg-manager/core/test/install/aliases.ts +++ b/pkg-manager/core/test/install/aliases.ts @@ -1,4 +1,4 @@ -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION } from '@pnpm/constants' +import { LOCKFILE_VERSION } from '@pnpm/constants' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag, getIntegrity } from '@pnpm/registry-mock' import { addDependenciesToPackage } from '@pnpm/core' diff --git a/pkg-manager/core/test/install/errors.ts b/pkg-manager/core/test/install/errors.ts index ac56e527653..8d40033c55a 100644 --- a/pkg-manager/core/test/install/errors.ts +++ b/pkg-manager/core/test/install/errors.ts @@ -32,7 +32,7 @@ test('fail if none of the available resolvers support a version spec', async () expect(err.pkgsStack).toStrictEqual( [ { - id: `localhost+${REGISTRY_MOCK_PORT}/@types/plotly.js/1.44.29`, + id: `localhost+${REGISTRY_MOCK_PORT}/@types/plotly.js@1.44.29`, name: '@types/plotly.js', version: '1.44.29', }, @@ -70,7 +70,7 @@ test('fail if a package cannot be fetched', async () => { expect(err.pkgsStack).toStrictEqual( [ { - id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep/100.0.0`, + id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep@100.0.0`, name: '@pnpm.e2e/pkg-with-1-dep', version: '100.0.0', }, diff --git a/pkg-manager/core/test/install/fixLockfile.ts b/pkg-manager/core/test/install/fixLockfile.ts index 06c5db84657..162f04adab1 100644 --- a/pkg-manager/core/test/install/fixLockfile.ts +++ b/pkg-manager/core/test/install/fixLockfile.ts @@ -1,5 +1,5 @@ import path from 'path' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { install, type MutatedProject, mutateModules } from '@pnpm/core' import writeYamlFile from 'write-yaml-file' diff --git a/pkg-manager/core/test/install/fromRepo.ts b/pkg-manager/core/test/install/fromRepo.ts index 4504dccff20..e1bca297d1e 100644 --- a/pkg-manager/core/test/install/fromRepo.ts +++ b/pkg-manager/core/test/install/fromRepo.ts @@ -293,7 +293,7 @@ test('should not update when adding unrelated dependency', async () => { let manifest = JSON.parse(fs.readFileSync('./package.json', 'utf8')) await install(manifest, await testDefaults({ preferFrozenLockfile: false, dir: withGitProtocolDepFixture, lockfileDir: withGitProtocolDepFixture })) - expect(fs.existsSync('./node_modules/.pnpm/github.com+kevva+is-negative@219c424611ff4a2af15f7deeff4f93c62558c43d')).toBe(true) + expect(fs.existsSync('./node_modules/.pnpm/github.com+kevva+is-negative+219c424611ff4a2af15f7deeff4f93c62558c43d')).toBe(true) manifest = await addDependenciesToPackage(manifest, ['is-number'], await testDefaults({ preferFrozenLockfile: false })) @@ -302,7 +302,7 @@ test('should not update when adding unrelated dependency', async () => { const project = assertProject(withGitProtocolDepFixture) await project.has('is-number') - expect(fs.existsSync('./node_modules/.pnpm/github.com+kevva+is-negative@219c424611ff4a2af15f7deeff4f93c62558c43d')).toBe(true) + expect(fs.existsSync('./node_modules/.pnpm/github.com+kevva+is-negative+219c424611ff4a2af15f7deeff4f93c62558c43d')).toBe(true) expect((await project.readLockfile()).dependencies).toEqual({ 'is-negative': { specifier: 'github:kevva/is-negative#master', diff --git a/pkg-manager/core/test/install/gitBranchLockfile.test.ts b/pkg-manager/core/test/install/gitBranchLockfile.test.ts index f1a5d55b30c..735ebb117c3 100644 --- a/pkg-manager/core/test/install/gitBranchLockfile.test.ts +++ b/pkg-manager/core/test/install/gitBranchLockfile.test.ts @@ -3,7 +3,7 @@ import path from 'path' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { install, mutateModules } from '@pnpm/core' import { testDefaults } from '../utils' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { type ProjectManifest } from '@pnpm/types' import { getCurrentBranch } from '@pnpm/git-utils' import writeYamlFile from 'write-yaml-file' diff --git a/pkg-manager/core/test/install/hoist.ts b/pkg-manager/core/test/install/hoist.ts index 2d128c82834..9bf6522a6a8 100644 --- a/pkg-manager/core/test/install/hoist.ts +++ b/pkg-manager/core/test/install/hoist.ts @@ -11,7 +11,7 @@ import { } from '@pnpm/core' import rimraf from '@zkochan/rimraf' import resolveLinkTarget from 'resolve-link-target' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { addDistTag } from '@pnpm/registry-mock' import symlinkDir from 'symlink-dir' import writeYamlFile from 'write-yaml-file' @@ -159,7 +159,7 @@ test('should rehoist when uninstalling a package', async () => { const modules = await project.readModulesManifest() expect(modules).toBeTruthy() - expect(modules!.hoistedDependencies['/debug/2.6.9']).toStrictEqual({ debug: 'private' }) + expect(modules!.hoistedDependencies['/debug@2.6.9']).toStrictEqual({ debug: 'private' }) }) test('should rehoist after running a general install', async () => { @@ -248,7 +248,7 @@ test('hoist by alias', async () => { const modules = await project.readModulesManifest() expect(modules).toBeTruthy() - expect(modules!.hoistedDependencies).toStrictEqual({ '/@pnpm.e2e/dep-of-pkg-with-1-dep/100.1.0': { dep: 'private' } }) + expect(modules!.hoistedDependencies).toStrictEqual({ '/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0': { dep: 'private' } }) }) test('should remove aliased hoisted dependencies', async () => { @@ -481,8 +481,8 @@ test('hoist when updating in one of the workspace projects', async () => { { const modulesManifest = await rootModules.readModulesManifest() expect(modulesManifest?.hoistedDependencies).toStrictEqual({ - '/@pnpm.e2e/dep-of-pkg-with-1-dep/100.0.0': { '@pnpm.e2e/dep-of-pkg-with-1-dep': 'private' }, - '/@pnpm.e2e/foo/100.0.0': { '@pnpm.e2e/foo': 'private' }, + '/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0': { '@pnpm.e2e/dep-of-pkg-with-1-dep': 'private' }, + '/@pnpm.e2e/foo@100.0.0': { '@pnpm.e2e/foo': 'private' }, }) } @@ -510,7 +510,7 @@ test('hoist when updating in one of the workspace projects', async () => { { const modulesManifest = await rootModules.readModulesManifest() expect(modulesManifest?.hoistedDependencies).toStrictEqual({ - '/@pnpm.e2e/dep-of-pkg-with-1-dep/100.0.0': { '@pnpm.e2e/dep-of-pkg-with-1-dep': 'private' }, + '/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0': { '@pnpm.e2e/dep-of-pkg-with-1-dep': 'private' }, }) } }) diff --git a/pkg-manager/core/test/install/hooks.ts b/pkg-manager/core/test/install/hooks.ts index 2f770f40d02..4ade6564095 100644 --- a/pkg-manager/core/test/install/hooks.ts +++ b/pkg-manager/core/test/install/hooks.ts @@ -1,4 +1,4 @@ -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION } from '@pnpm/constants' +import { LOCKFILE_VERSION } from '@pnpm/constants' import { type Lockfile } from '@pnpm/lockfile-file' import { prepareEmpty } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' diff --git a/pkg-manager/core/test/install/lifecycleScripts.ts b/pkg-manager/core/test/install/lifecycleScripts.ts index 1a3b5f544a7..3caf0ff1c3c 100644 --- a/pkg-manager/core/test/install/lifecycleScripts.ts +++ b/pkg-manager/core/test/install/lifecycleScripts.ts @@ -191,14 +191,14 @@ test("reports child's output", async () => { await addDependenciesToPackage({}, ['@pnpm.e2e/count-to-10'], await testDefaults({ fastUnpack: false, reporter })) expect(reporter.calledWithMatch({ - depPath: '/@pnpm.e2e/count-to-10/1.0.0', + depPath: '/@pnpm.e2e/count-to-10@1.0.0', level: 'debug', name: 'pnpm:lifecycle', script: 'node postinstall', stage: 'postinstall', } as LifecycleLog)).toBeTruthy() expect(reporter.calledWithMatch({ - depPath: '/@pnpm.e2e/count-to-10/1.0.0', + depPath: '/@pnpm.e2e/count-to-10@1.0.0', level: 'debug', line: '1', name: 'pnpm:lifecycle', @@ -206,7 +206,7 @@ test("reports child's output", async () => { stdio: 'stdout', } as LifecycleLog)).toBeTruthy() expect(reporter.calledWithMatch({ - depPath: '/@pnpm.e2e/count-to-10/1.0.0', + depPath: '/@pnpm.e2e/count-to-10@1.0.0', level: 'debug', line: '2', name: 'pnpm:lifecycle', @@ -214,7 +214,7 @@ test("reports child's output", async () => { stdio: 'stdout', } as LifecycleLog)).toBeTruthy() expect(reporter.calledWithMatch({ - depPath: '/@pnpm.e2e/count-to-10/1.0.0', + depPath: '/@pnpm.e2e/count-to-10@1.0.0', level: 'debug', line: '6', name: 'pnpm:lifecycle', @@ -222,7 +222,7 @@ test("reports child's output", async () => { stdio: 'stderr', } as LifecycleLog)).toBeTruthy() expect(reporter.calledWithMatch({ - depPath: '/@pnpm.e2e/count-to-10/1.0.0', + depPath: '/@pnpm.e2e/count-to-10@1.0.0', exitCode: 0, level: 'debug', name: 'pnpm:lifecycle', @@ -240,7 +240,7 @@ test("reports child's close event", async () => { ).rejects.toThrow() expect(reporter.calledWithMatch({ - depPath: '/@pnpm.e2e/failing-postinstall/1.0.0', + depPath: '/@pnpm.e2e/failing-postinstall@1.0.0', exitCode: 1, level: 'debug', name: 'pnpm:lifecycle', diff --git a/pkg-manager/core/test/install/local.ts b/pkg-manager/core/test/install/local.ts index 97fe01d5fed..3e42a7d61e5 100644 --- a/pkg-manager/core/test/install/local.ts +++ b/pkg-manager/core/test/install/local.ts @@ -1,6 +1,6 @@ import fss, { promises as fs } from 'fs' import path from 'path' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION } from '@pnpm/constants' +import { LOCKFILE_VERSION } from '@pnpm/constants' import { type Lockfile } from '@pnpm/lockfile-file' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' diff --git a/pkg-manager/core/test/install/misc.ts b/pkg-manager/core/test/install/misc.ts index 9336f602982..89212591f94 100644 --- a/pkg-manager/core/test/install/misc.ts +++ b/pkg-manager/core/test/install/misc.ts @@ -8,7 +8,7 @@ import { type StageLog, type StatsLog, } from '@pnpm/core-loggers' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION } from '@pnpm/constants' +import { LOCKFILE_VERSION } from '@pnpm/constants' import { fixtures } from '@pnpm/test-fixtures' import { type ProjectManifest } from '@pnpm/types' import { addDistTag, getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' @@ -695,13 +695,13 @@ test('lockfile locks npm dependencies', async () => { expect(reporter.calledWithMatch({ level: 'debug', name: 'pnpm:progress', - packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep/100.0.0`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep@100.0.0`, requester: process.cwd(), status: 'resolved', } as ProgressLog)).toBeTruthy() expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep/100.0.0`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep@100.0.0`, requester: process.cwd(), status: 'fetched', } as ProgressLog)).toBeTruthy() @@ -717,13 +717,13 @@ test('lockfile locks npm dependencies', async () => { expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep/100.0.0`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep@100.0.0`, requester: process.cwd(), status: 'resolved', } as ProgressLog)).toBeTruthy() expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep/100.0.0`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep@100.0.0`, requester: process.cwd(), status: 'found_in_store', } as ProgressLog)).toBeTruthy() diff --git a/pkg-manager/core/test/install/multipleImporters.ts b/pkg-manager/core/test/install/multipleImporters.ts index 294eadce873..d1795e20ab9 100644 --- a/pkg-manager/core/test/install/multipleImporters.ts +++ b/pkg-manager/core/test/install/multipleImporters.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' import { assertProject } from '@pnpm/assert-project' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION } from '@pnpm/constants' +import { LOCKFILE_VERSION } from '@pnpm/constants' import { readCurrentLockfile } from '@pnpm/lockfile-file' import { prepareEmpty, preparePackages } from '@pnpm/prepare' import { addDistTag } from '@pnpm/registry-mock' @@ -659,7 +659,7 @@ test('current lockfile contains only installed dependencies when adding a new im const currentLockfile = await readCurrentLockfile(path.resolve('node_modules/.pnpm'), { ignoreIncompatible: false }) - expect(Object.keys(currentLockfile?.packages ?? {})).toStrictEqual(['/is-negative/1.0.0']) + expect(Object.keys(currentLockfile?.packages ?? {})).toStrictEqual(['/is-negative@1.0.0']) }) test('partial installation in a monorepo does not remove dependencies of other workspace projects', async () => { diff --git a/pkg-manager/core/test/install/optionalDependencies.ts b/pkg-manager/core/test/install/optionalDependencies.ts index 6b91612a534..f93a4ca5ca8 100644 --- a/pkg-manager/core/test/install/optionalDependencies.ts +++ b/pkg-manager/core/test/install/optionalDependencies.ts @@ -89,13 +89,13 @@ test('skip optional dependency that does not support the current OS', async () = const modulesInfo = await readYamlFile<{ skipped: string[] }>(path.join('node_modules', '.modules.yaml')) expect(modulesInfo.skipped).toStrictEqual([ - '/@pnpm.e2e/dep-of-optional-pkg/1.0.0', - '/@pnpm.e2e/not-compatible-with-any-os/1.0.0', + '/@pnpm.e2e/dep-of-optional-pkg@1.0.0', + '/@pnpm.e2e/not-compatible-with-any-os@1.0.0', ]) const logMatcher = sinon.match({ package: { - id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/not-compatible-with-any-os/1.0.0`, + id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/not-compatible-with-any-os@1.0.0`, name: '@pnpm.e2e/not-compatible-with-any-os', version: '1.0.0', }, @@ -112,7 +112,7 @@ test('skip optional dependency that does not support the current OS', async () = { const modules = await project.readModulesManifest() - expect(modules?.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os/1.0.0']) + expect(modules?.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0']) } await rimraf('node_modules') @@ -128,7 +128,7 @@ test('skip optional dependency that does not support the current OS', async () = { const modules = await project.readModulesManifest() - expect(modules?.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os/1.0.0']) + expect(modules?.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0']) } }) @@ -147,7 +147,7 @@ test('skip optional dependency that does not support the current Node version', const logMatcher = sinon.match({ package: { - id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/for-legacy-node/1.0.0`, + id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/for-legacy-node@1.0.0`, name: '@pnpm.e2e/for-legacy-node', version: '1.0.0', }, @@ -176,7 +176,7 @@ test('skip optional dependency that does not support the current pnpm version', const logMatcher = sinon.match({ package: { - id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/for-legacy-pnpm/1.0.0`, + id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/for-legacy-pnpm@1.0.0`, name: '@pnpm.e2e/for-legacy-pnpm', version: '1.0.0', }, @@ -250,7 +250,7 @@ test('optional subdependency is not removed from current lockfile when new depen { const modulesInfo = await readYamlFile<{ skipped: string[] }>(path.join('node_modules', '.modules.yaml')) - expect(modulesInfo.skipped).toStrictEqual(['/@pnpm.e2e/dep-of-optional-pkg/1.0.0', '/@pnpm.e2e/not-compatible-with-any-os/1.0.0']) + expect(modulesInfo.skipped).toStrictEqual(['/@pnpm.e2e/dep-of-optional-pkg@1.0.0', '/@pnpm.e2e/not-compatible-with-any-os@1.0.0']) const currentLockfile = await readYamlFile(path.resolve('node_modules/.pnpm/lock.yaml')) expect(currentLockfile.packages).toHaveProperty(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0']) @@ -278,7 +278,7 @@ test('optional subdependency is skipped', async () => { { const modulesInfo = await readYamlFile<{ skipped: string[] }>(path.join('node_modules', '.modules.yaml')) - expect(modulesInfo.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os/1.0.0']) + expect(modulesInfo.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0']) } expect(await exists('node_modules/.pnpm/@pnpm.e2e+pkg-with-optional@1.0.0')).toBeTruthy() @@ -286,7 +286,7 @@ test('optional subdependency is skipped', async () => { const logMatcher = sinon.match({ package: { - id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/not-compatible-with-any-os/1.0.0`, + id: `localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/not-compatible-with-any-os@1.0.0`, name: '@pnpm.e2e/not-compatible-with-any-os', version: '1.0.0', }, @@ -337,7 +337,7 @@ test('optional subdependency of newly added optional dependency is skipped', asy await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-optional'], await testDefaults({ reporter, targetDependenciesField: 'optionalDependencies' })) const modulesInfo = await readYamlFile<{ skipped: string[] }>(path.join('node_modules', '.modules.yaml')) - expect(modulesInfo.skipped).toStrictEqual(['/@pnpm.e2e/dep-of-optional-pkg/1.0.0', '/@pnpm.e2e/not-compatible-with-any-os/1.0.0']) + expect(modulesInfo.skipped).toStrictEqual(['/@pnpm.e2e/dep-of-optional-pkg@1.0.0', '/@pnpm.e2e/not-compatible-with-any-os@1.0.0']) const lockfile = await project.readLockfile() @@ -521,8 +521,8 @@ test('skip optional dependency that does not support the current OS, when doing const modulesInfo = await readYamlFile<{ skipped: string[] }>(path.join('node_modules', '.modules.yaml')) expect(modulesInfo.skipped).toStrictEqual([ - '/@pnpm.e2e/dep-of-optional-pkg/1.0.0', - '/@pnpm.e2e/not-compatible-with-any-os/1.0.0', + '/@pnpm.e2e/dep-of-optional-pkg@1.0.0', + '/@pnpm.e2e/not-compatible-with-any-os@1.0.0', ]) }) diff --git a/pkg-manager/core/test/install/peerDependencies.ts b/pkg-manager/core/test/install/peerDependencies.ts index 6a2b74fe9ea..e27ee52bec7 100644 --- a/pkg-manager/core/test/install/peerDependencies.ts +++ b/pkg-manager/core/test/install/peerDependencies.ts @@ -551,7 +551,7 @@ test('peer dependencies are linked when running one named installation', async ( const pkgVariation1 = path.join( 'node_modules/.pnpm', - depPathToFilename(`/@pnpm.e2e/abc/1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '1.0.0' }])}`), + depPathToFilename(`/@pnpm.e2e/abc@1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '1.0.0' }])}`), 'node_modules' ) await okFile(path.join(pkgVariation1, '@pnpm.e2e/abc')) @@ -562,7 +562,7 @@ test('peer dependencies are linked when running one named installation', async ( const pkgVariation2 = path.join( 'node_modules/.pnpm', - depPathToFilename(`/@pnpm.e2e/abc/1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '1.0.0' }])}`), + depPathToFilename(`/@pnpm.e2e/abc@1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '1.0.0' }])}`), 'node_modules' ) await okFile(path.join(pkgVariation2, '@pnpm.e2e/abc')) @@ -590,7 +590,7 @@ test('peer dependencies are linked when running two separate named installations const pkgVariation1 = path.join( 'node_modules/.pnpm', - depPathToFilename(`/@pnpm.e2e/abc/1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '1.0.0' }])}`), + depPathToFilename(`/@pnpm.e2e/abc@1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '1.0.0' }])}`), 'node_modules' ) await okFile(path.join(pkgVariation1, '@pnpm.e2e/abc')) @@ -601,7 +601,7 @@ test('peer dependencies are linked when running two separate named installations const pkgVariation2 = path.join( 'node_modules/.pnpm', - depPathToFilename(`/@pnpm.e2e/abc/1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '2.0.0' }])}`), + depPathToFilename(`/@pnpm.e2e/abc@1.0.0${createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-a', version: '1.0.0' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '2.0.0' }])}`), 'node_modules' ) await okFile(path.join(pkgVariation2, '@pnpm.e2e/abc')) @@ -662,7 +662,7 @@ test('peer bins are linked', async () => { await addDependenciesToPackage({}, ['@pnpm.e2e/for-testing-peers-having-bins'], await testDefaults({ fastUnpack: false })) const suffix = createPeersFolderSuffix([{ name: '@pnpm.e2e/peer-with-bin', version: '1.0.0' }]) - const pkgVariation = path.join('.pnpm', depPathToFilename(`/@pnpm.e2e/pkg-with-peer-having-bin/1.0.0${suffix}`), 'node_modules') + const pkgVariation = path.join('.pnpm', depPathToFilename(`/@pnpm.e2e/pkg-with-peer-having-bin@1.0.0${suffix}`), 'node_modules') await project.isExecutable(path.join(pkgVariation, '@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin', 'peer-with-bin')) diff --git a/pkg-manager/core/test/install/reporting.ts b/pkg-manager/core/test/install/reporting.ts index b7c1aa89223..29d9cd77475 100644 --- a/pkg-manager/core/test/install/reporting.ts +++ b/pkg-manager/core/test/install/reporting.ts @@ -17,7 +17,7 @@ test('reports warning when installing deprecated packages', async () => { deprecated: 'express 0.x series is deprecated', level: 'debug', name: 'pnpm:deprecation', - pkgId: `localhost+${REGISTRY_MOCK_PORT}/express/0.14.1`, + pkgId: `localhost+${REGISTRY_MOCK_PORT}/express@0.14.1`, } as DeprecationLog)) const lockfile = await project.readLockfile() diff --git a/pkg-manager/core/test/install/sideEffects.ts b/pkg-manager/core/test/install/sideEffects.ts index 76566ce1f80..b2f647e514c 100644 --- a/pkg-manager/core/test/install/sideEffects.ts +++ b/pkg-manager/core/test/install/sideEffects.ts @@ -86,7 +86,7 @@ test('using side effects cache', async () => { const filesIndexFile = getFilePathInCafs(cafsDir, getIntegrity('@pnpm.e2e/pre-and-postinstall-scripts-example', '1.0.0'), 'index') const filesIndex = await loadJsonFile(filesIndexFile) expect(filesIndex.sideEffects).toBeTruthy() // files index has side effects - const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin/1.0.0': {} })}` + const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin@1.0.0': {} })}` expect(filesIndex.sideEffects).toHaveProperty([sideEffectsKey, 'generated-by-preinstall.js']) expect(filesIndex.sideEffects).toHaveProperty([sideEffectsKey, 'generated-by-postinstall.js']) delete filesIndex.sideEffects![sideEffectsKey]['generated-by-postinstall.js'] @@ -201,7 +201,7 @@ test('a corrupted side-effects cache is ignored', async () => { const filesIndexFile = getFilePathInCafs(cafsDir, getIntegrity('@pnpm.e2e/pre-and-postinstall-scripts-example', '1.0.0'), 'index') const filesIndex = await loadJsonFile(filesIndexFile) expect(filesIndex.sideEffects).toBeTruthy() // files index has side effects - const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin/1.0.0': {} })}` + const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin@1.0.0': {} })}` expect(filesIndex.sideEffects).toHaveProperty([sideEffectsKey, 'generated-by-preinstall.js']) const sideEffectFileStat = filesIndex.sideEffects![sideEffectsKey]['generated-by-preinstall.js'] const sideEffectFile = getFilePathByModeInCafs(cafsDir, sideEffectFileStat.integrity, sideEffectFileStat.mode) diff --git a/pkg-manager/core/test/lockfile.ts b/pkg-manager/core/test/lockfile.ts index 81139721026..c3a993da52a 100644 --- a/pkg-manager/core/test/lockfile.ts +++ b/pkg-manager/core/test/lockfile.ts @@ -1,6 +1,6 @@ import { promises as fs } from 'fs' import path from 'path' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { type RootLog } from '@pnpm/core-loggers' import { type PnpmError } from '@pnpm/error' import { fixtures } from '@pnpm/test-fixtures' diff --git a/pkg-manager/core/test/uninstall.ts b/pkg-manager/core/test/uninstall.ts index b527060bcc8..a41ce3b2193 100644 --- a/pkg-manager/core/test/uninstall.ts +++ b/pkg-manager/core/test/uninstall.ts @@ -1,5 +1,5 @@ import path from 'path' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { type PackageManifestLog, type RootLog, diff --git a/pkg-manager/get-context/src/readLockfiles.ts b/pkg-manager/get-context/src/readLockfiles.ts index 5d7f9d98087..053c147db78 100644 --- a/pkg-manager/get-context/src/readLockfiles.ts +++ b/pkg-manager/get-context/src/readLockfiles.ts @@ -1,6 +1,5 @@ import { LOCKFILE_VERSION, - LOCKFILE_VERSION_V6, WANTED_LOCKFILE, } from '@pnpm/constants' import { @@ -53,12 +52,12 @@ export async function readLockfiles ( wantedLockfileIsModified: boolean lockfileHadConflicts: boolean }> { - const wantedLockfileVersion = LOCKFILE_VERSION_V6 + const wantedLockfileVersion = LOCKFILE_VERSION // ignore `pnpm-lock.yaml` on CI servers // a latest pnpm should not break all the builds const lockfileOpts = { ignoreIncompatible: opts.force || isCI, - wantedVersions: [LOCKFILE_VERSION.toString(), LOCKFILE_VERSION_V6], + wantedVersions: [LOCKFILE_VERSION], useGitBranchLockfile: opts.useGitBranchLockfile, mergeGitBranchLockfiles: opts.mergeGitBranchLockfiles, } diff --git a/pkg-manager/headless/test/index.ts b/pkg-manager/headless/test/index.ts index 8964327951b..6bd198faaa2 100644 --- a/pkg-manager/headless/test/index.ts +++ b/pkg-manager/headless/test/index.ts @@ -73,7 +73,7 @@ test('installing a simple project', async () => { } as StageLog)).toBeTruthy() expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/is-negative@2.1.0`, requester: prefix, status: 'resolved', })).toBeTruthy() @@ -360,7 +360,7 @@ test('run pre/postinstall scripts', async () => { const nmPath = path.join(prefix, 'node_modules') const modulesYaml = await readModulesManifest(nmPath) expect(modulesYaml).toBeTruthy() - expect(modulesYaml!.pendingBuilds).toStrictEqual(['.', '/@pnpm.e2e/pre-and-postinstall-scripts-example/2.0.0']) + expect(modulesYaml!.pendingBuilds).toStrictEqual(['.', '/@pnpm.e2e/pre-and-postinstall-scripts-example@2.0.0']) }) test('orphan packages are removed', async () => { @@ -425,13 +425,13 @@ test('available packages are used when node_modules is not clean', async () => { expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/balanced-match/1.0.2`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/balanced-match@1.0.2`, requester: projectDir, status: 'resolved', })).toBeFalsy() expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/rimraf/2.7.1`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/rimraf@2.7.1`, requester: projectDir, status: 'resolved', })).toBeTruthy() @@ -462,13 +462,13 @@ test('available packages are relinked during forced install', async () => { expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/balanced-match/1.0.2`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/balanced-match@1.0.2`, requester: projectDir, status: 'resolved', })).toBeTruthy() expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/rimraf/2.7.1`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/rimraf@2.7.1`, requester: projectDir, status: 'resolved', })).toBeTruthy() @@ -585,14 +585,14 @@ test('installing with hoistPattern=*', async () => { } as StageLog)) expect(reporter).toBeCalledWith(expect.objectContaining({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/is-negative@2.1.0`, requester: prefix, status: 'resolved', })) const modules = await project.readModulesManifest() - expect(modules!.hoistedDependencies['/balanced-match/1.0.2']).toStrictEqual({ 'balanced-match': 'private' }) + expect(modules!.hoistedDependencies['/balanced-match@1.0.2']).toStrictEqual({ 'balanced-match': 'private' }) }) test('installing with publicHoistPattern=*', async () => { @@ -641,14 +641,14 @@ test('installing with publicHoistPattern=*', async () => { } as StageLog)).toBeTruthy() expect(reporter.calledWithMatch({ level: 'debug', - packageId: `localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0`, + packageId: `localhost+${REGISTRY_MOCK_PORT}/is-negative@2.1.0`, requester: prefix, status: 'resolved', })).toBeTruthy() const modules = await project.readModulesManifest() - expect(modules!.hoistedDependencies['/balanced-match/1.0.2']).toStrictEqual({ 'balanced-match': 'public' }) + expect(modules!.hoistedDependencies['/balanced-match@1.0.2']).toStrictEqual({ 'balanced-match': 'public' }) }) test('installing with publicHoistPattern=* in a project with external lockfile', async () => { @@ -685,7 +685,7 @@ test.each([['isolated'], ['hoisted']])('using side effects cache with nodeLinker const cacheIntegrityPath = getFilePathInCafs(cafsDir, getIntegrity('@pnpm.e2e/pre-and-postinstall-scripts-example', '1.0.0'), 'index') const cacheIntegrity = await loadJsonFile(cacheIntegrityPath) // eslint-disable-line @typescript-eslint/no-explicit-any expect(cacheIntegrity!.sideEffects).toBeTruthy() - const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin/1.0.0': {} })}` + const sideEffectsKey = `${ENGINE_NAME}-${JSON.stringify({ '/@pnpm.e2e/hello-world-js-bin@1.0.0': {} })}` expect(cacheIntegrity).toHaveProperty(['sideEffects', sideEffectsKey, 'generated-by-postinstall.js']) delete cacheIntegrity!.sideEffects[sideEffectsKey]['generated-by-postinstall.js'] diff --git a/pkg-manager/package-requester/test/index.ts b/pkg-manager/package-requester/test/index.ts index 5fc94e8486a..b157f675e05 100644 --- a/pkg-manager/package-requester/test/index.ts +++ b/pkg-manager/package-requester/test/index.ts @@ -54,7 +54,7 @@ test('request package', async () => { expect(pkgResponse).toBeTruthy() expect(pkgResponse.body).toBeTruthy() - expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`) + expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`) expect(pkgResponse.body.resolvedVia).toBe('npm-registry') expect(pkgResponse.body.isLocal).toBe(false) expect(typeof pkgResponse.body.latest).toBe('string') @@ -96,7 +96,7 @@ test('request package but skip fetching', async () => { expect(pkgResponse).toBeTruthy() expect(pkgResponse.body).toBeTruthy() - expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`) + expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`) expect(pkgResponse.body.isLocal).toBe(false) expect(typeof pkgResponse.body.latest).toBe('string') expect(pkgResponse.body.manifest?.name).toBe('is-positive') @@ -148,7 +148,7 @@ test('request package but skip fetching, when resolution is already available', expect(pkgResponse).toBeTruthy() expect(pkgResponse.body).toBeTruthy() - expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`) + expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`) expect(pkgResponse.body.isLocal).toBe(false) expect(typeof pkgResponse.body.latest).toBe('string') expect(pkgResponse.body.manifest.name).toBe('is-positive') @@ -764,7 +764,7 @@ test('do not fetch an optional package that is not installable', async () => { expect(pkgResponse.body).toBeTruthy() expect(pkgResponse.body.isInstallable).toBe(false) - expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/not-compatible-with-any-os/1.0.0`) + expect(pkgResponse.body.id).toBe(`localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/not-compatible-with-any-os@1.0.0`) expect(pkgResponse.fetching).toBeFalsy() }) diff --git a/pkg-manager/plugin-commands-installation/test/dedupe.ts b/pkg-manager/plugin-commands-installation/test/dedupe.ts index abad7b1855b..54f267e3336 100644 --- a/pkg-manager/plugin-commands-installation/test/dedupe.ts +++ b/pkg-manager/plugin-commands-installation/test/dedupe.ts @@ -35,11 +35,11 @@ describe('pnpm dedupe', () => { packageIssuesByDepPath: { added: [], removed: [ - '/ajv/6.10.2', - '/fast-deep-equal/2.0.1', - '/fast-json-stable-stringify/2.0.0', - '/punycode/2.1.1', - '/uri-js/4.2.2', + '/ajv@6.10.2', + '/fast-deep-equal@2.0.1', + '/fast-json-stable-stringify@2.0.0', + '/punycode@2.1.1', + '/uri-js@4.2.2', ], updated: {}, }, @@ -60,10 +60,10 @@ describe('pnpm dedupe', () => { packageIssuesByDepPath: { added: [], removed: [ - '/punycode/2.1.1', + '/punycode@2.1.1', ], updated: { - '/uri-js/4.2.2': { + '/uri-js@4.2.2': { punycode: { next: '2.3.0', prev: '2.1.1', diff --git a/pkg-manager/plugin-commands-installation/test/linkRecursive.ts b/pkg-manager/plugin-commands-installation/test/linkRecursive.ts index 5f2c8631edc..b542606ea55 100644 --- a/pkg-manager/plugin-commands-installation/test/linkRecursive.ts +++ b/pkg-manager/plugin-commands-installation/test/linkRecursive.ts @@ -1,5 +1,5 @@ import path from 'path' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION } from '@pnpm/constants' +import { LOCKFILE_VERSION } from '@pnpm/constants' import { readProjects } from '@pnpm/filter-workspace-packages' import { install, unlink } from '@pnpm/plugin-commands-installation' import { preparePackages } from '@pnpm/prepare' diff --git a/pkg-manager/resolve-dependencies/src/depPathToRef.ts b/pkg-manager/resolve-dependencies/src/depPathToRef.ts index 1fad73c9779..cc278e56ba0 100644 --- a/pkg-manager/resolve-dependencies/src/depPathToRef.ts +++ b/pkg-manager/resolve-dependencies/src/depPathToRef.ts @@ -19,7 +19,7 @@ export function depPathToRef ( depPath = depPath.replace(`${registryName}/`, '/') } if (depPath[0] === '/' && opts.alias === opts.realName) { - const ref = depPath.replace(`/${opts.realName}/`, '') + const ref = depPath.replace(`/${opts.realName}@`, '') if (!ref.includes('/') || !ref.replace(/(\([^)]+\))+$/, '').includes('/')) return ref } return depPath diff --git a/pnpm/test/monorepo/index.ts b/pnpm/test/monorepo/index.ts index af84a089d59..b9f72be998f 100644 --- a/pnpm/test/monorepo/index.ts +++ b/pnpm/test/monorepo/index.ts @@ -1,7 +1,7 @@ // cspell:ignore buildscript import { promises as fs } from 'fs' import path from 'path' -import { LOCKFILE_VERSION_V6 as LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' +import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { findWorkspacePackages } from '@pnpm/workspace.find-packages' import { type LockfileV6 as Lockfile } from '@pnpm/lockfile-types' import { readModulesManifest } from '@pnpm/modules-yaml' diff --git a/resolving/npm-resolver/src/createNpmPkgId.ts b/resolving/npm-resolver/src/createNpmPkgId.ts index 4b7e86136b1..dd1aa00e197 100644 --- a/resolving/npm-resolver/src/createNpmPkgId.ts +++ b/resolving/npm-resolver/src/createNpmPkgId.ts @@ -6,5 +6,5 @@ export function createPkgId ( pkgVersion: string ): string { const escapedRegistryHost = encodeRegistry(registry) - return `${escapedRegistryHost}/${pkgName}/${pkgVersion}` + return `${escapedRegistryHost}/${pkgName}@${pkgVersion}` } diff --git a/resolving/npm-resolver/test/index.ts b/resolving/npm-resolver/test/index.ts index 3e413ef30ec..d44dbbaa360 100644 --- a/resolving/npm-resolver/test/index.ts +++ b/resolving/npm-resolver/test/index.ts @@ -73,7 +73,7 @@ test('resolveFromNpm()', async () => { }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9cI+DmhNhA8ioT/3EJFnt0s1yehnAECyIOXdT+2uQGzcEEBaj8oNmVWj33+ZjPndMIFRQh8JeJlEu1uv5/J7pQ==', @@ -105,7 +105,7 @@ test('resolveFromNpm() should save metadata to a unique file when the package na }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/JSON/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/JSON@1.0.0') // The resolve function does not wait for the package meta cache file to be saved // so we must delay for a bit in order to read it @@ -142,7 +142,7 @@ test('dry run', async () => { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9cI+DmhNhA8ioT/3EJFnt0s1yehnAECyIOXdT+2uQGzcEEBaj8oNmVWj33+ZjPndMIFRQh8JeJlEu1uv5/J7pQ==', @@ -169,7 +169,7 @@ test('resolve to latest when no pref specified', async () => { const resolveResult = await resolveFromNpm({ alias: 'is-positive' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test('resolve to defaultTag when no pref specified', async () => { @@ -184,7 +184,7 @@ test('resolve to defaultTag when no pref specified', async () => { defaultTag: 'stable', registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test('resolve to biggest non-deprecated version that satisfies the range', async () => { @@ -198,7 +198,7 @@ test('resolve to biggest non-deprecated version that satisfies the range', async const resolveResult = await resolveFromNpm({ alias: 'is-positive', pref: '3' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test('resolve to a deprecated version if there are no non-deprecated ones that satisfy the range', async () => { @@ -212,7 +212,7 @@ test('resolve to a deprecated version if there are no non-deprecated ones that s const resolveResult = await resolveFromNpm({ alias: 'is-positive', pref: '2' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/2.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@2.0.0') }) test('can resolve aliased dependency', async () => { @@ -226,7 +226,7 @@ test('can resolve aliased dependency', async () => { const resolveResult = await resolveFromNpm({ alias: 'positive', pref: 'npm:is-positive@1.0.0' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') }) test('can resolve aliased dependency w/o version specifier', async () => { @@ -240,7 +240,7 @@ test('can resolve aliased dependency w/o version specifier', async () => { const resolveResult = await resolveFromNpm({ alias: 'positive', pref: 'npm:is-positive' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test('can resolve aliased dependency w/o version specifier to default tag', async () => { @@ -255,7 +255,7 @@ test('can resolve aliased dependency w/o version specifier to default tag', asyn defaultTag: 'stable', registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test('can resolve aliased scoped dependency', async () => { @@ -269,7 +269,7 @@ test('can resolve aliased scoped dependency', async () => { const resolveResult = await resolveFromNpm({ alias: 'is', pref: 'npm:@sindresorhus/is@0.6.0' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/@sindresorhus/is/0.6.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/@sindresorhus/is@0.6.0') }) test('can resolve aliased scoped dependency w/o version specifier', async () => { @@ -283,7 +283,7 @@ test('can resolve aliased scoped dependency w/o version specifier', async () => const resolveResult = await resolveFromNpm({ alias: 'is', pref: 'npm:@sindresorhus/is' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/@sindresorhus/is/0.7.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/@sindresorhus/is@0.7.0') }) test('can resolve package with version prefixed with v', async () => { @@ -297,7 +297,7 @@ test('can resolve package with version prefixed with v', async () => { const resolveResult = await resolveFromNpm({ alias: 'is-positive', pref: 'v1.0.0' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') }) test('can resolve package version loosely', async () => { @@ -311,7 +311,7 @@ test('can resolve package version loosely', async () => { const resolveResult = await resolveFromNpm({ alias: 'is-positive', pref: '= 1.0.0' }, { registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') }) test("resolves to latest if it's inside the wanted range. Even if there are newer versions available inside the range", async () => { @@ -333,7 +333,7 @@ test("resolves to latest if it's inside the wanted range. Even if there are newe }) // 3.1.0 is available but latest is 3.0.0, so preferring it - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test("resolves to latest if it's inside the preferred range. Even if there are newer versions available inside the preferred range", async () => { @@ -358,7 +358,7 @@ test("resolves to latest if it's inside the preferred range. Even if there are n }) // 3.1.0 is available but latest is 3.0.0, so preferring it - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test("resolve using the wanted range, when it doesn't intersect with the preferred range. Even if the preferred range contains the latest version", async () => { @@ -382,7 +382,7 @@ test("resolve using the wanted range, when it doesn't intersect with the preferr registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test("use the preferred version if it's inside the wanted range", async () => { @@ -407,7 +407,7 @@ test("use the preferred version if it's inside the wanted range", async () => { }) // 3.1.0 is the latest but we prefer the 3.0.0 - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test("ignore the preferred version if it's not inside the wanted range", async () => { @@ -430,7 +430,7 @@ test("ignore the preferred version if it's not inside the wanted range", async ( }, registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test('use the preferred range if it intersects with the wanted range', async () => { @@ -455,7 +455,7 @@ test('use the preferred range if it intersects with the wanted range', async () }) // 1.0.0 is the latest but we prefer a version that is also in the preferred range - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test('use the preferred range if it intersects with the wanted range (an array of preferred versions is passed)', async () => { @@ -483,7 +483,7 @@ test('use the preferred range if it intersects with the wanted range (an array o }) // 1.0.0 is the latest but we prefer a version that is also in the preferred range - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test("ignore the preferred range if it doesn't intersect with the wanted range", async () => { @@ -506,7 +506,7 @@ test("ignore the preferred range if it doesn't intersect with the wanted range", }, registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test("use the preferred dist-tag if it's inside the wanted range", async () => { @@ -532,7 +532,7 @@ test("use the preferred dist-tag if it's inside the wanted range", async () => { }, registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test("ignore the preferred dist-tag if it's not inside the wanted range", async () => { @@ -558,7 +558,7 @@ test("ignore the preferred dist-tag if it's not inside the wanted range", async }, registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') }) test("prefer a version that is both inside the wanted and preferred ranges. Even if it's not the latest of any of them", async () => { @@ -583,7 +583,7 @@ test("prefer a version that is both inside the wanted and preferred ranges. Even }, registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') }) test('prefer the version that is matched by more preferred selectors', async () => { @@ -604,7 +604,7 @@ test('prefer the version that is matched by more preferred selectors', async () registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test('prefer the version that has bigger weight in preferred selectors', async () => { @@ -629,7 +629,7 @@ test('prefer the version that has bigger weight in preferred selectors', async ( registry, }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') }) test('offline resolution fails when package meta not found in the store', async () => { @@ -669,7 +669,7 @@ test('offline resolution succeeds when package meta is found in the store', asyn }) const resolveResult = await resolve({ alias: 'is-positive', pref: '1.0.0' }, { registry }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') } }) @@ -684,7 +684,7 @@ test('prefer offline resolution does not fail when package meta not found in the }) const resolveResult = await resolve({ alias: 'is-positive', pref: '1.0.0' }, { registry }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') }) test('when prefer offline is used, meta from store is used, where latest might be out-of-date', async () => { @@ -720,7 +720,7 @@ test('when prefer offline is used, meta from store is used, where latest might b }) const resolveResult = await resolve({ alias: 'is-positive', pref: '^3.0.0' }, { registry }) - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.0.0') } nock.cleanAll() @@ -914,7 +914,7 @@ test('resolve when tarball URL is requested from the registry', async () => { }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9cI+DmhNhA8ioT/3EJFnt0s1yehnAECyIOXdT+2uQGzcEEBaj8oNmVWj33+ZjPndMIFRQh8JeJlEu1uv5/J7pQ==', @@ -947,7 +947,7 @@ test('resolve when tarball URL is requested from the registry and alias is not s }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9cI+DmhNhA8ioT/3EJFnt0s1yehnAECyIOXdT+2uQGzcEEBaj8oNmVWj33+ZjPndMIFRQh8JeJlEu1uv5/J7pQ==', @@ -1068,7 +1068,7 @@ test('do not resolve from local directory when alwaysTryWorkspacePackages is fal }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9cI+DmhNhA8ioT/3EJFnt0s1yehnAECyIOXdT+2uQGzcEEBaj8oNmVWj33+ZjPndMIFRQh8JeJlEu1uv5/J7pQ==', @@ -1176,7 +1176,7 @@ test('use version from the registry if it is newer than the local one', async () }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9Qa5b+9n69IEuxk4FiNcavXqkixb9lD03BLtdTeu2bbORnLZQrw+pR/exiSg7SoODeu08yxS47mdZa9ddodNwQ==', @@ -1592,7 +1592,7 @@ test("workspace protocol: don't resolve from local package that has a pre-releas }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/2.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@2.0.0') expect(resolveResult!.latest).toBeTruthy() expect(resolveResult!.manifest).toBeTruthy() expect(resolveResult!.manifest!.name).toBe('is-positive') @@ -1699,7 +1699,7 @@ test('resolveFromNpm() should always return the name of the package that is spec }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/3.1.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@3.1.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9Qa5b+9n69IEuxk4FiNcavXqkixb9lD03BLtdTeu2bbORnLZQrw+pR/exiSg7SoODeu08yxS47mdZa9ddodNwQ==', @@ -1736,7 +1736,7 @@ test('request to metadata is retried if the received JSON is broken', async () = registry, })! - expect(resolveResult?.id).toBe('registry1.com/is-positive/1.0.0') + expect(resolveResult?.id).toBe('registry1.com/is-positive@1.0.0') }) test('request to a package with unpublished versions', async () => { @@ -1796,7 +1796,7 @@ test('resolveFromNpm() does not fail if the meta file contains no integrity info }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/2.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@2.0.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: undefined, @@ -1835,7 +1835,7 @@ test('resolveFromNpm() should normalize the registry', async () => { }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('reg.com/is-positive/1.0.0') + expect(resolveResult!.id).toBe('reg.com/is-positive@1.0.0') expect(resolveResult!.latest!.split('.').length).toBe(3) expect(resolveResult!.resolution).toStrictEqual({ integrity: 'sha512-9cI+DmhNhA8ioT/3EJFnt0s1yehnAECyIOXdT+2uQGzcEEBaj8oNmVWj33+ZjPndMIFRQh8JeJlEu1uv5/J7pQ==', @@ -1874,7 +1874,7 @@ test('pick lowest version by * when there are only prerelease versions', async ( }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive/1.0.0-alpha.1') + expect(resolveResult!.id).toBe('registry.npmjs.org/is-positive@1.0.0-alpha.1') expect(resolveResult!.manifest!.name).toBe('is-positive') expect(resolveResult!.manifest!.version).toBe('1.0.0-alpha.1') }) diff --git a/resolving/npm-resolver/test/publishedBy.test.ts b/resolving/npm-resolver/test/publishedBy.test.ts index 492a0057177..8c6d876f122 100644 --- a/resolving/npm-resolver/test/publishedBy.test.ts +++ b/resolving/npm-resolver/test/publishedBy.test.ts @@ -44,7 +44,7 @@ test('fall back to a newer version if there is no version published by the given }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/bad-dates/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/bad-dates@1.0.0') }) test('request metadata when the one in cache does not have a version satisfying the range', async () => { @@ -73,5 +73,5 @@ test('request metadata when the one in cache does not have a version satisfying }) expect(resolveResult!.resolvedVia).toBe('npm-registry') - expect(resolveResult!.id).toBe('registry.npmjs.org/bad-dates/1.0.0') + expect(resolveResult!.id).toBe('registry.npmjs.org/bad-dates@1.0.0') }) diff --git a/reviewing/dependencies-hierarchy/test/index.ts b/reviewing/dependencies-hierarchy/test/index.ts index 873051adf09..0254b4defc8 100644 --- a/reviewing/dependencies-hierarchy/test/index.ts +++ b/reviewing/dependencies-hierarchy/test/index.ts @@ -543,7 +543,7 @@ test('dependency without a package.json', async () => { isPeer: false, isSkipped: false, name: `camelcase#${commit}`, - path: path.join(withNonPackageDepFixture, 'node_modules', '.pnpm', `github.com+${org}+${pkg}@${commit}`, 'node_modules', `camelcase#${commit}`), + path: path.join(withNonPackageDepFixture, 'node_modules', '.pnpm', `github.com+${org}+${pkg}+${commit}`, 'node_modules', `camelcase#${commit}`), resolved: `https://codeload.github.com/${org}/${pkg}/tar.gz/${commit}`, version: '0.0.0', }, diff --git a/reviewing/license-scanner/test/getPkgInfo.spec.ts b/reviewing/license-scanner/test/getPkgInfo.spec.ts index c4b524ad073..9b92e2184d1 100644 --- a/reviewing/license-scanner/test/getPkgInfo.spec.ts +++ b/reviewing/license-scanner/test/getPkgInfo.spec.ts @@ -11,7 +11,7 @@ describe('licences', () => { { name: 'bogus-package', version: '1.0.0', - depPath: '/bogus-package/1.0.0', + depPath: '/bogus-package@1.0.0', snapshot: { resolution: { integrity: 'integrity-sha', @@ -26,6 +26,6 @@ describe('licences', () => { dir: 'workspace-dir', } ) - ).rejects.toThrow('Failed to find package index file for /bogus-package/1.0.0, please consider running \'pnpm install\'') + ).rejects.toThrow('Failed to find package index file for /bogus-package@1.0.0, please consider running \'pnpm install\'') }) }) diff --git a/reviewing/license-scanner/test/licenses.spec.ts b/reviewing/license-scanner/test/licenses.spec.ts index 232c7c2d453..f2a784ca58d 100644 --- a/reviewing/license-scanner/test/licenses.spec.ts +++ b/reviewing/license-scanner/test/licenses.spec.ts @@ -48,12 +48,12 @@ describe('licences', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'bar-integrity', }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { dependencies: { bar: '1.0.0', }, @@ -131,17 +131,17 @@ describe('licences', () => { }, lockfileVersion: LOCKFILE_VERSION, packages: { - '/baz/1.0.0': { + '/baz@1.0.0': { resolution: { integrity: 'baz-integrity', }, }, - '/bar/1.0.0': { + '/bar@1.0.0': { resolution: { integrity: 'bar-integrity', }, }, - '/foo/1.0.0': { + '/foo@1.0.0': { resolution: { integrity: 'foo-integrity', }, diff --git a/reviewing/outdated/test/outdated.spec.ts b/reviewing/outdated/test/outdated.spec.ts index 7725c280c91..a0a3ee55fd2 100644 --- a/reviewing/outdated/test/outdated.spec.ts +++ b/reviewing/outdated/test/outdated.spec.ts @@ -47,13 +47,13 @@ test('outdated()', async () => { }, lockfileVersion: 5, packages: { - '/is-negative/2.1.0': { + '/is-negative@2.1.0': { dev: true, resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: true, resolution: { integrity: 'sha512-xxzPGZ4P2uN6rROUa5N9Z7zTX6ERuE0hs6GUOc/cKBLF2NqKc16UwqHMt3tFg4CO6EBTE5UecUasg+3jZx3Ckg==', @@ -110,12 +110,12 @@ test('outdated()', async () => { }, lockfileVersion: 5, packages: { - '/is-negative/1.1.0': { + '/is-negative@1.1.0': { resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/is-positive/3.1.0': { + '/is-positive@3.1.0': { resolution: { integrity: 'sha512-8ND1j3y9/HP94TOvGzr69/FgbkX2ruOldhLEsTWwcJVfo4oRjwemJmJxt7RJkKYH8tz7vYBP9JcKQY8CLuJ90Q==', }, @@ -202,7 +202,7 @@ test('outdated() should return deprecated package even if its current version is }, lockfileVersion: 5, packages: { - '/deprecated-pkg/1.0.0': { + '/deprecated-pkg@1.0.0': { dev: false, resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', @@ -265,12 +265,12 @@ test('using a matcher', async () => { }, lockfileVersion: 5, packages: { - '/is-negative/2.1.0': { + '/is-negative@2.1.0': { resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha512-xxzPGZ4P2uN6rROUa5N9Z7zTX6ERuE0hs6GUOc/cKBLF2NqKc16UwqHMt3tFg4CO6EBTE5UecUasg+3jZx3Ckg==', }, @@ -317,12 +317,12 @@ test('using a matcher', async () => { }, lockfileVersion: 5, packages: { - '/is-negative/1.1.0': { + '/is-negative@1.1.0': { resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/is-positive/3.1.0': { + '/is-positive@3.1.0': { resolution: { integrity: 'sha512-8ND1j3y9/HP94TOvGzr69/FgbkX2ruOldhLEsTWwcJVfo4oRjwemJmJxt7RJkKYH8tz7vYBP9JcKQY8CLuJ90Q==', }, @@ -371,7 +371,7 @@ test('outdated() aliased dependency', async () => { importers: { '.': { dependencies: { - positive: '/is-positive/1.0.0', + positive: '/is-positive@1.0.0', }, specifiers: { positive: 'npm:is-positive@^1.0.0', @@ -380,7 +380,7 @@ test('outdated() aliased dependency', async () => { }, lockfileVersion: 5, packages: { - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { resolution: { integrity: 'sha512-xxzPGZ4P2uN6rROUa5N9Z7zTX6ERuE0hs6GUOc/cKBLF2NqKc16UwqHMt3tFg4CO6EBTE5UecUasg+3jZx3Ckg==', }, @@ -402,7 +402,7 @@ test('outdated() aliased dependency', async () => { importers: { '.': { dependencies: { - positive: '/is-positive/3.1.0', + positive: '/is-positive@3.1.0', }, specifiers: { positive: 'npm:is-positive@^3.1.0', @@ -411,7 +411,7 @@ test('outdated() aliased dependency', async () => { }, lockfileVersion: 5, packages: { - '/is-positive/3.1.0': { + '/is-positive@3.1.0': { resolution: { integrity: 'sha512-8ND1j3y9/HP94TOvGzr69/FgbkX2ruOldhLEsTWwcJVfo4oRjwemJmJxt7RJkKYH8tz7vYBP9JcKQY8CLuJ90Q==', }, @@ -456,19 +456,19 @@ test('a dependency is not outdated if it is newer than the latest version', asyn }, lockfileVersion: 5, packages: { - '/foo/1.0.0': { + '/foo@1.0.0': { dev: false, resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/foo2/2.0.0-0': { + '/foo2@2.0.0-0': { dev: false, resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/foo3/2.0.0': { + '/foo3@2.0.0': { dev: false, resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', @@ -563,13 +563,13 @@ test('should ignore dependencies as expected', async () => { }, lockfileVersion: 5, packages: { - '/is-negative/2.1.0': { + '/is-negative@2.1.0': { dev: true, resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/is-positive/1.0.0': { + '/is-positive@1.0.0': { dev: true, resolution: { integrity: 'sha512-xxzPGZ4P2uN6rROUa5N9Z7zTX6ERuE0hs6GUOc/cKBLF2NqKc16UwqHMt3tFg4CO6EBTE5UecUasg+3jZx3Ckg==', @@ -626,12 +626,12 @@ test('should ignore dependencies as expected', async () => { }, lockfileVersion: 5, packages: { - '/is-negative/1.1.0': { + '/is-negative@1.1.0': { resolution: { integrity: 'sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=', }, }, - '/is-positive/3.1.0': { + '/is-positive@3.1.0': { resolution: { integrity: 'sha512-8ND1j3y9/HP94TOvGzr69/FgbkX2ruOldhLEsTWwcJVfo4oRjwemJmJxt7RJkKYH8tz7vYBP9JcKQY8CLuJ90Q==', }, diff --git a/store/server/test/index.ts b/store/server/test/index.ts index cd74a9112ca..c98779d3da9 100644 --- a/store/server/test/index.ts +++ b/store/server/test/index.ts @@ -58,7 +58,7 @@ test('server', async () => { const { bundledManifest, files } = await response.fetching!() expect(bundledManifest?.name).toBe('is-positive') - expect(response.body.id).toBe('registry.npmjs.org/is-positive/1.0.0') + expect(response.body.id).toBe('registry.npmjs.org/is-positive@1.0.0') expect(response.body.manifest!.name).toBe('is-positive') expect(response.body.manifest!.version).toBe('1.0.0')