UNPKG

everything-dev

Version:

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

1 lines • 5.88 kB
{"version":3,"file":"platform-deploy.cjs","names":["CORE_UI_DEPLOY_FIELDS"],"sources":["../src/platform-deploy.ts"],"sourcesContent":["import { CORE_UI_DEPLOY_FIELDS } from \"every-plugin/build/ui\";\nimport type { DeployResultEntry } from \"./integrity\";\n\n/**\n * Image-native deploy entries (plan 043): the runtime image serves its own\n * staged artifacts at its own origin — the publish writes the deterministic\n * URLs, nothing is uploaded. Integrity is omitted: the published URL carries\n * the bytes' identity via the image build itself.\n */\nexport function platformUrlDeployEntries(input: {\n origin: string;\n account: string;\n gateway: string;\n key: string;\n kind: \"app\" | \"plugin\";\n integrity?: string;\n ssrIntegrity?: string;\n /** the workspace's uploaded version manifest: filename (relative to the\n * bundle base) + its own SRI — written as the slot's `pin` */\n pin?: { file: string; integrity: string };\n}): DeployResultEntry[] {\n const { origin, account, gateway, key, kind, integrity, ssrIntegrity, pin } = input;\n const slot = kind === \"app\" ? \"app\" : \"plugins\";\n const base = `${origin.replace(/\\/$/, \"\")}/bundles/${account}/${gateway}/${key}/`;\n const entries: DeployResultEntry[] = [\n {\n url: base,\n ...(pin\n ? {\n value: pin.file,\n valueField: `${slot}.${key}.pin.manifest`,\n integrity: pin.integrity,\n integrityField: `${slot}.${key}.pin.integrity`,\n // the pinned slot's identity is the pin — a stale direct entry\n // SRI or retired flat manifest pointer must not linger\n removeFields: [`${slot}.${key}.integrity`, `${slot}.${key}.manifest`],\n }\n : {\n integrity,\n integrityField: `${slot}.${key}.integrity`,\n removeFields: [`${slot}.${key}.manifest`],\n }),\n urlField: `${slot}.${key}.production`,\n },\n ];\n\n if (kind === \"app\" && key === \"ui\") {\n entries.push({\n url: `${base}ssr/`,\n integrity: ssrIntegrity,\n urlField: CORE_UI_DEPLOY_FIELDS.ssrUrlField ?? \"\",\n integrityField: CORE_UI_DEPLOY_FIELDS.ssrIntegrityField ?? \"\",\n });\n }\n\n return entries;\n}\n\n/**\n * Folder-form plugin ui deploy entries: the plugin's ui surface builds to\n * `<plugin>/ui/dist` (web remoteEntry + ssr container) and uploads as its own\n * bundle key (`<key>-ui`), pinning `<slot>.<key>.ui.*` in bos.config.json.\n * Without these entries a deployed plugin ui resolves with no production URL\n * and the host cannot compose (or even address) its routes.\n */\nexport function pluginUiUrlDeployEntries(input: {\n origin: string;\n account: string;\n gateway: string;\n key: string;\n kind: \"app\" | \"plugin\";\n integrity?: string;\n ssrIntegrity?: string;\n /** the uploaded version manifest: filename + its own SRI — written as the\n * ui slot's `pin` */\n pin?: { file: string; integrity: string };\n /** The built MF container name — remote boots need it pinned in the config. */\n name?: string;\n}): DeployResultEntry[] {\n const { origin, account, gateway, key, kind, integrity, ssrIntegrity, pin, name } = input;\n const slot = kind === \"app\" ? \"app\" : \"plugins\";\n const base = `${origin.replace(/\\/$/, \"\")}/bundles/${account}/${gateway}/${key}-ui/`;\n const entries: DeployResultEntry[] = [\n {\n url: base,\n ...(pin\n ? {\n value: pin.file,\n valueField: `${slot}.${key}.ui.pin.manifest`,\n integrity: pin.integrity,\n integrityField: `${slot}.${key}.ui.pin.integrity`,\n removeFields: [`${slot}.${key}.ui.integrity`, `${slot}.${key}.ui.manifest`],\n }\n : {\n integrity,\n integrityField: `${slot}.${key}.ui.integrity`,\n removeFields: [`${slot}.${key}.ui.manifest`],\n }),\n urlField: `${slot}.${key}.ui.production`,\n },\n ];\n if (name) {\n entries.push({\n url: base,\n urlField: `${slot}.${key}.ui.production`,\n value: name,\n valueField: `${slot}.${key}.ui.name`,\n });\n }\n entries.push({\n url: `${base}ssr/`,\n integrity: ssrIntegrity,\n urlField: `${slot}.${key}.ui.ssr`,\n integrityField: `${slot}.${key}.ui.ssrIntegrity`,\n });\n return entries;\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,yBAAyB,OAWjB;CACtB,MAAM,EAAE,QAAQ,SAAS,SAAS,KAAK,MAAM,WAAW,cAAc,QAAQ;CAC9E,MAAM,OAAO,S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