everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
49 lines (47 loc) • 1.42 kB
JavaScript
const require_schema = require('./schema.cjs');
const require_resolve = require('./resolve.cjs');
//#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 require_schema.AppDescriptorSchema.parse(input);
}
/** The app.api slot. */
function API(input) {
return require_schema.ApiRefSchema.parse(input);
}
/** The app.ui slot. */
function UI(input) {
return require_schema.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) => require_schema.AttachmentRefSchema.parse({
name,
...extra,
path: dir
}),
extends: (ref, extra) => require_schema.AttachmentRefSchema.parse({
name,
...extra,
extends: ref
})
};
}
//#endregion
exports.API = API;
exports.App = App;
exports.Plugin = Plugin;
exports.UI = UI;
exports.applyDevOverlay = require_resolve.applyDevOverlay;
//# sourceMappingURL=constructors.cjs.map