feat: add hot-pluggable language shell UI system
This commit is contained in:
parent
621b714449
commit
43578222c2
15 changed files with 592 additions and 5 deletions
|
|
@ -0,0 +1,25 @@
|
|||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { validateUiPlugin, type HoloLakeUiPlugin } from './uiPluginSystem'
|
||||
|
||||
type Registry = {
|
||||
schema: string
|
||||
plugins: Array<{ id: string; version: string; path: string }>
|
||||
}
|
||||
|
||||
describe('registered UI plugins', () => {
|
||||
it('resolve to valid packages with matching immutable identities', () => {
|
||||
const root = resolve(process.cwd(), 'ui-plugins')
|
||||
const registry = JSON.parse(readFileSync(resolve(root, 'registry.json'), 'utf8')) as Registry
|
||||
expect(registry.schema).toBe('hololake.ui-plugin-registry/v1')
|
||||
expect(registry.plugins.length).toBeGreaterThan(0)
|
||||
|
||||
for (const entry of registry.plugins) {
|
||||
const plugin = JSON.parse(readFileSync(resolve(root, entry.path), 'utf8')) as HoloLakeUiPlugin
|
||||
expect(plugin.manifest.id).toBe(entry.id)
|
||||
expect(plugin.manifest.version).toBe(entry.version)
|
||||
expect(validateUiPlugin(plugin)).toEqual({ ok: true, errors: [] })
|
||||
}
|
||||
})
|
||||
})
|
||||
Loading…
Reference in a new issue