Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@universal-packages/adapter-resolver
Advanced tools
Module loader based on adapter parameters.
npm install @universal-packages/adapter-resolver
resolveAdapter(name: string, [options])
Tries to infer an installed module name based on name and options, imports it and infers the desired export based on name and options.
import { resolveAdapter } from '@universal-packages/adapter-resolver'
const adapter = resolveAdapter('redis', { domain: 'token-registry', type: 'engine' })
console.log(adapter)
// > [class RedisEngine]
Options are meant for inferring the matching adapter so the parent library can have a single simple adapter name requirement instead of the whole path of library and export.
domain
String
To help infer the module name for example if the adapter is redis
and is meant to work with @universal-packages/token-registry
you can just provide here token-registry
.internal
Object
An object which keys match an internal adapter provided by the root library.
import { resolveAdapter } from '@universal-packages/adapter-resolver'
const adapter = resolveAdapter('local', { internal: { local: LocalAdapter } })
console.log(adapter)
// > [class LocalAdapter]
type
String
To help infer the export name, for example if the adapter is an "engine", you can provide here engine
and it will internally will come up with different case variations to try to find the export ex: redisEngine, RedisEngine, redis_engine.This library is developed in TypeScript and shipped fully typed.
The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.
FAQs
Module loader based on adapter parameters.
The npm package @universal-packages/adapter-resolver receives a total of 10,702 weekly downloads. As such, @universal-packages/adapter-resolver popularity was classified as popular.
We found that @universal-packages/adapter-resolver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.