mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:00:43 +00:00
29 lines
933 B
TypeScript
29 lines
933 B
TypeScript
import bundledRuntimeSidecarPaths from "../../scripts/lib/bundled-runtime-sidecar-paths.json" with { type: "json" };
|
|
|
|
// Keep this JSON as the root package's runtime sidecar inventory only. Official
|
|
// plugin packages that are excluded from root package files must ship their
|
|
// sidecars from their own npm package-local dist directory instead.
|
|
export function assertUniqueValues<T extends string>(
|
|
values: readonly T[],
|
|
label: string,
|
|
): readonly T[] {
|
|
const seen = new Set<string>();
|
|
const duplicates = new Set<string>();
|
|
for (const value of values) {
|
|
if (seen.has(value)) {
|
|
duplicates.add(value);
|
|
continue;
|
|
}
|
|
seen.add(value);
|
|
}
|
|
if (duplicates.size > 0) {
|
|
throw new Error(`Duplicate ${label}: ${Array.from(duplicates).join(", ")}`);
|
|
}
|
|
return values;
|
|
}
|
|
|
|
export const BUNDLED_RUNTIME_SIDECAR_PATHS = assertUniqueValues(
|
|
bundledRuntimeSidecarPaths,
|
|
"bundled runtime sidecar path",
|
|
);
|