mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 10:50:38 +09:00
feat(adapters): allow external plugins to override built-in adapters
Previously external adapters matching a built-in type were skipped with a warning. Now they override the built-in, so plugin developers can ship improved versions of existing adapters (e.g. hermes-paperclip-adapter) without removing the built-in fallback for users who haven't installed the plugin.
This commit is contained in:
parent
199a2178cf
commit
2a2fa31a03
2 changed files with 36 additions and 4 deletions
|
|
@ -234,11 +234,11 @@ const externalAdaptersReady: Promise<void> = (async () => {
|
|||
try {
|
||||
const externalAdapters = await buildExternalAdapters();
|
||||
for (const externalAdapter of externalAdapters) {
|
||||
if (BUILTIN_ADAPTER_TYPES.has(externalAdapter.type)) {
|
||||
console.warn(
|
||||
`[paperclip] Skipping external adapter "${externalAdapter.type}" — conflicts with built-in adapter`,
|
||||
const overriding = BUILTIN_ADAPTER_TYPES.has(externalAdapter.type);
|
||||
if (overriding) {
|
||||
console.log(
|
||||
`[paperclip] External adapter \"${externalAdapter.type}\" overrides built-in adapter`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
adaptersByType.set(
|
||||
externalAdapter.type,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue