import { throwError } from '../__internal' ; type pluginType = 'internal' | 'third' ; export const plugins = [ ] ; const usedKeys = [ 'state' , 'computed' , 'effects' , 'update' , ] ; export function registerPlugin ( key , fn , type = 'third' ) { if ( usedKeys . indexOf ( key ) !== - 1 ) { throwError ( `cannot register plugin with reserved key (${ key })` ) ; } if ( plugins . filter ( ( item ) => item . key === key ) . length > 0 ) { throwError ( `cannot register duplicate plugin (${ key })` ) ; } plugins . push ( { key , type , fn , } ) ; }