UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

45 lines (43 loc) • 1.31 kB
import { ApiRefSchema, AppDescriptorSchema, AttachmentRefSchema, UiRefSchema } from "./schema.mjs"; import { applyDevOverlay } from "./resolve.mjs"; //#region src/descriptor/constructors.ts /** * The authored App — returns a pure, Zod-validated, serializable descriptor. * Constructors never execute app code (the descriptor IS the deployment plan); * resolution and deployment consume it as data. */ function App(input) { return AppDescriptorSchema.parse(input); } /** The app.api slot. */ function API(input) { return ApiRefSchema.parse(input); } /** The app.ui slot. */ function UI(input) { return UiRefSchema.parse(input); } /** * Attach another App — by local workspace path (`Plugin("auth").path("plugins/auth")`) * or by published module reference (`Plugin("auth").extends("bos://…")`). * The attachment's `name` (the plugin's package name, e.g. * `@everything-dev/auth-plugin`) may differ from the registry key; pass it * through `extra` to override. */ function Plugin(name) { return { path: (dir, extra) => AttachmentRefSchema.parse({ name, ...extra, path: dir }), extends: (ref, extra) => AttachmentRefSchema.parse({ name, ...extra, extends: ref }) }; } //#endregion export { API, App, Plugin, UI, applyDevOverlay }; //# sourceMappingURL=constructors.mjs.map