everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
47 lines (45 loc) • 1.94 kB
JavaScript
import { chainHeadPinLagNotice } from "../services/platform/manifest.mjs";
import { ResolutionSessionService } from "../services/resolution/session.mjs";
import { DevFlowService } from "../services/dev/flow.mjs";
import { auditSessionPlane } from "../services/resolution/plane-audit.mjs";
import { Effect } from "effect";
//#region src/handlers/dev.ts
const renderAuditLines = (lines) => {
const divergences = lines.filter((line) => line.kind !== "uncomposed");
const notes = lines.filter((line) => line.kind === "uncomposed");
if (divergences.length > 0) {
console.log(`\n ${divergences.length} release-plane divergence(s) in the composition:`);
for (const line of divergences) console.log(` - ${line.message}`);
console.log("\n The runtime survived on its pinned bytes — realign before shipping.\n");
}
if (notes.length > 0) {
console.log(`\n ${notes.length} pinned-release slot(s) this config does not compose (informational):`);
for (const line of notes) console.log(` - ${line.message}`);
console.log("");
}
};
function registerDev(builder) {
return {
dev: builder.dev.effect(function* (_opts, input) {
const session = yield* ResolutionSessionService;
const result = yield* (yield* DevFlowService).dev(session, input);
if (result.status === "started" && session) {
const notice = chainHeadPinLagNotice(session.releaseManifest?.frameworkVersion, session.rawConfig?.platform);
if (notice) console.log(`\n ${notice}\n`);
const audit = yield* Effect.tryPromise({
try: () => auditSessionPlane(session),
catch: () => void 0
});
if (audit && audit.length > 0) renderAuditLines(audit);
}
return result;
}),
start: builder.start.effect(function* (_opts, input) {
const session = yield* ResolutionSessionService;
return yield* (yield* DevFlowService).start(session, input);
})
};
}
//#endregion
export { registerDev };
//# sourceMappingURL=dev.mjs.map