sigildocs

(sigil deps redirects)

(sigil deps redirects) - Dependency Redirects

Allows redirecting dependencies during development, enabling work on libraries while building apps that depend on them.

Usage: Load redirects from a file via SIGILREDIRECTS env var: SIGILREDIRECTS=./my-redirects.sgl sigil build

Or via --redirects flag: sigil build --redirects ./my-redirects.sgl

Redirects file format: (redirects repos: (list (for-repo url: "https://github.com/user/repo" use: (from-path dir: "/local/path"))) packages: (list (for-package name: "pkg-name" use: (from-path dir: "/local/path"))))

Exports

redirectsprocedure

Container for all dependency redirects.

(redirects
  repos: (list ...)
  packages: (list ...))
redirects?procedure

Test if a value is a redirects struct.

List of for-repo entries for URL-based redirection.

List of for-package entries for package-name-based redirection.

List of for-package entries for package-name-based redirection.

for-repoprocedure

Redirect all packages from a repository URL to a different dep spec.

(for-repo
  url: "https://github.com/user/repo"
  use: (from-path dir: "/home/user/Projects/repo"))
for-repo?procedure

Test if a value is a for-repo struct.

for-repo-urlprocedure

Source URL to match (exact match after normalization).

for-repo-useprocedure

Replacement dep spec (from-path or from-git).

Replacement dep spec (from-path or from-git).

for-packageprocedure

Redirect a package by name to a different dep spec.

(for-package
  name: "sigil-json"
  use: (from-path dir: "/local/path"))
for-package?procedure

Test if a value is a for-package struct.

Package name to match.

Replacement dep spec (from-path or from-git).

normalize-urlprocedure

Normalize a URL for comparison. Strips #ref suffix, trailing slashes, and .git suffix.

find-for-repoprocedure

Find a for-repo redirect matching the given URL. Returns the for-repo struct or #f if not found.

Find a for-package redirect matching the given package name. Returns the for-package struct or #f if not found.

Apply redirects to a dependency. Returns a new dep spec if redirected, or the original dep if not.

Precedence:

  1. for-package (match by name) - highest priority
  2. for-repo (match by URL) - for from-git deps only
  3. Original dep - no redirect

Apply a for-repo redirect to a from-git dependency. Preserves subpath/package from the original dep when not overridden.

dep-nameprocedure

Get the package name from a dependency. Works for from-git, from-path, and from-workspace deps.

Load and validate a redirects file. Returns <redirects> or raises an error if invalid.

Read all expressions from a port

Get active redirects from environment or CLI option. Returns a redirects struct or #f if none configured.