vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
  • USAGE
  • Behavior
  • Result
  • Modules
  1. Client
  2. /
  3. API Reference
  4. /
  5. _media
  6. /
  7. @vltpkg/graph.reify

@vltpkg/graph.reify

@vltpkg/graph.reify

Apply graph changes to node_modules, transforming the actual state to match the ideal graph.

USAGE

TypeScript
import { reify } from '@vltpkg/graph'
import { PackageInfoClient } from '@vltpkg/package-info'
import { PackageJson } from '@vltpkg/package-json'
import { RollbackRemove } from '@vltpkg/rollback-remove'
import { PathScurry } from 'path-scurry'

const { diff, buildQueue } = await reify({
  graph, // Ideal graph to apply
  projectRoot: '/path/to/project',
  packageInfo: new PackageInfoClient({ cache }),
  packageJson: new PackageJson(),
  scurry: new PathScurry(projectRoot),
  remover: new RollbackRemove(),
  allowScripts: '*', // DSS query for packages allowed to run scripts
  // Optional
  actual, // Pre-loaded actual graph
  add, // AddImportersDependenciesMap
  remove, // RemoveImportersDependenciesMap
})

Behavior

  1. Computes Diff(actual, ideal) — returns early if no changes
  2. Extracts new nodes to .vlt store (parallel)
  3. Deletes outdated edges and their bin links
  4. Creates symlinks for new edges + bin links
  5. Hoists internal links to node_modules/.vlt/node_modules/
  6. Runs lifecycle scripts (install, prepare) on allowed nodes
  7. Saves lockfiles (vlt-lock.json + hidden)
  8. Updates package.json if add/remove modified dependencies
  9. Cleans up deleted nodes from store

Result

TypeScript
type ReifyResult = {
  diff: Diff
  buildQueue?: DepID[] // Nodes that needed building
}

Modules

FilePurpose
index.tsOrchestrates reify process
add-nodes.tsExtract packages to store
add-edge.tsCreate symlinks + bin links
delete-edge.tsRemove symlinks + bin links
internal-hoist.tsHoist preferred versions
build.tsRun lifecycle scripts
rollback.tsRevert on failure
optional-fail.tsHandle optional dep failures
update-importers-package-json.tsUpdate package.json files

On this page

  • USAGE
  • Behavior
  • Result
  • Modules

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now