UNPKG

everything-dev

Version:

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

1 lines • 3.56 kB
{"version":3,"file":"composition-audit.cjs","names":["auditReleaseComposition","collectRemoteDescriptors","authoredRemoteKeys","readInstalledFrameworkVersion","findWorkspaceRoot"],"sources":["../../../src/services/resolution/composition-audit.ts"],"sourcesContent":["import type { BosConfigInput } from \"../../types\";\nimport { collectRemoteDescriptors } from \"../deploy/rollback\";\nimport { readInstalledFrameworkVersion } from \"../framework-version\";\nimport { walkRemotes } from \"../remotes\";\nimport { findWorkspaceRoot } from \"../workspace/workspace\";\nimport {\n auditReleaseComposition,\n authoredRemoteKeys,\n type CompositionAuditLine,\n} from \"./release-composition\";\nimport type { ResolutionSession } from \"./session\";\n\n/**\n * The one dev-boot chain-audit adapter: every consumer that audits a\n * resolution session's release plane (`bos dev`'s post-boot report, the\n * upgrade's owned-remote realignment) derives its inputs from here, so the\n * audit cannot fork into silently divergent copies.\n */\nexport {\n auditReleaseComposition,\n authoredRemoteKeys,\n type CompositionAuditLine,\n} from \"./release-composition\";\n\nexport const auditSessionComposition = (\n session: NonNullable<ResolutionSession>,\n options?: { fetchImpl?: typeof fetch },\n): Promise<CompositionAuditLine[]> =>\n auditReleaseComposition({\n remotes: collectRemoteDescriptors((session.config ?? {}) as BosConfigInput),\n authoredPaths: authoredRemoteKeys((session.rawConfig ?? {}) as Record<string, unknown>),\n localVersionOf: (name) =>\n readInstalledFrameworkVersion(findWorkspaceRoot(session.root)?.dir ?? session.root, name),\n provisionedRemotes: session.releaseComposition?.omitted,\n configRemotePaths: configRemotePathsOf(session.config),\n manifestRemotePaths: Object.keys(session.releaseManifest?.remotes ?? {}),\n pinnedReleaseVersion: session.releaseManifest?.frameworkVersion,\n ...(options?.fetchImpl ? { fetchImpl: options.fetchImpl } : {}),\n });\n\nconst configRemotePathsOf = (config: unknown): string[] => {\n if (!config || typeof config !== \"object\") return [];\n const paths: string[] = [];\n walkRemotes(config as Record<string, unknown>, ({ remote, entry }) => {\n // call-only attachments (proxy + contract, no composed source) compose\n // no federation remote, so the \"served by the extends chain but missing\n // from the release composition\" line is meaningless for them (their\n // types locator points at the provider's release; their traffic endpoint\n // is authored proxy).\n if (\n remote.startsWith(\"plugins.\") &&\n !remote.endsWith(\".ui\") &&\n typeof entry === \"object\" &&\n entry !== null &&\n (entry as { contract?: unknown }).contract !== undefined\n ) {\n return;\n }\n paths.push(remote);\n });\n return paths;\n};\n"],"mappings":";;;;;;;AAwBA,MAAa,2BACX,SACA,YAEAA,oDAAwB;CACtB,SAASC,uCAA0B,QAAQ,UAAU,CAAC,CAAoB;CAC1E,eAAeC,+CAAoB,QAAQ,aAAa,CAAC,CAA6B;CACtF,iBAAiB,SACfC,wDAA8BC,oCAAkB,QAAQ,IAAI,CAAC,EAAE,OAAO,QAAQ,MAAM,IAAI;CAC1F,oBAAoB,QAAQ,oBAAoB;CAChD,mBAAmB,oBAAoB,QAAQ,MAAM;CACrD,qBAAqB,OAAO,KAAK,QAAQ,iBAAiB,WAAW,CAAC,CAAC;CACvE,sBAAsB,QAAQ,iBAAiB;CAC/C,GAAI,SAAS,YAAY,EAAE,WAAW,QAAQ,UAAU,IAAI,CAAC;AAC/D,CAAC;AAEH,MAAM,uBAAuB,WAA8B;CACzD,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO,CAAC;CACnD,MAAM,QAAkB,CAAC;CACzB,4BAAY,SAAoC,EAAE,QAAQ,YAAY;EAMpE,IACE,OAAO,WAAW,UAAU,KAC5B,CAAC,OAAO,SAAS,KAAK,KACtB,OAAO,UAAU,YACjB,UAAU,QACT,MAAiC,aAAa,QAE/C;EAEF,MAAM,KAAK,MAAM;CACnB,CAAC;CACD,OAAO;AACT"}