Add per-endpoint NPM discovery adapters

This commit is contained in:
Lyncoln
2026-09-19 17:02:51 -04:00
parent 79342590ba
commit da53a9f1e1
4 changed files with 306 additions and 2 deletions
+6 -2
View File
@@ -1,7 +1,7 @@
import importlib
def _load(kind: str, name: str, config):
def _load(kind: str, name: str, config, *args):
if not name or not name.replace("_", "").replace("-", "").isalnum():
raise RuntimeError(f"Invalid {kind} plugin name: {name!r}")
@@ -19,7 +19,7 @@ def _load(kind: str, name: str, config):
if plugin_class is None:
raise RuntimeError(f"Plugin module {path} does not export Plugin")
return plugin_class(config)
return plugin_class(config, *args)
def load_source(name: str, config):
@@ -28,3 +28,7 @@ def load_source(name: str, config):
def load_provider(name: str, config):
return _load("providers", name, config)
def load_adapter(name: str, config, endpoint):
return _load("adapters", name, config, endpoint)