mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-25 18:41:48 -04:00
The > symbol is used to delimit package IDs in the Node ID. The % and > symbols are encoded in package IDs. ref https://github.com/pnpm/pnpm/issues/986
9 lines
382 B
TypeScript
9 lines
382 B
TypeScript
import replaceString = require('replace-string')
|
|
|
|
// The only reason package IDs are encoded is to avoid '>' signs.
|
|
// Otherwise, it would be impossible to split the node ID back to package IDs reliably.
|
|
// See issue https://github.com/pnpm/pnpm/issues/986
|
|
export default function encodePkgId (pkgId: string) {
|
|
return replaceString(replaceString(pkgId, '%', '%25'), '>', '%3E')
|
|
}
|