New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@universal-packages/adapter-resolver

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@universal-packages/adapter-resolver - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"name": "@universal-packages/adapter-resolver",
"version": "1.0.0",
"version": "1.1.0",
"description": "Module loader based on adapter parameters.",

@@ -5,0 +5,0 @@ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)",

@@ -37,4 +37,15 @@ # Adapter Resolver

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.
```js
import { resolveAdapter } from '@universal-packages/adapter-resolver'
const adapter = await resolveAdapter('local', { internal: { local: LocalAdapter } })
console.log(adapter)
// > [class LocalAdapter]
```
- **`type`** `String`
To help infer the export name, for example ff 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.
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.

@@ -41,0 +52,0 @@ ## Typescript

import { ResolveAdapterOptions } from './types';
export declare function resolveAdapter<P = any>(name: string, options?: ResolveAdapterOptions): Promise<P>;
export declare function resolveAdapter<A = any>(name: string, options?: ResolveAdapterOptions<A>): Promise<A>;

@@ -30,2 +30,6 @@ "use strict";

async function resolveAdapter(name, options) {
if (options?.internal) {
if (options.internal[name])
return options.internal[name];
}
const packageJson = (0, package_json_1.readPackageJson)();

@@ -32,0 +36,0 @@ const dependencyNames = Object.keys({ ...packageJson.dependencies, ...packageJson.devDependencies });

@@ -1,4 +0,5 @@

export interface ResolveAdapterOptions {
export interface ResolveAdapterOptions<A = any> {
domain?: string;
internal?: Record<string, A>;
type?: string;
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc