diff --git a/.changeset/green-planets-reflect.md b/.changeset/green-planets-reflect.md new file mode 100644 index 0000000000..513f0480a5 --- /dev/null +++ b/.changeset/green-planets-reflect.md @@ -0,0 +1,6 @@ +--- +'@backstage/frontend-test-utils': patch +'@backstage/frontend-app-api': patch +--- + +Added support for v2 extensions, which declare their inputs and outputs without using a data map. diff --git a/.changeset/rare-foxes-compete.md b/.changeset/rare-foxes-compete.md new file mode 100644 index 0000000000..64dd9b557e --- /dev/null +++ b/.changeset/rare-foxes-compete.md @@ -0,0 +1,57 @@ +--- +'@backstage/frontend-plugin-api': patch +--- + +Extensions have been changed to be declared with an array of inputs and outputs, rather than a map of named data refs. This change was made to reduce confusion around the role of the input and output names, as well as enable more powerful APIs for overriding extensions. + +An extension that was previously declared like this: + +```tsx +const exampleExtension = createExtension({ + name: 'example', + inputs: { + items: createExtensionInput({ + element: coreExtensionData.reactElement, + }), + }, + output: { + element: coreExtensionData.reactElement, + }, + factory({ inputs }) { + return { + element: ( +
+ Example + {inputs.items.map(item => { + return
{item.output.element}
; + })} +
+ ), + }; + }, +}); +``` + +Should be migrated to the following: + +```tsx +const exampleExtension = createExtension({ + name: 'example', + inputs: { + items: createExtensionInput([coreExtensionData.reactElement]), + }, + output: [coreExtensionData.reactElement], + factory({ inputs }) { + return [ + coreExtensionData.reactElement( +
+ Example + {inputs.items.map(item => { + return
{item.get(coreExtensionData.reactElement)}
; + })} +
, + ), + ]; + }, +}); +```