← Files DataARCHIVED FILE

output_formats/html/scripts/ui-components.mjs

895 Bytes · Nov 19, 2026 · 00:12 UTC

↓ Download file

See the change to this file →

import { lstatSync, readdirSync } from "node:fs";
import { join } from "node:path";

// Charts have their own release archive; these components ship in the app runtime.
export const UI_COMPONENT_GROUPS = Object.freeze(["controls", "tables", "metrics", "layout", "primitives"]);

export function uiComponentFiles(pluginRoot) {
  const files = [];
  function visit(name) {
    const path = join(pluginRoot, name);
    const stat = lstatSync(path);
    if (stat.isSymbolicLink()) throw new Error(`UI component source cannot contain symlinks: ${name}`);
    if (stat.isDirectory()) {
      for (const entry of readdirSync(path).sort()) visit(`${name}/${entry}`);
    } else if (stat.isFile()) files.push(name);
    else throw new Error(`Unsupported UI component source: ${name}`);
  }
  for (const group of UI_COMPONENT_GROUPS) visit(`output_formats/html/src/ui/${group}`);
  return files.sort();
}

SHA-256: b125954f38cafb25967f7d312b131f1b48ba2c3e0a0b6f6608f238d5e7e0532f