everything-dev 2.0.0-rc.6 → 2.0.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/api/auth-middleware.cjs +14 -1
- package/dist/api/auth-middleware.cjs.map +1 -1
- package/dist/api/auth-middleware.d.cts +9 -0
- package/dist/api/auth-middleware.d.mts +9 -0
- package/dist/api/auth-middleware.mjs +14 -1
- package/dist/api/auth-middleware.mjs.map +1 -1
- package/dist/build.cjs +1 -1
- package/dist/build.mjs +1 -1
- package/dist/bundle-cache.cjs +1 -1
- package/dist/bundle-cache.cjs.map +1 -1
- package/dist/bundle-cache.mjs +1 -1
- package/dist/bundle-cache.mjs.map +1 -1
- package/dist/cli/init.cjs +22 -10
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.mjs +22 -10
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli.cjs +6 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +5 -4
- package/dist/cli.mjs.map +1 -1
- package/dist/commands/deploy.cjs +111 -1
- package/dist/commands/deploy.cjs.map +1 -1
- package/dist/commands/deploy.mjs +112 -2
- package/dist/commands/deploy.mjs.map +1 -1
- package/dist/commands/keys.cjs +1 -1
- package/dist/commands/keys.cjs.map +1 -1
- package/dist/commands/keys.mjs +1 -1
- package/dist/commands/keys.mjs.map +1 -1
- package/dist/commands/smoke.cjs +41 -0
- package/dist/commands/smoke.cjs.map +1 -0
- package/dist/commands/smoke.mjs +41 -0
- package/dist/commands/smoke.mjs.map +1 -0
- package/dist/commands/upgrade.cjs +2 -2
- package/dist/commands/upgrade.cjs.map +1 -1
- package/dist/commands/upgrade.mjs +1 -1
- package/dist/commands/upgrade.mjs.map +1 -1
- package/dist/contract.cjs +27 -1
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +65 -1
- package/dist/contract.d.mts +65 -1
- package/dist/contract.meta.cjs +14 -2
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +24 -2
- package/dist/contract.meta.d.mts +24 -2
- package/dist/contract.meta.mjs +14 -2
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +26 -2
- package/dist/contract.mjs.map +1 -1
- package/dist/db/core.cjs +22 -4
- package/dist/db/core.cjs.map +1 -1
- package/dist/db/core.mjs +22 -4
- package/dist/db/core.mjs.map +1 -1
- package/dist/dev-log-pipeline.cjs +6 -0
- package/dist/dev-log-pipeline.cjs.map +1 -1
- package/dist/dev-log-pipeline.mjs +6 -0
- package/dist/dev-log-pipeline.mjs.map +1 -1
- package/dist/dev-program.cjs +20 -3
- package/dist/dev-program.cjs.map +1 -1
- package/dist/dev-program.mjs +20 -4
- package/dist/dev-program.mjs.map +1 -1
- package/dist/dev-session.cjs +1 -0
- package/dist/dev-session.cjs.map +1 -1
- package/dist/dev-session.mjs +1 -0
- package/dist/dev-session.mjs.map +1 -1
- package/dist/fastkv.cjs +21 -3
- package/dist/fastkv.cjs.map +1 -1
- package/dist/fastkv.d.cts +14 -1
- package/dist/fastkv.d.mts +14 -1
- package/dist/fastkv.mjs +21 -5
- package/dist/fastkv.mjs.map +1 -1
- package/dist/{mf.cjs → federation.cjs} +6 -13
- package/dist/federation.cjs.map +1 -0
- package/dist/{mf.d.cts → federation.d.cts} +2 -2
- package/dist/{mf.d.mts → federation.d.mts} +2 -2
- package/dist/{mf.mjs → federation.mjs} +6 -13
- package/dist/federation.mjs.map +1 -0
- package/dist/http-client.cjs +84 -57
- package/dist/http-client.cjs.map +1 -1
- package/dist/http-client.mjs +84 -58
- package/dist/http-client.mjs.map +1 -1
- package/dist/image-deploy.cjs +9 -0
- package/dist/image-deploy.cjs.map +1 -1
- package/dist/image-deploy.mjs +9 -1
- package/dist/image-deploy.mjs.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/infra/planner.cjs +6 -2
- package/dist/infra/planner.cjs.map +1 -1
- package/dist/infra/planner.mjs +6 -2
- package/dist/infra/planner.mjs.map +1 -1
- package/dist/orchestrator.cjs +39 -35
- package/dist/orchestrator.cjs.map +1 -1
- package/dist/orchestrator.mjs +39 -35
- package/dist/orchestrator.mjs.map +1 -1
- package/dist/plugin.cjs +2 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +24 -0
- package/dist/plugin.d.mts +24 -0
- package/dist/plugin.mjs +2 -0
- package/dist/plugin.mjs.map +1 -1
- package/dist/process-registry.cjs +1 -1
- package/dist/process-registry.mjs +1 -1
- package/dist/publish.cjs +3 -3
- package/dist/publish.cjs.map +1 -1
- package/dist/publish.mjs +4 -4
- package/dist/publish.mjs.map +1 -1
- package/dist/resolver.cjs +293 -0
- package/dist/resolver.cjs.map +1 -0
- package/dist/resolver.d.cts +99 -0
- package/dist/resolver.d.mts +99 -0
- package/dist/resolver.mjs +284 -0
- package/dist/resolver.mjs.map +1 -0
- package/dist/smoke.cjs +262 -0
- package/dist/smoke.cjs.map +1 -0
- package/dist/smoke.mjs +260 -0
- package/dist/smoke.mjs.map +1 -0
- package/dist/ui/auth.d.cts +217 -123
- package/dist/ui/auth.d.mts +217 -123
- package/dist/ui/router-client.cjs +2 -1
- package/dist/ui/router-client.cjs.map +1 -1
- package/dist/ui/router-client.mjs +2 -1
- package/dist/ui/router-client.mjs.map +1 -1
- package/dist/version-manifest-resolve.cjs +3 -3
- package/dist/version-manifest-resolve.cjs.map +1 -1
- package/dist/version-manifest-resolve.mjs +1 -1
- package/dist/version-manifest-resolve.mjs.map +1 -1
- package/dist/workspace.cjs +1 -1
- package/dist/workspace.mjs +1 -1
- package/package.json +18 -18
- package/skills/api-and-auth/SKILL.md +12 -9
- package/skills/api-and-auth/references/middleware.md +38 -0
- package/skills/cli-reference/SKILL.md +22 -6
- package/skills/talk-to-the-app/SKILL.md +32 -5
- package/dist/bundle-fs-resolve.cjs +0 -235
- package/dist/bundle-fs-resolve.cjs.map +0 -1
- package/dist/bundle-fs-resolve.d.cts +0 -82
- package/dist/bundle-fs-resolve.d.mts +0 -82
- package/dist/bundle-fs-resolve.mjs +0 -228
- package/dist/bundle-fs-resolve.mjs.map +0 -1
- package/dist/bundle-path.cjs +0 -48
- package/dist/bundle-path.cjs.map +0 -1
- package/dist/bundle-path.mjs +0 -45
- package/dist/bundle-path.mjs.map +0 -1
- package/dist/mf.cjs.map +0 -1
- package/dist/mf.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-fs-resolve.mjs","names":[],"sources":["../src/bundle-fs-resolve.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { Context, Effect, Layer, ManagedRuntime, Schema } from \"effect\";\nimport { cacheControlOf } from \"every-plugin/build/artifact-names\";\nimport {\n bundleCachePath,\n bundleCacheRoot,\n readBundleCache,\n writeBundleCache,\n} from \"./bundle-cache\";\nimport { bundleUrlToStagedPath } from \"./bundle-path\";\nimport { isAppDescriptorPath } from \"./config\";\n\n/**\n * Local-first bundle resolution (ADR 0011 amendment; unified policy, ADR 0021\n * amendment): a self-contained runtime image stages its own namespace under\n * `BOS_BUNDLE_DIR` as `bundles/<account>/<gateway>/<workspace>/…` and consumes\n * those bytes directly from disk; a miss falls through to the network, so a\n * partially-staged namespace boots over the wire instead of failing. The\n * registry tier (children, `BOS_BUNDLE_DIR` unset) keeps the network fetch —\n * the namespace guard below only ever matches the runtime's own\n * account/gateway, never another runtime's layout.\n */\n\nexport interface BundleNamespace {\n readonly bundleDir: string;\n readonly account: string;\n readonly gateway: string;\n}\n\nexport class BundleReadError extends Schema.TaggedError<BundleReadError>()(\"BundleReadError\", {\n path: Schema.String,\n cause: Schema.optional(Schema.Unknown),\n}) {}\n\nconst MIME_TYPES: Record<string, string> = {\n \".js\": \"text/javascript\",\n \".mjs\": \"text/javascript\",\n \".cjs\": \"text/javascript\",\n \".css\": \"text/css\",\n \".json\": \"application/json\",\n \".map\": \"application/json\",\n \".svg\": \"image/svg+xml\",\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".avif\": \"image/avif\",\n \".ico\": \"image/x-icon\",\n \".html\": \"text/html\",\n \".htm\": \"text/html\",\n \".webmanifest\": \"application/manifest+json\",\n \".md\": \"text/markdown\",\n \".ts\": \"text/plain\",\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".otf\": \"font/otf\",\n \".eot\": \"application/vnd.ms-fontobject\",\n \".wasm\": \"application/wasm\",\n \".txt\": \"text/plain\",\n \".xml\": \"application/xml\",\n};\n\n/**\n * Own-namespace path for a bundle URL: the shared URL→staged-path mapping,\n * narrowed to the runtime identity — a URL whose encoded namespace differs\n * from `namespace.account`/`namespace.gateway` must fall to the network/cache\n * path, never serve a sibling namespace's staged bytes.\n */\nexport function bundleUrlToLocalPath(url: string, namespace: BundleNamespace): string | null {\n const filePath = bundleUrlToStagedPath(url, namespace.bundleDir);\n if (!filePath) return null;\n\n const nsDir = path.resolve(namespace.bundleDir, namespace.account, namespace.gateway);\n if (filePath !== nsDir && !filePath.startsWith(nsDir + path.sep)) return null;\n\n return filePath;\n}\n\nexport class BundleResolver extends Context.Service<\n BundleResolver,\n {\n /** Resolve a fetch target from the staged namespace; null = miss or not our namespace — fall through to the network. */\n readonly lookup: (input: string | URL | Request) => Effect.Effect<Response | null>;\n }\n>()(\"everything-dev/bundle-fs-resolve/BundleResolver\") {\n static layer(namespace: BundleNamespace): Layer.Layer<BundleResolver> {\n const respond = Effect.fn(\"BundleResolver.respond\")(function* (\n url: string,\n ): Effect.fn.Return<Response | null, never> {\n const filePath = bundleUrlToLocalPath(url, namespace);\n if (!filePath) return null;\n const bytes = yield* Effect.tryPromise({\n try: () => readFile(filePath),\n catch: (cause) => new BundleReadError({ path: filePath, cause }),\n }).pipe(Effect.catchTag(\"BundleReadError\", () => Effect.succeed(null)));\n if (bytes === null) return null;\n const name = path.basename(filePath);\n const contentType =\n MIME_TYPES[path.extname(name).toLowerCase()] ?? \"application/octet-stream\";\n return new Response(new Uint8Array(bytes), {\n headers: {\n \"content-type\": contentType,\n \"cache-control\": cacheControlOf(name),\n etag: `\"${Buffer.from(bytes.subarray(0, 4096)).toString(\"base64\").slice(0, 24)}\"`,\n },\n });\n });\n\n return Layer.effect(\n BundleResolver,\n Effect.succeed(\n BundleResolver.of({\n lookup: (input) => {\n const url =\n typeof input === \"string\" ? input : input instanceof URL ? input.href : input.url;\n return respond(url);\n },\n }),\n ),\n );\n }\n}\n\nexport interface BundleFetchHandle {\n readonly uninstall: () => Promise<void>;\n}\n\nexport interface BundleFetchOptions {\n /** Own-namespace FS resolution — requires a staged `BOS_BUNDLE_DIR`. */\n namespace?: BundleNamespace;\n /**\n * Foreign-namespace stale-if-error cache (child tier): `/bundles/…` URLs\n * outside the own namespace write through to disk on success and serve\n * the last-known-good bytes when the origin fails. Enabled implicitly\n * when `namespace` is present (deployment contexts), or explicitly via\n * `BOS_BUNDLE_CACHE_DIR`.\n */\n cacheDir?: string;\n}\n\ntype FetchImpl = typeof globalThis.fetch;\n\nconst staleResponse = (bytes: Uint8Array, url: string): Response => {\n const name = url.split(\"?\")[0].split(\"/\").pop() ?? \"\";\n const contentType = MIME_TYPES[path.extname(name).toLowerCase()] ?? \"application/octet-stream\";\n return new Response(bytes.slice().buffer, {\n status: 200,\n headers: { \"content-type\": contentType, \"x-bundle-cache\": \"stale\" },\n });\n};\n\nconst FETCH_RETRY_ATTEMPTS = 3;\nconst FETCH_RETRY_BASE_DELAY_MS = 250;\n\nconst isTransientStatus = (status: number): boolean => status === 429 || status >= 500;\n\nfunction requestMethod(input: Parameters<FetchImpl>[0], init?: Parameters<FetchImpl>[1]): string {\n if (init?.method) return init.method.toUpperCase();\n if (typeof input === \"string\" || input instanceof URL) return \"GET\";\n return input.method.toUpperCase();\n}\n\n/**\n * Bounded transient-failure retry for idempotent GETs crossing the\n * interceptor (ADR 0021 amendment — the CDN-only image): a cold boot has no\n * staged fallback, so one edge/registry hiccup during the load window would\n * hard-fail the host or a plugin with no recourse. Network errors and\n * 429/5xx responses retry twice (250ms, 750ms backoff) before propagating;\n * non-transient statuses and non-GET requests pass through untouched. After\n * exhausting attempts a stale-if-error cache still sees the final failure.\n */\nasync function fetchWithTransientRetry(\n original: FetchImpl,\n input: Parameters<FetchImpl>[0],\n init?: Parameters<FetchImpl>[1],\n): Promise<Response> {\n if (requestMethod(input, init) !== \"GET\") return original(input, init);\n let lastError: unknown;\n let lastResponse: Response | null = null;\n for (let attempt = 0; attempt < FETCH_RETRY_ATTEMPTS; attempt++) {\n if (attempt > 0) {\n await new Promise((resolve) =>\n setTimeout(resolve, FETCH_RETRY_BASE_DELAY_MS * 3 ** (attempt - 1)),\n );\n }\n try {\n const response = await original(input, init);\n if (!isTransientStatus(response.status)) return response;\n lastResponse = response;\n } catch (error) {\n lastError = error;\n }\n }\n if (lastResponse) return lastResponse;\n throw lastError;\n}\n\n/**\n * Installs the resolver as a global fetch interceptor — the one seam every\n * boot-time consumer shares (config manifest discovery, contract-type\n * fetches, orchestrator host loading, MF remoteEntry/identity probes).\n * One layered resolution policy: staged disk → network → stale-if-error.\n * Own-namespace URLs resolve from the staged directory and fall through to\n * the original fetch on a miss (a partially-staged namespace boots over the\n * wire instead of failing); a miss never touches the write-through cache —\n * for the own namespace the staged disk IS the resilience artifact. Foreign\n * `/bundles/…` URLs get the network with the stale-if-error cache; every\n * other URL falls through to the original fetch untouched. Inert when\n * neither a staged namespace nor a cache is configured.\n */\nexport function installGlobalBundleFetch(options: BundleFetchOptions): BundleFetchHandle {\n const namespace = options.namespace;\n const cacheDir = options.cacheDir;\n const runtime = namespace ? ManagedRuntime.make(BundleResolver.layer(namespace)) : null;\n const original: FetchImpl = globalThis.fetch;\n const patched = (async (input: Parameters<FetchImpl>[0], init?: Parameters<FetchImpl>[1]) => {\n const url = typeof input === \"string\" ? input : input instanceof URL ? input.href : input.url;\n\n if (namespace && bundleUrlToLocalPath(url, namespace)) {\n if (!runtime) throw new Error(\"unreachable: resolver runtime missing\");\n const response = await runtime.runPromise(\n Effect.gen(function* () {\n const resolver = yield* BundleResolver;\n return yield* resolver.lookup(input);\n }),\n );\n if (response !== null) return response;\n return fetchWithTransientRetry(original, input, init);\n }\n\n if (cacheDir !== undefined && bundleCachePath(url, { cacheDir })) {\n return (async () => {\n try {\n const response = await fetchWithTransientRetry(original, input, init);\n if (response.ok) {\n try {\n const bytes = new Uint8Array(await response.clone().arrayBuffer());\n await writeBundleCache(url, bytes, { cacheDir });\n } catch {\n // write-through is best-effort\n }\n } else {\n const cached = await readBundleCache(url, { cacheDir });\n if (cached) return staleResponse(cached, url);\n }\n return response;\n } catch (error) {\n const cached = await readBundleCache(url, { cacheDir });\n if (cached) return staleResponse(cached, url);\n throw error;\n }\n })();\n }\n\n return fetchWithTransientRetry(original, input, init);\n }) as FetchImpl;\n const originalPreconnect = (original as Partial<FetchImpl>).preconnect;\n if (originalPreconnect) {\n patched.preconnect = originalPreconnect.bind(original);\n }\n globalThis.fetch = patched;\n return {\n uninstall: async () => {\n if (globalThis.fetch === patched) {\n globalThis.fetch = original;\n }\n if (runtime) await runtime.dispose();\n },\n };\n}\n\n/**\n * Boot-time installer for the CLI: derives the own namespace from\n * `BOS_BUNDLE_DIR` plus the runtime identity (`BOS_ACCOUNT`/`BOS_GATEWAY`\n * registry env taking precedence over the bos.config.json fields), and the\n * foreign-namespace cache from `BOS_BUNDLE_CACHE_DIR`. Tier auto-detection\n * (ADR 0021): an identity whose namespace is not actually staged under the\n * bundle dir drops to the registry tier — plain network fetch — instead of\n * deterministically 404ing own-namespace URLs against a foreign image's\n * staged bytes. Never throws — a missing or malformed identity leaves the\n * default network fetch in place.\n */\nexport function installBundleFetchFromEnv(input: {\n configPath?: string | null;\n}): BundleFetchHandle | null {\n const bundleDir = process.env.BOS_BUNDLE_DIR;\n const cacheDir = process.env.BOS_BUNDLE_CACHE_DIR;\n if (!bundleDir && cacheDir === undefined) return null;\n\n let configAccount: string | undefined;\n let configGateway: string | undefined;\n const configPath = input.configPath;\n if (configPath && !isAppDescriptorPath(configPath)) {\n try {\n const parsed = JSON.parse(readFileSync(configPath, \"utf8\")) as {\n account?: string;\n domain?: string;\n };\n configAccount = parsed.account;\n configGateway = parsed.domain;\n } catch {\n // unreadable config — identity may still come from the registry env\n }\n }\n\n const account = process.env.BOS_ACCOUNT ?? configAccount;\n const gateway = process.env.BOS_GATEWAY ?? configGateway;\n if (bundleDir && (!account || !gateway)) return null;\n\n let namespace: BundleNamespace | undefined;\n if (bundleDir && account && gateway) {\n if (existsSync(path.join(bundleDir, account, gateway))) {\n namespace = { bundleDir, account, gateway };\n } else {\n console.warn(\n `[bundles] staged namespace ${account}/${gateway} not found under ${bundleDir} — registry tier (network fetch)`,\n );\n }\n }\n return installGlobalBundleFetch({\n namespace,\n cacheDir: cacheDir ?? (namespace ? bundleCacheRoot() : undefined),\n });\n}\n"],"mappings":";;;;;;;;;;AA+BA,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,mBAAmB;CAC5F,MAAM,OAAO;CACb,OAAO,OAAO,SAAS,OAAO,OAAO;AACvC,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,aAAqC;CACzC,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;CACP,OAAO;CACP,SAAS;CACT,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;AACV;;;;;;;AAQA,SAAgB,qBAAqB,KAAa,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,WAAW,YAAY;EACrB,IAAI,WAAW,UAAU,SACvB,WAAW,QAAQ;EAErB,IAAI,SAAS,MAAM,QAAQ,QAAQ;CACrC,EACF;AACF;;;;;;;;;;;;AAaA,SAAgB,0BAA0B,OAEb;CAC3B,MAAM,YAAY,QAAQ,IAAI;CAC9B,MAAM,WAAW,QAAQ,IAAI;CAC7B,IAAI,CAAC,aAAa,aAAa,QAAW,OAAO;CAEjD,IAAI;CACJ,IAAI;CACJ,MAAM,aAAa,MAAM;CACzB,IAAI,cAAc,CAAC,oBAAoB,UAAU,GAC/C,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,aAAa,YAAY,MAAM,CAAC;EAI1D,gBAAgB,OAAO;EACvB,gBAAgB,OAAO;CACzB,QAAQ,CAER;CAGF,MAAM,UAAU,QAAQ,IAAI,eAAe;CAC3C,MAAM,UAAU,QAAQ,IAAI,eAAe;CAC3C,IAAI,cAAc,CAAC,WAAW,CAAC,UAAU,OAAO;CAEhD,IAAI;CACJ,IAAI,aAAa,WAAW,SAAS;EACnC,IAAI,WAAW,KAAK,KAAK,WAAW,SAAS,OAAO,CAAC,GACnD,YAAY;GAAE;GAAW;GAAS;EAAQ;OAE1C,QAAQ,KACN,8BAA8B,QAAQ,GAAG,QAAQ,mBAAmB,UAAU,iCAChF;CAEJ;CACA,OAAO,yBAAyB;EAC9B;EACA,UAAU,aAAa,YAAY,gBAAgB,IAAI;CACzD,CAAC;AACH"}
|
package/dist/bundle-path.cjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
let node_path = require("node:path");
|
|
3
|
-
node_path = require_runtime.__toESM(node_path, 1);
|
|
4
|
-
|
|
5
|
-
//#region src/bundle-path.ts
|
|
6
|
-
/**
|
|
7
|
-
* Maps a bundle URL onto the staged namespace layout. Bundle URLs carry their
|
|
8
|
-
* namespace in the path (`…/bundles/<account>/<gateway>/<workspace>/…`); the
|
|
9
|
-
* staged layout mirrors it under `<bundleDir>/<account>/<gateway>/…`. The
|
|
10
|
-
* namespace is taken from the URL itself — unlike the runtime-identity
|
|
11
|
-
* resolution, this answers "which staged directory do these bytes live in?"
|
|
12
|
-
* rather than "is this my namespace?" — and the result is contained within
|
|
13
|
-
* the account/gateway directory. Returns null for foreign shapes.
|
|
14
|
-
*/
|
|
15
|
-
function bundleUrlToStagedPath(url, bundleDir) {
|
|
16
|
-
let parsed;
|
|
17
|
-
try {
|
|
18
|
-
parsed = new URL(url);
|
|
19
|
-
} catch {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
|
|
23
|
-
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
24
|
-
if (segments[0] !== "bundles" || segments.length < 3) return null;
|
|
25
|
-
let decoded;
|
|
26
|
-
try {
|
|
27
|
-
decoded = segments.slice(1).map((segment) => decodeURIComponent(segment));
|
|
28
|
-
} catch {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const [account, gateway, ...rest] = decoded;
|
|
32
|
-
if (!account || !gateway || rest.length === 0) return null;
|
|
33
|
-
const nsDir = node_path.default.resolve(bundleDir, account, gateway);
|
|
34
|
-
const filePath = node_path.default.resolve(nsDir, ...rest);
|
|
35
|
-
if (filePath === nsDir || !filePath.startsWith(nsDir + node_path.default.sep)) return null;
|
|
36
|
-
return filePath;
|
|
37
|
-
}
|
|
38
|
-
/** Resolve a relative config-supplied path inside `dir`, or null on escape. */
|
|
39
|
-
function resolveContained(dir, relative) {
|
|
40
|
-
const resolved = node_path.default.resolve(dir, ...relative.split("/").filter(Boolean));
|
|
41
|
-
if (resolved === dir || !resolved.startsWith(dir + node_path.default.sep)) return null;
|
|
42
|
-
return resolved;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
exports.bundleUrlToStagedPath = bundleUrlToStagedPath;
|
|
47
|
-
exports.resolveContained = resolveContained;
|
|
48
|
-
//# sourceMappingURL=bundle-path.cjs.map
|
package/dist/bundle-path.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-path.cjs","names":["path"],"sources":["../src/bundle-path.ts"],"sourcesContent":["import path from \"node:path\";\n\n/**\n * Maps a bundle URL onto the staged namespace layout. Bundle URLs carry their\n * namespace in the path (`…/bundles/<account>/<gateway>/<workspace>/…`); the\n * staged layout mirrors it under `<bundleDir>/<account>/<gateway>/…`. The\n * namespace is taken from the URL itself — unlike the runtime-identity\n * resolution, this answers \"which staged directory do these bytes live in?\"\n * rather than \"is this my namespace?\" — and the result is contained within\n * the account/gateway directory. Returns null for foreign shapes.\n */\nexport function bundleUrlToStagedPath(url: string, bundleDir: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") return null;\n\n const segments = parsed.pathname.split(\"/\").filter(Boolean);\n if (segments[0] !== \"bundles\" || segments.length < 3) return null;\n\n let decoded: string[];\n try {\n decoded = segments.slice(1).map((segment) => decodeURIComponent(segment));\n } catch {\n return null;\n }\n const [account, gateway, ...rest] = decoded;\n if (!account || !gateway || rest.length === 0) return null;\n\n const nsDir = path.resolve(bundleDir, account, gateway);\n const filePath = path.resolve(nsDir, ...rest);\n if (filePath === nsDir || !filePath.startsWith(nsDir + path.sep)) return null;\n return filePath;\n}\n\n/** Resolve a relative config-supplied path inside `dir`, or null on escape. */\nexport function resolveContained(dir: string, relative: string): string | null {\n const resolved = path.resolve(dir, ...relative.split(\"/\").filter(Boolean));\n if (resolved === dir || !resolved.startsWith(dir + path.sep)) return null;\n return resolved;\n}\n"],"mappings":";;;;;;;;;;;;;;AAWA,SAAgB,sBAAsB,KAAa,WAAkC;CACnF,IAAI;CACJ,IAAI;EACF,SAAS,IAAI,IAAI,GAAG;CACtB,QAAQ;EACN,OAAO;CACT;CACA,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,SAAS,OAAO;CAExE,MAAM,WAAW,OAAO,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC1D,IAAI,SAAS,OAAO,aAAa,SAAS,SAAS,GAAG,OAAO;CAE7D,IAAI;CACJ,IAAI;EACF,UAAU,SAAS,MAAM,CAAC,CAAC,CAAC,KAAK,YAAY,mBAAmB,OAAO,CAAC;CAC1E,QAAQ;EACN,OAAO;CACT;CACA,MAAM,CAAC,SAAS,SAAS,GAAG,QAAQ;CACpC,IAAI,CAAC,WAAW,CAAC,WAAW,KAAK,WAAW,GAAG,OAAO;CAEtD,MAAM,QAAQA,kBAAK,QAAQ,WAAW,SAAS,OAAO;CACtD,MAAM,WAAWA,kBAAK,QAAQ,OAAO,GAAG,IAAI;CAC5C,IAAI,aAAa,SAAS,CAAC,SAAS,WAAW,QAAQA,kBAAK,GAAG,GAAG,OAAO;CACzE,OAAO;AACT;;AAGA,SAAgB,iBAAiB,KAAa,UAAiC;CAC7E,MAAM,WAAWA,kBAAK,QAAQ,KAAK,GAAG,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC;CACzE,IAAI,aAAa,OAAO,CAAC,SAAS,WAAW,MAAMA,kBAAK,GAAG,GAAG,OAAO;CACrE,OAAO;AACT"}
|
package/dist/bundle-path.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
|
|
3
|
-
//#region src/bundle-path.ts
|
|
4
|
-
/**
|
|
5
|
-
* Maps a bundle URL onto the staged namespace layout. Bundle URLs carry their
|
|
6
|
-
* namespace in the path (`…/bundles/<account>/<gateway>/<workspace>/…`); the
|
|
7
|
-
* staged layout mirrors it under `<bundleDir>/<account>/<gateway>/…`. The
|
|
8
|
-
* namespace is taken from the URL itself — unlike the runtime-identity
|
|
9
|
-
* resolution, this answers "which staged directory do these bytes live in?"
|
|
10
|
-
* rather than "is this my namespace?" — and the result is contained within
|
|
11
|
-
* the account/gateway directory. Returns null for foreign shapes.
|
|
12
|
-
*/
|
|
13
|
-
function bundleUrlToStagedPath(url, bundleDir) {
|
|
14
|
-
let parsed;
|
|
15
|
-
try {
|
|
16
|
-
parsed = new URL(url);
|
|
17
|
-
} catch {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
|
|
21
|
-
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
22
|
-
if (segments[0] !== "bundles" || segments.length < 3) return null;
|
|
23
|
-
let decoded;
|
|
24
|
-
try {
|
|
25
|
-
decoded = segments.slice(1).map((segment) => decodeURIComponent(segment));
|
|
26
|
-
} catch {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const [account, gateway, ...rest] = decoded;
|
|
30
|
-
if (!account || !gateway || rest.length === 0) return null;
|
|
31
|
-
const nsDir = path.resolve(bundleDir, account, gateway);
|
|
32
|
-
const filePath = path.resolve(nsDir, ...rest);
|
|
33
|
-
if (filePath === nsDir || !filePath.startsWith(nsDir + path.sep)) return null;
|
|
34
|
-
return filePath;
|
|
35
|
-
}
|
|
36
|
-
/** Resolve a relative config-supplied path inside `dir`, or null on escape. */
|
|
37
|
-
function resolveContained(dir, relative) {
|
|
38
|
-
const resolved = path.resolve(dir, ...relative.split("/").filter(Boolean));
|
|
39
|
-
if (resolved === dir || !resolved.startsWith(dir + path.sep)) return null;
|
|
40
|
-
return resolved;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { bundleUrlToStagedPath, resolveContained };
|
|
45
|
-
//# sourceMappingURL=bundle-path.mjs.map
|
package/dist/bundle-path.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-path.mjs","names":[],"sources":["../src/bundle-path.ts"],"sourcesContent":["import path from \"node:path\";\n\n/**\n * Maps a bundle URL onto the staged namespace layout. Bundle URLs carry their\n * namespace in the path (`…/bundles/<account>/<gateway>/<workspace>/…`); the\n * staged layout mirrors it under `<bundleDir>/<account>/<gateway>/…`. The\n * namespace is taken from the URL itself — unlike the runtime-identity\n * resolution, this answers \"which staged directory do these bytes live in?\"\n * rather than \"is this my namespace?\" — and the result is contained within\n * the account/gateway directory. Returns null for foreign shapes.\n */\nexport function bundleUrlToStagedPath(url: string, bundleDir: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") return null;\n\n const segments = parsed.pathname.split(\"/\").filter(Boolean);\n if (segments[0] !== \"bundles\" || segments.length < 3) return null;\n\n let decoded: string[];\n try {\n decoded = segments.slice(1).map((segment) => decodeURIComponent(segment));\n } catch {\n return null;\n }\n const [account, gateway, ...rest] = decoded;\n if (!account || !gateway || rest.length === 0) return null;\n\n const nsDir = path.resolve(bundleDir, account, gateway);\n const filePath = path.resolve(nsDir, ...rest);\n if (filePath === nsDir || !filePath.startsWith(nsDir + path.sep)) return null;\n return filePath;\n}\n\n/** Resolve a relative config-supplied path inside `dir`, or null on escape. */\nexport function resolveContained(dir: string, relative: string): string | null {\n const resolved = path.resolve(dir, ...relative.split(\"/\").filter(Boolean));\n if (resolved === dir || !resolved.startsWith(dir + path.sep)) return null;\n return resolved;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,sBAAsB,KAAa,WAAkC;CACnF,IAAI;CACJ,IAAI;EACF,SAAS,IAAI,IAAI,GAAG;CACtB,QAAQ;EACN,OAAO;CACT;CACA,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,SAAS,OAAO;CAExE,MAAM,WAAW,OAAO,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC1D,IAAI,SAAS,OAAO,aAAa,SAAS,SAAS,GAAG,OAAO;CAE7D,IAAI;CACJ,IAAI;EACF,UAAU,SAAS,MAAM,CAAC,CAAC,CAAC,KAAK,YAAY,mBAAmB,OAAO,CAAC;CAC1E,QAAQ;EACN,OAAO;CACT;CACA,MAAM,CAAC,SAAS,SAAS,GAAG,QAAQ;CACpC,IAAI,CAAC,WAAW,CAAC,WAAW,KAAK,WAAW,GAAG,OAAO;CAEtD,MAAM,QAAQ,KAAK,QAAQ,WAAW,SAAS,OAAO;CACtD,MAAM,WAAW,KAAK,QAAQ,OAAO,GAAG,IAAI;CAC5C,IAAI,aAAa,SAAS,CAAC,SAAS,WAAW,QAAQ,KAAK,GAAG,GAAG,OAAO;CACzE,OAAO;AACT;;AAGA,SAAgB,iBAAiB,KAAa,UAAiC;CAC7E,MAAM,WAAW,KAAK,QAAQ,KAAK,GAAG,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC;CACzE,IAAI,aAAa,OAAO,CAAC,SAAS,WAAW,MAAM,KAAK,GAAG,GAAG,OAAO;CACrE,OAAO;AACT"}
|
package/dist/mf.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mf.cjs","names":["computeSriHash","readBundleCache","writeBundleCache","getInstance","createInstance","isEffectCriticalSharedDep","readFileSync"],"sources":["../src/mf.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createInstance, getInstance } from \"@module-federation/enhanced/runtime\";\nimport { setGlobalFederationInstance } from \"@module-federation/runtime-core\";\nimport { isEffectCriticalSharedDep } from \"every-plugin/build/rspack\";\nimport { readBundleCache, writeBundleCache } from \"./bundle-cache\";\nimport { computeSriHash, type IntegrityRegistry } from \"./integrity\";\nimport type { BosConfig, BosPluginRef } from \"./types\";\n\ntype FederationInstance = ReturnType<typeof createInstance>;\n\nlet mfInstance: FederationInstance | null = null;\n\nfunction fetchWithTimeout(url: string, init: RequestInit, timeoutMs: number): Promise<Response> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n return fetch(url, { ...init, signal: controller.signal }).finally(() => clearTimeout(timer));\n}\n\nexport function patchManifestFetchForSsrPublicPath(mf: FederationInstance): void {\n if (!mf || !(mf as any).loaderHook?.lifecycle?.fetch?.on) return;\n if ((mf as any).__everythingDevPatchedManifestFetch === true) return;\n (mf as any).__everythingDevPatchedManifestFetch = true;\n\n (mf as any).loaderHook.lifecycle.fetch.on((url: unknown, init: unknown) => {\n if (typeof url !== \"string\" || !url.endsWith(\"/mf-manifest.json\")) {\n return;\n }\n return fetchWithTimeout(url as string, init as RequestInit, 15_000)\n .then((res) => res.json())\n .then((json: any) => {\n json.metaData = json.metaData ?? {};\n json.metaData.ssrPublicPath =\n json.metaData.ssrPublicPath ?? url.replace(/\\/mf-manifest\\.json$/, \"/\");\n if (json.metaData.publicPath === \"auto\" || json.metaData.publicPath === \"\") {\n json.metaData.publicPath = \"/\";\n }\n return new Response(JSON.stringify(json), {\n headers: { \"content-type\": \"application/json\" },\n });\n });\n });\n}\n\nexport function installIntegrityFetchHook(\n mf: FederationInstance,\n registry: IntegrityRegistry,\n options?: { cacheDir?: string },\n): void {\n if (!mf || !(mf as any).loaderHook?.lifecycle?.fetch?.on) {\n console.warn(\"[SRI] MF lifecycle fetch hook not available, skipping integrity-in-pipeline\");\n return;\n }\n if ((mf as any).__everythingDevIntegrityHook === true) return;\n (mf as any).__everythingDevIntegrityHook = true;\n\n (mf as any).loaderHook.lifecycle.fetch.on((url: unknown, init: unknown) => {\n if (typeof url !== \"string\") return;\n\n const expectedHash = registry.get(url);\n if (!expectedHash) return;\n\n return fetchWithTimeout(url as string, init as RequestInit, 15_000).then(async (res) => {\n const buffer = Buffer.from(await res.arrayBuffer());\n const computed = computeSriHash(buffer);\n\n if (computed !== expectedHash) {\n // ticket 09 (atomic-deploys): an SRI mismatch is treated like an\n // origin failure — the last-known-good bytes (which satisfied the\n // same pin when cached) serve instead, and the corrupted bytes are\n // never written into the cache.\n const cached = await readBundleCache(url as string, { cacheDir: options?.cacheDir });\n if (cached && computeSriHash(Buffer.from(cached)) === expectedHash) {\n console.warn(\n `[SRI] Origin bytes failed verification for ${url} — serving last-known-good from the bundle cache`,\n );\n return new Response(cached.slice().buffer, {\n status: 200,\n headers: { \"x-bundle-cache\": \"stale\" },\n });\n }\n console.error(\n `[SRI] Integrity check failed in MF fetch pipeline for ${url}\\n Expected: ${expectedHash}\\n Computed: ${computed}`,\n );\n return new Response(`Integrity check failed for ${url}`, {\n status: 500,\n statusText: \"Integrity Check Failed\",\n });\n }\n\n // verified: pin-checked write-through\n await writeBundleCache(url as string, new Uint8Array(buffer), {\n cacheDir: options?.cacheDir,\n }).catch(() => {\n // write-through is best-effort\n });\n\n return new Response(buffer, {\n status: res.status,\n statusText: res.statusText,\n headers: res.headers,\n });\n });\n });\n}\n\nexport function getFederationInstance(): FederationInstance {\n if (mfInstance) return mfInstance;\n\n const existing = getInstance();\n if (existing) {\n mfInstance = existing as FederationInstance;\n setGlobalFederationInstance(mfInstance as any);\n patchManifestFetchForSsrPublicPath(mfInstance);\n return mfInstance;\n }\n\n mfInstance = createInstance({\n name: \"host\",\n remotes: [],\n }) as FederationInstance;\n setGlobalFederationInstance(mfInstance as any);\n patchManifestFetchForSsrPublicPath(mfInstance);\n return mfInstance;\n}\n\nexport async function registerRemote(opts: {\n name: string;\n entry: string;\n type?: \"manifest\" | \"script\";\n}): Promise<void> {\n const instance = getFederationInstance();\n\n const inferType = (): \"manifest\" | \"script\" => {\n if (opts.type) return opts.type;\n if (opts.entry.endsWith(\"/mf-manifest.json\")) return \"manifest\";\n if (/\\/remoteEntry(\\.[a-f0-9]{8,})?\\.js$/.test(opts.entry)) return \"script\";\n return typeof window === \"undefined\" ? \"script\" : \"manifest\";\n };\n\n const remoteType = inferType();\n\n instance.registerRemotes([\n {\n name: opts.name,\n entry: opts.entry,\n type: remoteType,\n },\n ]);\n}\n\nexport async function loadRemoteModule<T>(\n specifier: string,\n options?: { loadFactory?: boolean; from?: \"build\" | \"runtime\" },\n): Promise<T> {\n const instance = getFederationInstance();\n\n const isServer = typeof window === \"undefined\";\n if (isServer) {\n await (instance as any).initializeSharing?.(\"default\");\n }\n\n const mod = await instance.loadRemote<T>(specifier, options as any);\n if (!mod) {\n throw new Error(`Failed to load remote module: ${specifier}`);\n }\n return mod;\n}\n\nexport async function ensureNodeRuntimePlugin(): Promise<void> {\n const instance = getFederationInstance();\n if (typeof window !== \"undefined\") return;\n if ((instance as any).__nodeRuntimePluginLoaded) return;\n\n const mod: any = await import(\"@module-federation/node/runtimePlugin\");\n const factory = mod?.default ?? mod;\n const plugin = typeof factory === \"function\" ? factory() : null;\n if (plugin) {\n instance.registerPlugins([plugin]);\n }\n (instance as any).__nodeRuntimePluginLoaded = true;\n}\n\nexport interface FederationCompatRemote {\n role: string;\n url: string;\n reachable: boolean;\n pluginVersion: string | null;\n ok: boolean;\n reason?: string;\n}\n\nexport interface FederationCompatReport {\n ok: boolean;\n hostVersion: string | null;\n hostReachable: boolean;\n hostReason?: string;\n remotes: FederationCompatRemote[];\n}\n\nfunction parseSemver(v: unknown): { major: number; minor: number; patch: number } | null {\n const m = typeof v === \"string\" ? /^(\\d+)\\.(\\d+)\\.(\\d+)/.exec(v) : null;\n return m ? { major: +m[1]!, minor: +m[2]!, patch: +m[3]! } : null;\n}\n\nfunction satisfiesConstraint(version: string, constraint: string): boolean {\n const trimmed = constraint.trim();\n if (!trimmed) return true;\n if (![\"^\", \"~\", \">\", \"<\", \"=\", \"x\"].some((c) => trimmed.startsWith(c))) {\n return version === trimmed;\n }\n const m = /^\\s*\\^\\s*(\\d+)\\.(\\d+)\\.(\\d+)/.exec(trimmed);\n if (!m) return true;\n const v = parseSemver(version);\n if (!v) return false;\n if (v.major !== +m[1]!) return false;\n if (v.minor < +m[2]! || (v.minor === +m[2]! && v.patch < +m[3]!)) return false;\n const constraintPrerelease = trimmed.match(/-([0-9A-Za-z.-]+)/);\n const versionPrerelease = /-([0-9A-Za-z.-]+)\\s*$/.exec(version);\n if (constraintPrerelease) {\n if (!versionPrerelease) return false;\n const cPre = constraintPrerelease[1]!.split(\".\");\n const vPre = versionPrerelease[1]!.split(\".\");\n for (let i = 0; i < Math.max(cPre.length, vPre.length); i += 1) {\n const c = cPre[i] ?? \"0\";\n const p = vPre[i] ?? \"0\";\n if (c === p) continue;\n const cNum = /^\\d+$/.test(c) ? +c : null;\n const pNum = /^\\d+$/.test(p) ? +p : null;\n if (cNum !== null && pNum !== null) return cNum < pNum;\n return cNum === null ? c.localeCompare(p) < 0 : false;\n }\n return true;\n }\n if (versionPrerelease) return false;\n return true;\n}\n\nfunction manifestUrl(remoteUrl: string): string {\n return remoteUrl.endsWith(\"/\") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;\n}\n\nasync function fetchManifest(url: string, timeoutMs: number): Promise<unknown> {\n const res = await fetch(manifestUrl(url), { signal: AbortSignal.timeout(timeoutMs) });\n if (!res.ok) throw new Error(`HTTP ${res.status} ${res.statusText}`);\n return res.json();\n}\n\nfunction listFederationRemotes(bosConfig: BosConfig): Array<{ role: string; url: string }> {\n const out: Array<{ role: string; url: string }> = [];\n for (const role of [\"api\", \"auth\"] as const) {\n const url = readProductionUrl((bosConfig?.app as Record<string, unknown> | undefined)?.[role]);\n if (url) out.push({ role, url });\n }\n for (const [id, slot] of Object.entries(bosConfig?.plugins ?? {})) {\n const url = readProductionUrl(slot);\n if (url) out.push({ role: id, url });\n }\n return out;\n}\n\nfunction readProductionUrl(entry: unknown): string | null {\n if (typeof entry === \"string\") return entry.length > 0 ? entry : null;\n if (entry && typeof (entry as BosPluginRef).production === \"string\") {\n const url = (entry as BosPluginRef).production!;\n return url.length > 0 ? url : null;\n }\n return null;\n}\n\ninterface RemoteManifest {\n metaData?: { pluginVersion?: string };\n shared?: Array<{ name: string; version?: string; requiredVersion?: string | null }>;\n}\n\nexport async function checkFederationCompat(\n bosConfig: BosConfig | null,\n opts: { timeoutMs?: number } = {},\n): Promise<FederationCompatReport> {\n const timeoutMs = opts.timeoutMs ?? 15_000;\n\n if (!bosConfig?.app?.host?.production) {\n return { ok: true, hostVersion: null, hostReachable: false, remotes: [] };\n }\n\n const hostUrl = bosConfig.app.host.production;\n let hostManifest: RemoteManifest | null = null;\n let hostReason: string | undefined;\n try {\n hostManifest = (await fetchManifest(hostUrl, timeoutMs)) as RemoteManifest;\n } catch (e) {\n hostReason = e instanceof Error ? e.message : String(e);\n }\n\n const hostVersion = hostManifest?.metaData?.pluginVersion ?? null;\n const hostShared = (hostManifest?.shared ?? []).filter(\n (s) => typeof s.requiredVersion === \"string\",\n );\n\n const remotes = listFederationRemotes(bosConfig);\n const settled = await Promise.allSettled(\n remotes.map(async ({ role, url }) => {\n let manifest: RemoteManifest | null = null;\n let reason: string | undefined;\n try {\n manifest = (await fetchManifest(url, timeoutMs)) as RemoteManifest;\n } catch (e) {\n reason = e instanceof Error ? e.message : String(e);\n }\n\n const version = manifest?.metaData?.pluginVersion ?? null;\n const versionOk = version !== null && version === hostVersion;\n\n if (!manifest) {\n return {\n role,\n url,\n reachable: false,\n pluginVersion: null,\n ok: false,\n reason: reason ?? \"unreachable\",\n } satisfies FederationCompatRemote;\n }\n\n if (!versionOk) {\n return {\n role,\n url,\n reachable: true,\n pluginVersion: version,\n ok: false,\n reason: hostVersion\n ? `expected pluginVersion=${hostVersion} (host), got ${version ?? \"missing\"} — redeploy this plugin`\n : `host manifest missing pluginVersion`,\n } satisfies FederationCompatRemote;\n }\n\n const missingShared: string[] = [];\n const mismatchedShared: string[] = [];\n for (const hostDep of hostShared) {\n const remDep = manifest.shared?.find((s) => s.name === hostDep.name);\n if (!remDep) {\n missingShared.push(`${hostDep.name}@${hostDep.requiredVersion}`);\n continue;\n }\n if (!satisfiesConstraint(remDep.version ?? \"\", hostDep.requiredVersion!)) {\n mismatchedShared.push(\n `${hostDep.name}: remote=${remDep.version ?? \"?\"} hostReq=${hostDep.requiredVersion}`,\n );\n }\n if (isEffectCriticalSharedDep(hostDep.name)) {\n const hostVersion = hostDep.version ?? \"\";\n const remoteVersion = remDep.version ?? \"\";\n if (remoteVersion && remoteVersion !== hostVersion) {\n mismatchedShared.push(\n `${hostDep.name}: exact-version skew — remote=${remoteVersion} host=${hostVersion} — bundle was built against a different prerelease build; redeploy host and plugin together`,\n );\n }\n const remoteRequired =\n typeof remDep.requiredVersion === \"string\" ? remDep.requiredVersion.trim() : \"\";\n if (\n remoteRequired.length > 0 &&\n remoteRequired[0] !== \"^\" &&\n !satisfiesConstraint(hostVersion, remoteRequired)\n ) {\n mismatchedShared.push(\n `${hostDep.name}: train skew — host=${hostVersion} vs remote requiredVersion=${remoteRequired}`,\n );\n }\n }\n }\n\n const reasons = [\n ...missingShared.map((d) => `missing shared \"${d}\" required by host`),\n ...mismatchedShared,\n ];\n return {\n role,\n url,\n reachable: true,\n pluginVersion: version,\n ok: reasons.length === 0,\n reason: reasons[0],\n } satisfies FederationCompatRemote;\n }),\n );\n\n const remoteReports = settled.map((s, i) => {\n const placeholder = {\n role: remotes[i]!.role,\n url: remotes[i]!.url,\n reachable: false,\n pluginVersion: null,\n ok: false,\n };\n return s.status === \"fulfilled\" ? s.value : { ...placeholder, reason: String(s.reason) };\n });\n\n const ok =\n hostManifest !== null &&\n remoteReports.every((r) => r.ok && r.reachable && r.pluginVersion !== null);\n\n return {\n ok,\n hostVersion,\n hostReachable: hostManifest !== null,\n hostReason,\n remotes: remoteReports,\n };\n}\n\nexport function loadBosConfigForMfCheck(configPath: string): BosConfig {\n return JSON.parse(readFileSync(configPath, \"utf8\")) as BosConfig;\n}\n"],"mappings":";;;;;;;;;AAUA,IAAI,aAAwC;AAE5C,SAAS,iBAAiB,KAAa,MAAmB,WAAsC;CAC9F,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,QAAQ,iBAAiB,WAAW,MAAM,GAAG,SAAS;CAC5D,OAAO,MAAM,KAAK;EAAE,GAAG;EAAM,QAAQ,WAAW;CAAO,CAAC,CAAC,CAAC,cAAc,aAAa,KAAK,CAAC;AAC7F;AAEA,SAAgB,mCAAmC,IAA8B;CAC/E,IAAI,CAAC,MAAM,CAAE,GAAW,YAAY,WAAW,OAAO,IAAI;CAC1D,IAAK,GAA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AQ,WAAW;GACvB,QAAQ,QAAQ;EAClB;CACF,CAAC,CACH,EAE6B,CAAC,KAAK,GAAG,MAAM;EAC1C,MAAM,cAAc;GAClB,MAAM,QAAQ,EAAE,CAAE;GAClB,KAAK,QAAQ,EAAE,CAAE;GACjB,WAAW;GACX,eAAe;GACf,IAAI;EACN;EACA,OAAO,EAAE,WAAW,cAAc,EAAE,QAAQ;GAAE,GAAG;GAAa,QAAQ,OAAO,EAAE,MAAM;EAAE;CACzF,CAAC;CAMD,OAAO;EACL,IAJA,iBAAiB,QACjB,cAAc,OAAO,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,kBAAkB,IAAI;EAI1E;EACA,eAAe,iBAAiB;EAChC;EACA,SAAS;CACX;AACF;AAEA,SAAgB,wBAAwB,YAA+B;CACrE,OAAO,KAAK,UAAMC,sBAAa,YAAY,MAAM,CAAC;AACpD"}
|
package/dist/mf.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mf.mjs","names":[],"sources":["../src/mf.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createInstance, getInstance } from \"@module-federation/enhanced/runtime\";\nimport { setGlobalFederationInstance } from \"@module-federation/runtime-core\";\nimport { isEffectCriticalSharedDep } from \"every-plugin/build/rspack\";\nimport { readBundleCache, writeBundleCache } from \"./bundle-cache\";\nimport { computeSriHash, type IntegrityRegistry } from \"./integrity\";\nimport type { BosConfig, BosPluginRef } from \"./types\";\n\ntype FederationInstance = ReturnType<typeof createInstance>;\n\nlet mfInstance: FederationInstance | null = null;\n\nfunction fetchWithTimeout(url: string, init: RequestInit, timeoutMs: number): Promise<Response> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n return fetch(url, { ...init, signal: controller.signal }).finally(() => clearTimeout(timer));\n}\n\nexport function patchManifestFetchForSsrPublicPath(mf: FederationInstance): void {\n if (!mf || !(mf as any).loaderHook?.lifecycle?.fetch?.on) return;\n if ((mf as any).__everythingDevPatchedManifestFetch === true) return;\n (mf as any).__everythingDevPatchedManifestFetch = true;\n\n (mf as any).loaderHook.lifecycle.fetch.on((url: unknown, init: unknown) => {\n if (typeof url !== \"string\" || !url.endsWith(\"/mf-manifest.json\")) {\n return;\n }\n return fetchWithTimeout(url as string, init as RequestInit, 15_000)\n .then((res) => res.json())\n .then((json: any) => {\n json.metaData = json.metaData ?? {};\n json.metaData.ssrPublicPath =\n json.metaData.ssrPublicPath ?? url.replace(/\\/mf-manifest\\.json$/, \"/\");\n if (json.metaData.publicPath === \"auto\" || json.metaData.publicPath === \"\") {\n json.metaData.publicPath = \"/\";\n }\n return new Response(JSON.stringify(json), {\n headers: { \"content-type\": \"application/json\" },\n });\n });\n });\n}\n\nexport function installIntegrityFetchHook(\n mf: FederationInstance,\n registry: IntegrityRegistry,\n options?: { cacheDir?: string },\n): void {\n if (!mf || !(mf as any).loaderHook?.lifecycle?.fetch?.on) {\n console.warn(\"[SRI] MF lifecycle fetch hook not available, skipping integrity-in-pipeline\");\n return;\n }\n if ((mf as any).__everythingDevIntegrityHook === true) return;\n (mf as any).__everythingDevIntegrityHook = true;\n\n (mf as any).loaderHook.lifecycle.fetch.on((url: unknown, init: unknown) => {\n if (typeof url !== \"string\") return;\n\n const expectedHash = registry.get(url);\n if (!expectedHash) return;\n\n return fetchWithTimeout(url as string, init as RequestInit, 15_000).then(async (res) => {\n const buffer = Buffer.from(await res.arrayBuffer());\n const computed = computeSriHash(buffer);\n\n if (computed !== expectedHash) {\n // ticket 09 (atomic-deploys): an SRI mismatch is treated like an\n // origin failure — the last-known-good bytes (which satisfied the\n // same pin when cached) serve instead, and the corrupted bytes are\n // never written into the cache.\n const cached = await readBundleCache(url as string, { cacheDir: options?.cacheDir });\n if (cached && computeSriHash(Buffer.from(cached)) === expectedHash) {\n console.warn(\n `[SRI] Origin bytes failed verification for ${url} — serving last-known-good from the bundle cache`,\n );\n return new Response(cached.slice().buffer, {\n status: 200,\n headers: { \"x-bundle-cache\": \"stale\" },\n });\n }\n console.error(\n `[SRI] Integrity check failed in MF fetch pipeline for ${url}\\n Expected: ${expectedHash}\\n Computed: ${computed}`,\n );\n return new Response(`Integrity check failed for ${url}`, {\n status: 500,\n statusText: \"Integrity Check Failed\",\n });\n }\n\n // verified: pin-checked write-through\n await writeBundleCache(url as string, new Uint8Array(buffer), {\n cacheDir: options?.cacheDir,\n }).catch(() => {\n // write-through is best-effort\n });\n\n return new Response(buffer, {\n status: res.status,\n statusText: res.statusText,\n headers: res.headers,\n });\n });\n });\n}\n\nexport function getFederationInstance(): FederationInstance {\n if (mfInstance) return mfInstance;\n\n const existing = getInstance();\n if (existing) {\n mfInstance = existing as FederationInstance;\n setGlobalFederationInstance(mfInstance as any);\n patchManifestFetchForSsrPublicPath(mfInstance);\n return mfInstance;\n }\n\n mfInstance = createInstance({\n name: \"host\",\n remotes: [],\n }) as FederationInstance;\n setGlobalFederationInstance(mfInstance as any);\n patchManifestFetchForSsrPublicPath(mfInstance);\n return mfInstance;\n}\n\nexport async function registerRemote(opts: {\n name: string;\n entry: string;\n type?: \"manifest\" | \"script\";\n}): Promise<void> {\n const instance = getFederationInstance();\n\n const inferType = (): \"manifest\" | \"script\" => {\n if (opts.type) return opts.type;\n if (opts.entry.endsWith(\"/mf-manifest.json\")) return \"manifest\";\n if (/\\/remoteEntry(\\.[a-f0-9]{8,})?\\.js$/.test(opts.entry)) return \"script\";\n return typeof window === \"undefined\" ? \"script\" : \"manifest\";\n };\n\n const remoteType = inferType();\n\n instance.registerRemotes([\n {\n name: opts.name,\n entry: opts.entry,\n type: remoteType,\n },\n ]);\n}\n\nexport async function loadRemoteModule<T>(\n specifier: string,\n options?: { loadFactory?: boolean; from?: \"build\" | \"runtime\" },\n): Promise<T> {\n const instance = getFederationInstance();\n\n const isServer = typeof window === \"undefined\";\n if (isServer) {\n await (instance as any).initializeSharing?.(\"default\");\n }\n\n const mod = await instance.loadRemote<T>(specifier, options as any);\n if (!mod) {\n throw new Error(`Failed to load remote module: ${specifier}`);\n }\n return mod;\n}\n\nexport async function ensureNodeRuntimePlugin(): Promise<void> {\n const instance = getFederationInstance();\n if (typeof window !== \"undefined\") return;\n if ((instance as any).__nodeRuntimePluginLoaded) return;\n\n const mod: any = await import(\"@module-federation/node/runtimePlugin\");\n const factory = mod?.default ?? mod;\n const plugin = typeof factory === \"function\" ? factory() : null;\n if (plugin) {\n instance.registerPlugins([plugin]);\n }\n (instance as any).__nodeRuntimePluginLoaded = true;\n}\n\nexport interface FederationCompatRemote {\n role: string;\n url: string;\n reachable: boolean;\n pluginVersion: string | null;\n ok: boolean;\n reason?: string;\n}\n\nexport interface FederationCompatReport {\n ok: boolean;\n hostVersion: string | null;\n hostReachable: boolean;\n hostReason?: string;\n remotes: FederationCompatRemote[];\n}\n\nfunction parseSemver(v: unknown): { major: number; minor: number; patch: number } | null {\n const m = typeof v === \"string\" ? /^(\\d+)\\.(\\d+)\\.(\\d+)/.exec(v) : null;\n return m ? { major: +m[1]!, minor: +m[2]!, patch: +m[3]! } : null;\n}\n\nfunction satisfiesConstraint(version: string, constraint: string): boolean {\n const trimmed = constraint.trim();\n if (!trimmed) return true;\n if (![\"^\", \"~\", \">\", \"<\", \"=\", \"x\"].some((c) => trimmed.startsWith(c))) {\n return version === trimmed;\n }\n const m = /^\\s*\\^\\s*(\\d+)\\.(\\d+)\\.(\\d+)/.exec(trimmed);\n if (!m) return true;\n const v = parseSemver(version);\n if (!v) return false;\n if (v.major !== +m[1]!) return false;\n if (v.minor < +m[2]! || (v.minor === +m[2]! && v.patch < +m[3]!)) return false;\n const constraintPrerelease = trimmed.match(/-([0-9A-Za-z.-]+)/);\n const versionPrerelease = /-([0-9A-Za-z.-]+)\\s*$/.exec(version);\n if (constraintPrerelease) {\n if (!versionPrerelease) return false;\n const cPre = constraintPrerelease[1]!.split(\".\");\n const vPre = versionPrerelease[1]!.split(\".\");\n for (let i = 0; i < Math.max(cPre.length, vPre.length); i += 1) {\n const c = cPre[i] ?? \"0\";\n const p = vPre[i] ?? \"0\";\n if (c === p) continue;\n const cNum = /^\\d+$/.test(c) ? +c : null;\n const pNum = /^\\d+$/.test(p) ? +p : null;\n if (cNum !== null && pNum !== null) return cNum < pNum;\n return cNum === null ? c.localeCompare(p) < 0 : false;\n }\n return true;\n }\n if (versionPrerelease) return false;\n return true;\n}\n\nfunction manifestUrl(remoteUrl: string): string {\n return remoteUrl.endsWith(\"/\") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;\n}\n\nasync function fetchManifest(url: string, timeoutMs: number): Promise<unknown> {\n const res = await fetch(manifestUrl(url), { signal: AbortSignal.timeout(timeoutMs) });\n if (!res.ok) throw new Error(`HTTP ${res.status} ${res.statusText}`);\n return res.json();\n}\n\nfunction listFederationRemotes(bosConfig: BosConfig): Array<{ role: string; url: string }> {\n const out: Array<{ role: string; url: string }> = [];\n for (const role of [\"api\", \"auth\"] as const) {\n const url = readProductionUrl((bosConfig?.app as Record<string, unknown> | undefined)?.[role]);\n if (url) out.push({ role, url });\n }\n for (const [id, slot] of Object.entries(bosConfig?.plugins ?? {})) {\n const url = readProductionUrl(slot);\n if (url) out.push({ role: id, url });\n }\n return out;\n}\n\nfunction readProductionUrl(entry: unknown): string | null {\n if (typeof entry === \"string\") return entry.length > 0 ? entry : null;\n if (entry && typeof (entry as BosPluginRef).production === \"string\") {\n const url = (entry as BosPluginRef).production!;\n return url.length > 0 ? url : null;\n }\n return null;\n}\n\ninterface RemoteManifest {\n metaData?: { pluginVersion?: string };\n shared?: Array<{ name: string; version?: string; requiredVersion?: string | null }>;\n}\n\nexport async function checkFederationCompat(\n bosConfig: BosConfig | null,\n opts: { timeoutMs?: number } = {},\n): Promise<FederationCompatReport> {\n const timeoutMs = opts.timeoutMs ?? 15_000;\n\n if (!bosConfig?.app?.host?.production) {\n return { ok: true, hostVersion: null, hostReachable: false, remotes: [] };\n }\n\n const hostUrl = bosConfig.app.host.production;\n let hostManifest: RemoteManifest | null = null;\n let hostReason: string | undefined;\n try {\n hostManifest = (await fetchManifest(hostUrl, timeoutMs)) as RemoteManifest;\n } catch (e) {\n hostReason = e instanceof Error ? e.message : String(e);\n }\n\n const hostVersion = hostManifest?.metaData?.pluginVersion ?? null;\n const hostShared = (hostManifest?.shared ?? []).filter(\n (s) => typeof s.requiredVersion === \"string\",\n );\n\n const remotes = listFederationRemotes(bosConfig);\n const settled = await Promise.allSettled(\n remotes.map(async ({ role, url }) => {\n let manifest: RemoteManifest | null = null;\n let reason: string | undefined;\n try {\n manifest = (await fetchManifest(url, timeoutMs)) as RemoteManifest;\n } catch (e) {\n reason = e instanceof Error ? e.message : String(e);\n }\n\n const version = manifest?.metaData?.pluginVersion ?? null;\n const versionOk = version !== null && version === hostVersion;\n\n if (!manifest) {\n return {\n role,\n url,\n reachable: false,\n pluginVersion: null,\n ok: false,\n reason: reason ?? \"unreachable\",\n } satisfies FederationCompatRemote;\n }\n\n if (!versionOk) {\n return {\n role,\n url,\n reachable: true,\n pluginVersion: version,\n ok: false,\n reason: hostVersion\n ? `expected pluginVersion=${hostVersion} (host), got ${version ?? \"missing\"} — redeploy this plugin`\n : `host manifest missing pluginVersion`,\n } satisfies FederationCompatRemote;\n }\n\n const missingShared: string[] = [];\n const mismatchedShared: string[] = [];\n for (const hostDep of hostShared) {\n const remDep = manifest.shared?.find((s) => s.name === hostDep.name);\n if (!remDep) {\n missingShared.push(`${hostDep.name}@${hostDep.requiredVersion}`);\n continue;\n }\n if (!satisfiesConstraint(remDep.version ?? \"\", hostDep.requiredVersion!)) {\n mismatchedShared.push(\n `${hostDep.name}: remote=${remDep.version ?? \"?\"} hostReq=${hostDep.requiredVersion}`,\n );\n }\n if (isEffectCriticalSharedDep(hostDep.name)) {\n const hostVersion = hostDep.version ?? \"\";\n const remoteVersion = remDep.version ?? \"\";\n if (remoteVersion && remoteVersion !== hostVersion) {\n mismatchedShared.push(\n `${hostDep.name}: exact-version skew — remote=${remoteVersion} host=${hostVersion} — bundle was built against a different prerelease build; redeploy host and plugin together`,\n );\n }\n const remoteRequired =\n typeof remDep.requiredVersion === \"string\" ? remDep.requiredVersion.trim() : \"\";\n if (\n remoteRequired.length > 0 &&\n remoteRequired[0] !== \"^\" &&\n !satisfiesConstraint(hostVersion, remoteRequired)\n ) {\n mismatchedShared.push(\n `${hostDep.name}: train skew — host=${hostVersion} vs remote requiredVersion=${remoteRequired}`,\n );\n }\n }\n }\n\n const reasons = [\n ...missingShared.map((d) => `missing shared \"${d}\" required by host`),\n ...mismatchedShared,\n ];\n return {\n role,\n url,\n reachable: true,\n pluginVersion: version,\n ok: reasons.length === 0,\n reason: reasons[0],\n } satisfies FederationCompatRemote;\n }),\n );\n\n const remoteReports = settled.map((s, i) => {\n const placeholder = {\n role: remotes[i]!.role,\n url: remotes[i]!.url,\n reachable: false,\n pluginVersion: null,\n ok: false,\n };\n return s.status === \"fulfilled\" ? s.value : { ...placeholder, reason: String(s.reason) };\n });\n\n const ok =\n hostManifest !== null &&\n remoteReports.every((r) => r.ok && r.reachable && r.pluginVersion !== null);\n\n return {\n ok,\n hostVersion,\n hostReachable: hostManifest !== null,\n hostReason,\n remotes: remoteReports,\n };\n}\n\nexport function loadBosConfigForMfCheck(configPath: string): BosConfig {\n return JSON.parse(readFileSync(configPath, \"utf8\")) as BosConfig;\n}\n"],"mappings":";;;;;;;;AAUA,IAAI,aAAwC;AAE5C,SAAS,iBAAiB,KAAa,MAAmB,WAAsC;CAC9F,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,QAAQ,iBAAiB,WAAW,MAAM,GAAG,SAAS;CAC5D,OAAO,MAAM,KAAK;EAAE,GAAG;EAAM,QAAQ,WAAW;CAAO,CAAC,CAAC,CAAC,cAAc,aAAa,KAAK,CAAC;AAC7F;AAEA,SAAgB,mCAAmC,IAA8B;CAC/E,IAAI,CAAC,MAAM,CAAE,GAAW,YAAY,WAAW,OAAO,IAAI;CAC1D,IAAK,GAAW,wCAAwC,MAAM;CAC9D,AAAC,GAAW,sCAAsC;C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