import { fileURLToPath } from 'node:url' import { defineDevframe } from 'devframe' import pkg from '../../package.json' with { type: 'json' } import { NAMESPACE, serverFunctions } from './rpc/index.ts' export type { EnvEntry, EnvSnapshot } from './rpc/functions/env.ts' export type { MemorySnapshot } from './rpc/functions/memory.ts' export type { SystemInfo } from './rpc/functions/system.ts' const BASE_PATH = '/__next-runtime-snapshot/' const distDir = fileURLToPath(new URL('../../dist/client', import.meta.url)) export default defineDevframe({ id: 'example:next-runtime-snapshot', name: 'Next Runtime Snapshot', version: pkg.version, packageName: pkg.name, importMetaUrl: import.meta.url, homepage: pkg.homepage, description: pkg.description, icon: 'ph:gauge-duotone', basePath: BASE_PATH, clientAssets: distDir, cli: { command: 'next-runtime-snapshot', port: 9899, auth: false, }, setup(ctx) { // A scoped context auto-namespaces every registered id with `NAMESPACE:`. const my = ctx.scope(NAMESPACE) for (const fn of serverFunctions) my.rpc.register(fn) }, })