Skip to main content
Version: Next (2.x)

createExtensions()

createExtensions(extensions): Extension<unknown>[]

Creates a collection of Baeta extensions to be used in modules. The result must be exported as default, and the file path registered in baeta.ts. See https://baeta.io/docs/extensions/

Parameters

ParameterTypeDescription

extensions

Extensions

Array of extension factory functions

Returns

Extension<unknown>[]

Array of extension factory functions that can be used by Baeta modules

Example

// auth-extension.ts
export const authExt = authExtension(...);

// cache-extension.ts
export const cacheExt = cacheExtension(...);

// extensions.ts
import { createExtensions } from '@baeta/core';
import { authExt } from './auth-extension.ts';
import { cacheExt } from './cache-extension.ts';

export default createExtensions(authExt, cacheExt);

Remarks

Extensions are executed in the order they are provided.