import { readFile } from 'node:fs/promises' import { dirname, relative, resolve as resolvePath } from 'node:path' import type { UserConfig, TsdownPlugin } from 'tsdown' const PLUGIN_ID = 'dsh-brain' const CSS_VIRTUAL_PREFIX = '\0dsh-brain-css:' const CSS_VIRTUAL_SUFFIX = '.mjs' function cssHash(value: string): string { let hash = 2166136261 for (let index = 0; index < value.length; index += 1) { hash ^= value.charCodeAt(index) hash = Math.imul(hash, 16777619) } return (hash >>> 0).toString(36) } /** Minimal CSS-modules inliner: scope class names, inject one