storipress/karbon

View on GitHub
packages/karbon/src/runtime/article/utils/editor-blocks.ts

Summary

Maintainability
A
1 hr
Test Coverage
import { mapKeys, mapValues, pipe } from 'remeda'
import { snakeCase } from 'scule'
import { basename } from 'pathe'

export const editorBlocks = pipe(
  import.meta.glob('~~/templates/editor-blocks/*.vue', { eager: true }),
  mapKeys((name) => snakeCase(basename(name, '.vue'))),
  mapValues((mod) => (mod as any).default),
)