@pnpm/catalogs.resolver
Dereferences catalog protocol specifiers into usable specifiers.
Last updated 2 months ago by pnpmuser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @pnpm/catalogs.resolver 
SYNC missed versions from official npm registry.

@pnpm/catalogs.resolver

Dereferences catalog: protocol specifiers into usable specifiers.

Usage

resolveFromCatalog

Dereferences a wanted dependency using the catalog protocol and returns the configured specifier.

Returns one of three resolution result types:

  • found: The catalog entry was found and resolved to a usable specifier.
  • unused: The dependency specifier does not use the catalog: protocol.
  • misconfiguration: The catalog entry is missing, uses recursive catalog definitions, or uses unsupported protocols (link:, file:).
import { resolveFromCatalog } from '@pnpm/catalogs.resolver'

const result = resolveFromCatalog(catalogs, {
  alias: 'react',
  bareSpecifier: 'catalog:',
})

if (result.type === 'found') {
  console.log(result.resolution.specifier) // e.g. '^19.0.0'
}

matchCatalogResolveResult

Utility pattern matcher for handling the three resolution result variants.

import { matchCatalogResolveResult, resolveFromCatalog } from '@pnpm/catalogs.resolver'

const result = resolveFromCatalog(catalogs, wantedDependency)

matchCatalogResolveResult(result, {
  found: ({ resolution }) => console.log('Resolved:', resolution.specifier),
  unused: () => console.log('Not using catalog protocol'),
  misconfiguration: ({ error }) => {
    throw error
  },
})

Current Tags

  • 1100.1.2                                ...           latest (2 months ago)

16 Versions

  • 1100.1.2                                ...           2 months ago
  • 1100.1.1                                ...           2 months ago
  • 1100.1.0                                ...           3 months ago
  • 1100.0.1                                ...           4 months ago
  • 1100.0.0                                ...           8 months ago
  • 1000.0.5                                ...           a year ago
  • 1000.0.4                                ...           a year ago
  • 1000.0.3                                ...           2 years ago
  • 1000.0.2                                ...           2 years ago
  • 1000.0.1                                ...           2 years ago
  • 900.0.1                                ...           2 years ago
  • 1000.0.0                                ...           2 years ago
  • 900.0.0                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (2)
Downloads
Total 33
Today 0
This Week 0
This Month 30
Last Day 0
Last Week 23
Last Month 3
Dependencies (2)
Dev Dependencies (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE