You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@vltpkg/dep-id

Package Overview
Dependencies
Maintainers
5
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vltpkg/dep-id

create and hydrate dependency IDs

Source
npmnpm
Version
0.0.0-4
Version published
Weekly downloads
48K
-21.87%
Maintainers
5
Weekly downloads
 
Created
Source

dep-id

@vltpkg/dep-id

A library for serializing dependencies into terse string identifiers, and turning those serialized identifiers back into Spec objects.

Usage · Note

Usage

import {
  getId,
  getTuple,
  hydrate,
  hydrateTuple,
  joinDepIDTuple,
  splitDepID,
} from '@vltpkg/dep-id'
import { manifest } from '@vltpkg/package-info'

{
  // default registry
  const spec = Spec.parse('x@latest')
  const mani = await manifest(spec)
  const id = getId(spec, mani) // registry;;x@1.2.3
}

{
  // not default registry
  const spec = Spec.parse('x@vlt:y@latest', {
    registries: { vlt: 'http://vlt.sh' },
  })
  const mani = await manifest(spec)
  const id = getId(spec, mani) // registry;vlt;y@latest
}

{
  // git, hosted
  const spec = Spec.parse('x@github:a/b#branch')
  const mani = await manifest(spec)
  const id = getId(spec, mani) // git;github:a/b;branch
}

// Hydrate by providing a name, and options for the spec creation
const spec = hydrate('git;github:a/b;branch', 'x') // x@github:a/b#branch

Note

multiple different spec/manifest combinations can result in the same identifier. For example, the specifiers x@npm:y@latest and asdf@npm:y@1.x might both ultimately resolve to the same package, so they only need to appear in the store once.

BROWSER API

An isomorphic API @vltpkg/dep-id/browser is provided for use in the browser.

FAQs

Package last updated on 17 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts