snoop-ui 0.0.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/config.ts","../src/schema/config.ts","../src/scanner/analyze.ts","../src/utils/paths.ts","../src/scanner/resolve.ts","../src/scanner/scan.ts","../src/schema/manifest.ts","../src/schema/common.ts","../src/schema/version.ts","../src/styles/scan.ts","../src/schema/styles.ts","../src/utils/async.ts","../src/utils/globs.ts","../src/styles/css.ts","../src/styles/selector.ts","../src/styles/tailwind.ts","../src/rules/index.ts","../src/schema/diagnostics.ts","../src/scanner/types.ts","../src/scanner/containment.ts","../src/styles/provenance.ts","../src/runtime/protocol.ts","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@snoop-ui/core\",\n \"version\": \"0.0.1\",\n \"private\": true,\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"description\": \"Snoop core: scanner, styles, rules, schemas, protocols\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./schemas/*\": \"./schemas/*\"\n },\n \"files\": [\n \"dist\",\n \"schemas\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:browser\": \"vitest run --config vitest.browser.config.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint .\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"schemas\": \"node scripts/generate-schemas.mjs\",\n \"bundle:size\": \"node scripts/check-bundle-size.mjs\",\n \"docs:links\": \"node scripts/check-docs-links.mjs\",\n \"licenses:check\": \"node scripts/check-licenses.mjs\"\n },\n \"dependencies\": {\n \"@babel/parser\": \"^7.28.5\",\n \"@babel/traverse\": \"^7.28.5\",\n \"@babel/types\": \"^7.28.5\",\n \"cac\": \"^7.1.0\",\n \"jiti\": \"^2.7.0\",\n \"postcss\": \"^8.5.32\",\n \"postcss-selector-parser\": \"^7.2.0\",\n \"postcss-value-parser\": \"^4.2.0\",\n \"react-docgen\": \"^8.0.4\",\n \"react-docgen-typescript\": \"^2.4.0\",\n \"tinyglobby\": \"^0.2.17\",\n \"ws\": \"^8.22.2\",\n \"zod\": \"^4.6.7\"\n },\n \"peerDependencies\": {\n \"react\": \"^18.3.0 || ^19.0.0\",\n \"react-dom\": \"^18.3.0 || ^19.0.0\",\n \"tailwindcss\": \"^3.4.0 || ^4.0.0\",\n \"vite\": \"^7.0.0 || ^8.0.0\"\n },\n \"peerDependenciesMeta\": {\n \"tailwindcss\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.28.5\",\n \"@types/babel__traverse\": \"7.28.0\",\n \"@types/node\": \"^22.20.5\",\n \"@types/react\": \"^19.3.0\",\n \"@types/react-dom\": \"^19.3.0\",\n \"@types/ws\": \"^8.18.2\",\n \"eslint\": \"^10.14.0\",\n \"prettier\": \"^3.10.0\",\n \"react\": \"^19.3.1\",\n \"react-dom\": \"^19.3.1\",\n \"tsup\": \"^9.0.0\",\n \"typescript\": \"^6.0.3\",\n \"typescript-eslint\": \"^8.72.2\",\n \"vitest\": \"^5.1.0\"\n }\n}\n","import { access } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { createJiti } from 'jiti';\nimport { ConfigSchema, type ResolvedConfig, type SnoopConfig } from './schema/config.js';\n\nconst CONFIG_FILES = [\n 'snoop.config.ts',\n 'snoop.config.mts',\n 'snoop.config.js',\n 'snoop.config.mjs',\n 'snoop.config.cjs',\n] as const;\n\nexport interface LoadConfigOptions {\n cwd?: string;\n configFile?: string;\n}\n\nexport function defineConfig(config: SnoopConfig): SnoopConfig {\n return config;\n}\n\nasync function exists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function findConfigFile(options: LoadConfigOptions = {}): Promise<string | undefined> {\n const cwd = options.cwd ?? process.cwd();\n\n if (options.configFile) {\n const candidate = resolve(cwd, options.configFile);\n if (!(await exists(candidate))) {\n throw new Error(`Snoop config not found: ${candidate}`);\n }\n return candidate;\n }\n\n for (const name of CONFIG_FILES) {\n const candidate = resolve(cwd, name);\n if (await exists(candidate)) {\n return candidate;\n }\n }\n\n return undefined;\n}\n\nexport async function loadConfig(options: LoadConfigOptions = {}): Promise<ResolvedConfig> {\n const configFile = await findConfigFile(options);\n\n if (!configFile) {\n return ConfigSchema.parse({});\n }\n\n const jiti = createJiti(import.meta.url, { interopDefault: true });\n\n let loaded: unknown;\n try {\n loaded = await jiti.import(configFile);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load Snoop config at ${configFile}: ${message}`, {\n cause: error,\n });\n }\n\n const raw = isRecord(loaded) && 'default' in loaded ? loaded.default : loaded;\n const result = ConfigSchema.safeParse(raw);\n\n if (!result.success) {\n const details = result.error.issues\n .map((issue) => ` - ${issue.path.join('.') || '(root)'}: ${issue.message}`)\n .join('\\n');\n throw new Error(`Invalid Snoop config at ${configFile}:\\n${details}`);\n }\n\n return result.data;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n","import { z } from 'zod';\n\nexport const RuleSettingSchema = z.enum(['off', 'info', 'warning', 'error']);\nexport type RuleSetting = z.infer<typeof RuleSettingSchema>;\n\nexport const DEFAULT_INCLUDE = ['src/**/*.{jsx,tsx}'] as const;\nexport const DEFAULT_EXCLUDE = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/*.test.{js,jsx,ts,tsx}',\n '**/*.spec.{js,jsx,ts,tsx}',\n '**/*.stories.{js,jsx,ts,tsx}',\n] as const;\n\nexport const ConfigSchema = z.object({\n include: z.array(z.string()).default([...DEFAULT_INCLUDE]),\n exclude: z.array(z.string()).default([...DEFAULT_EXCLUDE]),\n tokens: z.array(z.string()).default([]),\n /**\n * Reserved for isolated previews. Not used by the zero-config MVP.\n */\n providers: z.string().optional(),\n tolerance: z\n .object({\n px: z.number().nonnegative(),\n })\n .default({ px: 1 }),\n baseline: z.string().default('.snoop/baseline.json'),\n basePath: z.string().startsWith('/').default('/ui'),\n appUrl: z.string().default('/'),\n rules: z.record(z.string(), RuleSettingSchema).default({}),\n editor: z.string().optional(),\n});\nexport type SnoopConfig = z.input<typeof ConfigSchema>;\nexport type ResolvedConfig = z.output<typeof ConfigSchema>;\n","import { parse as parseSource } from '@babel/parser';\nimport type { ParserPlugin } from '@babel/parser';\nimport traverseModule from '@babel/traverse';\nimport type { File, JSXAttribute, Node, VariableDeclaration } from '@babel/types';\nimport { ERROR_CODES, builtinResolvers, parse as parseComponents } from 'react-docgen';\nimport type { Documentation, PropDescriptor, TypeDescriptor } from 'react-docgen';\nimport type { Prop, SourceRange } from '../schema/index.js';\nimport { sanitizeMessage } from '../utils/paths.js';\nimport type {\n ComponentAnalysis,\n FileAnalysis,\n ImportBinding,\n JsxUsage,\n InlineStyleAnalysis,\n} from './types.js';\n\n/**\n * `@babel/traverse` ships CommonJS. Depending on how a bundler handles the\n * interop, the default import is either the traverse function itself or a\n * module object with a `default` property.\n */\nconst traverse =\n typeof traverseModule === 'function'\n ? traverseModule\n : (traverseModule as unknown as { default: typeof traverseModule }).default;\n\nexport interface AnalyzeFileOptions {\n absolutePath: string;\n cwd: string;\n file: string;\n hash: string;\n source: string;\n}\n\nexport interface AnalyzeFileResult {\n analysis?: FileAnalysis;\n error?: {\n code: string;\n file: string;\n message: string;\n };\n}\n\ninterface DeclarationInfo {\n name: string;\n node: Node;\n start: number;\n end: number;\n loc: SourceRange;\n}\n\ninterface ModuleInfo {\n declarations: Map<string, DeclarationInfo>;\n exportsByLocal: Map<string, Set<string>>;\n defaultDeclaration?: DeclarationInfo;\n}\n\nconst COMPONENT_EXTENSIONS = new Set([\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n]);\n\nexport function analyzeFile(options: AnalyzeFileOptions): AnalyzeFileResult {\n const { absolutePath, cwd, file, hash, source } = options;\n const extension = absolutePath.slice(absolutePath.lastIndexOf('.'));\n\n let ast;\n try {\n ast = parseSource(source, {\n sourceType: 'unambiguous',\n plugins: parserPlugins(extension),\n attachComment: false,\n errorRecovery: false,\n });\n } catch (error) {\n return {\n error: {\n code: 'parse/syntax',\n file,\n message: sanitizeMessage(\n error instanceof Error ? error.message : 'Unknown syntax error',\n cwd,\n ),\n },\n };\n }\n\n const moduleInfo = collectModuleInfo(ast.program.body);\n const imports = collectImports(ast.program.body);\n const usages = collectJsxUsages(ast);\n const inlineStyles = collectInlineStyles(ast, file);\n\n let docs: Documentation[] = [];\n let docgenError: AnalyzeFileResult['error'];\n\n try {\n docs = parseComponents(source, {\n filename: absolutePath,\n babelOptions: {\n filename: absolutePath,\n babelrc: false,\n configFile: false,\n },\n resolver: new builtinResolvers.FindExportedDefinitionsResolver(),\n });\n } catch (error) {\n if (!isMissingDefinition(error)) {\n docgenError = {\n code: 'parse/components',\n file,\n message: sanitizeMessage(\n error instanceof Error ? error.message : 'Could not extract component metadata',\n cwd,\n ),\n };\n }\n }\n\n const components = buildComponents(docs, moduleInfo);\n\n return {\n analysis: {\n file,\n hash,\n components,\n imports,\n usages,\n inlineStyles,\n },\n ...(docgenError ? { error: docgenError } : {}),\n };\n}\n\nfunction parserPlugins(extension: string): ParserPlugin[] {\n const plugins: ParserPlugin[] = ['jsx', 'decorators-legacy', 'importAttributes'];\n\n if (COMPONENT_EXTENSIONS.has(extension) && extension !== '.js' && extension !== '.jsx') {\n plugins.push('typescript');\n }\n\n return plugins;\n}\n\nfunction collectModuleInfo(body: Node[]): ModuleInfo {\n const declarations = new Map<string, DeclarationInfo>();\n const exportsByLocal = new Map<string, Set<string>>();\n\n const addExport = (localName: string, exportName: string) => {\n const names = exportsByLocal.get(localName) ?? new Set<string>();\n names.add(exportName);\n exportsByLocal.set(localName, names);\n };\n\n const addDeclaration = (name: string, node: Node) => {\n const loc = sourceRange(node);\n if (!loc) {\n return;\n }\n\n if (!declarations.has(name)) {\n declarations.set(name, {\n name,\n node,\n start: node.start ?? 0,\n end: node.end ?? 0,\n loc,\n });\n }\n };\n\n const addVariableDeclaration = (node: VariableDeclaration, exported: boolean) => {\n for (const declarator of node.declarations) {\n if (declarator.id.type !== 'Identifier') {\n continue;\n }\n\n addDeclaration(declarator.id.name, declarator);\n if (exported) {\n addExport(declarator.id.name, declarator.id.name);\n }\n }\n };\n\n let defaultDeclaration: DeclarationInfo | undefined;\n\n for (const statement of body) {\n switch (statement.type) {\n case 'ExportNamedDeclaration': {\n if (statement.exportKind === 'type') {\n break;\n }\n\n const declaration = statement.declaration;\n\n switch (declaration?.type) {\n case 'FunctionDeclaration':\n case 'ClassDeclaration':\n if (declaration.id) {\n addDeclaration(declaration.id.name, declaration);\n addExport(declaration.id.name, declaration.id.name);\n }\n break;\n case 'VariableDeclaration':\n addVariableDeclaration(declaration, true);\n break;\n default:\n break;\n }\n\n for (const specifier of statement.specifiers) {\n if (specifier.type !== 'ExportSpecifier' || specifier.exportKind === 'type') {\n continue;\n }\n\n const localName = identifierName(specifier.local);\n const exportName =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n\n if (localName) {\n addExport(localName, exportName);\n }\n }\n break;\n }\n case 'ExportDefaultDeclaration': {\n const declaration = statement.declaration;\n const loc = sourceRange(declaration);\n if (!loc) {\n break;\n }\n\n const name = declarationName(declaration);\n defaultDeclaration = {\n name: name ?? 'DefaultExport',\n node: declaration,\n start: declaration.start ?? 0,\n end: declaration.end ?? 0,\n loc,\n };\n\n if (name) {\n addExport(name, 'default');\n }\n\n if (\n (declaration.type === 'FunctionDeclaration' || declaration.type === 'ClassDeclaration') &&\n declaration.id\n ) {\n addDeclaration(declaration.id.name, declaration);\n }\n break;\n }\n case 'FunctionDeclaration':\n case 'ClassDeclaration':\n if (statement.id) {\n addDeclaration(statement.id.name, statement);\n }\n break;\n case 'VariableDeclaration':\n addVariableDeclaration(statement, false);\n break;\n default:\n break;\n }\n }\n\n return {\n declarations,\n exportsByLocal,\n ...(defaultDeclaration ? { defaultDeclaration } : {}),\n };\n}\n\nfunction collectImports(body: Node[]): ImportBinding[] {\n const imports: ImportBinding[] = [];\n\n for (const statement of body) {\n if (statement.type !== 'ImportDeclaration' || statement.importKind === 'type') {\n continue;\n }\n\n const source = statement.source.value;\n\n for (const specifier of statement.specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.importKind === 'type') {\n continue;\n }\n\n switch (specifier.type) {\n case 'ImportDefaultSpecifier':\n imports.push({ source, imported: 'default', local: specifier.local.name });\n break;\n case 'ImportNamespaceSpecifier':\n imports.push({ source, imported: '*', local: specifier.local.name });\n break;\n case 'ImportSpecifier': {\n const imported =\n specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value;\n imports.push({ source, imported, local: specifier.local.name });\n break;\n }\n default:\n break;\n }\n }\n }\n\n return imports.sort((a, b) => compare(a.local, b.local));\n}\n\nfunction collectInlineStyles(ast: File, file: string): InlineStyleAnalysis[] {\n const inlineStyles: InlineStyleAnalysis[] = [];\n\n traverse(ast, {\n JSXOpeningElement(path) {\n const name = path.node.name;\n\n if (name.type !== 'JSXIdentifier' || !isIntrinsicName(name.name)) {\n return;\n }\n\n const attribute = path.node.attributes.find(\n (candidate): candidate is JSXAttribute =>\n candidate.type === 'JSXAttribute' &&\n candidate.name.type === 'JSXIdentifier' &&\n candidate.name.name === 'style',\n );\n\n if (!attribute) {\n return;\n }\n\n const range = sourceRange(attribute);\n const line = name.loc?.start.line;\n const col = name.loc ? name.loc.start.column + 1 : 0;\n\n if (!range || !line || col < 1) {\n return;\n }\n\n inlineStyles.push({\n src: `${file}:${line}:${col}`,\n file,\n range,\n confidence: isStaticStyleObject(attribute) ? 'EXTRACTED' : 'INFERRED',\n });\n },\n });\n\n return inlineStyles.sort((a, b) => compare(a.src, b.src));\n}\n\nfunction isStaticStyleObject(attribute: JSXAttribute): boolean {\n const value = attribute.value;\n\n if (value?.type !== 'JSXExpressionContainer') {\n return false;\n }\n\n const expression = value.expression;\n\n return (\n expression.type === 'ObjectExpression' &&\n !expression.properties.some((property) => property.type === 'SpreadElement')\n );\n}\n\nfunction isIntrinsicName(name: string): boolean {\n const first = name.charAt(0);\n return first === first.toLowerCase() && first !== first.toUpperCase();\n}\n\nfunction collectJsxUsages(ast: File): JsxUsage[] {\n const usages: JsxUsage[] = [];\n\n traverse(ast, {\n JSXOpeningElement(path) {\n const name = jsxName(path.node.name);\n if (!name) {\n return;\n }\n\n const loc = sourceRange(path.node);\n if (!loc) {\n return;\n }\n\n usages.push({\n local: name.local,\n ...(name.member ? { member: name.member } : {}),\n start: path.node.start ?? 0,\n loc,\n });\n },\n });\n\n return usages.sort((a, b) => a.start - b.start || compare(a.local, b.local));\n}\n\nfunction buildComponents(docs: Documentation[], moduleInfo: ModuleInfo): ComponentAnalysis[] {\n const matched: Array<{\n start: number;\n component: ComponentAnalysis;\n }> = [];\n const usedNames = new Set<string>();\n\n for (const doc of docs) {\n const displayName = typeof doc.displayName === 'string' ? doc.displayName : undefined;\n let declaration = displayName ? moduleInfo.declarations.get(displayName) : undefined;\n\n if (!declaration && moduleInfo.defaultDeclaration) {\n if (!displayName || docs.length === 1 || moduleInfo.defaultDeclaration.name === displayName) {\n declaration = moduleInfo.defaultDeclaration;\n }\n }\n\n if (!declaration) {\n continue;\n }\n\n const exportNames = new Set(moduleInfo.exportsByLocal.get(declaration.name) ?? []);\n if (moduleInfo.defaultDeclaration?.node === declaration.node) {\n exportNames.add('default');\n }\n\n if (exportNames.size === 0) {\n continue;\n }\n\n const name = uniqueName(declaration.name, usedNames);\n const sortedExports = [...exportNames].sort(compare);\n const exportName = sortedExports.includes('default') ? 'default' : sortedExports[0];\n\n if (!exportName) {\n continue;\n }\n\n matched.push({\n start: declaration.start,\n component: {\n name,\n exportNames: sortedExports,\n loc: declaration.loc,\n start: declaration.start,\n end: declaration.end,\n props: propsFromDoc(doc),\n },\n });\n }\n\n matched.sort((a, b) => a.start - b.start);\n return matched.map((entry) => entry.component);\n}\n\nfunction propsFromDoc(doc: Documentation): Prop[] {\n const props: Prop[] = [];\n\n for (const [name, descriptor] of Object.entries(doc.props ?? {})) {\n const type = typeText(descriptor);\n const defaultValue = descriptor.defaultValue?.value;\n\n props.push({\n name,\n required: Boolean(descriptor.required),\n ...(type ? { type } : {}),\n ...(defaultValue !== undefined && defaultValue !== null\n ? { defaultValue: String(defaultValue) }\n : {}),\n });\n }\n\n return props.sort((a, b) => compare(a.name, b.name));\n}\n\nfunction typeText(descriptor: PropDescriptor): string | undefined {\n return (\n typeDescriptorText(descriptor.tsType) ??\n typeDescriptorText(descriptor.flowType) ??\n propTypeText(descriptor)\n );\n}\n\ninterface NamedTypeDescriptor {\n name?: unknown;\n raw?: unknown;\n value?: unknown;\n}\n\nfunction typeDescriptorText(descriptor: TypeDescriptor<unknown> | undefined): string | undefined {\n if (!descriptor) {\n return undefined;\n }\n\n const candidate = descriptor as NamedTypeDescriptor;\n\n if (typeof candidate.raw === 'string' && candidate.raw.length > 0) {\n return candidate.raw;\n }\n\n if (candidate.name === 'literal' && typeof candidate.value === 'string') {\n return candidate.value;\n }\n\n if (typeof candidate.name === 'string' && candidate.name.length > 0) {\n return candidate.name;\n }\n\n return undefined;\n}\n\nfunction propTypeText(descriptor: PropDescriptor): string | undefined {\n if (!descriptor.type) {\n return undefined;\n }\n\n if (typeof descriptor.type.raw === 'string' && descriptor.type.raw.length > 0) {\n return descriptor.type.raw;\n }\n\n if (typeof descriptor.type.name === 'string') {\n return descriptor.type.name;\n }\n\n return undefined;\n}\n\nfunction jsxName(name: Node): { local: string; member?: string } | undefined {\n if (name.type === 'JSXIdentifier') {\n return isComponentName(name.name) ? { local: name.name } : undefined;\n }\n\n if (\n name.type === 'JSXMemberExpression' &&\n name.object.type === 'JSXIdentifier' &&\n name.property.type === 'JSXIdentifier' &&\n isComponentName(name.object.name)\n ) {\n return { local: name.object.name, member: name.property.name };\n }\n\n return undefined;\n}\n\nfunction isComponentName(name: string): boolean {\n return /^[A-Z]/.test(name);\n}\n\nfunction declarationName(node: Node): string | undefined {\n switch (node.type) {\n case 'Identifier':\n return node.name;\n case 'FunctionDeclaration':\n case 'FunctionExpression':\n case 'ClassDeclaration':\n case 'ClassExpression':\n return node.id?.name;\n case 'CallExpression': {\n const argument = node.arguments[0];\n return argument ? declarationName(argument) : undefined;\n }\n case 'ParenthesizedExpression':\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n case 'TSNonNullExpression':\n case 'TSTypeAssertion':\n return declarationName(node.expression);\n default:\n return undefined;\n }\n}\n\nfunction identifierName(node: Node): string | undefined {\n return node.type === 'Identifier' ? node.name : undefined;\n}\n\nfunction sourceRange(node: Node): SourceRange | undefined {\n if (!node.loc) {\n return;\n }\n\n return {\n start: {\n line: node.loc.start.line,\n col: node.loc.start.column + 1,\n },\n end: {\n line: node.loc.end.line,\n col: node.loc.end.column + 1,\n },\n };\n}\n\nfunction uniqueName(name: string, used: Set<string>): string {\n if (!used.has(name)) {\n used.add(name);\n return name;\n }\n\n let counter = 2;\n while (used.has(`${name}~${counter}`)) {\n counter += 1;\n }\n\n const unique = `${name}~${counter}`;\n used.add(unique);\n return unique;\n}\n\nfunction compare(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nfunction isMissingDefinition(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n error.code === ERROR_CODES.MISSING_DEFINITION\n );\n}\n","import { relative, sep } from 'node:path';\n\nexport function toPosixPath(value: string): string {\n return value.split(sep).join('/');\n}\n\nexport function relativePosix(from: string, to: string): string {\n return toPosixPath(relative(from, to));\n}\n\n/**\n * Keep diagnostics stable across machines by removing the absolute project\n * path from messages.\n */\nexport function sanitizeMessage(message: string, cwd: string): string {\n const firstLine = message.split('\\n')[0] ?? message;\n return firstLine.split(cwd).join('.').split('\\\\').join('/');\n}\n","import { existsSync, statSync } from 'node:fs';\nimport { dirname, extname, resolve } from 'node:path';\nimport { relativePosix } from '../utils/paths.js';\n\nconst RESOLVABLE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.mts', '.mjs', '.cts', '.cjs'];\n\nexport type ImportResolver = (fromFile: string, source: string) => string | undefined;\n\n/**\n * Resolve relative imports to files that are part of the scan. Aliases and\n * package imports intentionally return undefined in M1; the dashboard can add\n * alias support without changing the manifest shape.\n */\nexport function createImportResolver(cwd: string, files: Set<string>): ImportResolver {\n return (fromFile, rawSource) => {\n const source = rawSource.split(/[?#]/)[0] ?? rawSource;\n if (!source) {\n return undefined;\n }\n\n let base: string;\n if (source.startsWith('.')) {\n base = resolve(cwd, dirname(fromFile), source);\n } else if (source.startsWith('/')) {\n base = resolve(cwd, source.slice(1));\n } else {\n return undefined;\n }\n\n const sourceExtension = extname(base);\n if (sourceExtension && !RESOLVABLE_EXTENSIONS.includes(sourceExtension)) {\n return undefined;\n }\n\n const candidates: string[] = [];\n\n if (sourceExtension) {\n candidates.push(base);\n for (const extension of RESOLVABLE_EXTENSIONS) {\n candidates.push(`${base.slice(0, -sourceExtension.length)}${extension}`);\n }\n } else {\n candidates.push(base);\n for (const extension of RESOLVABLE_EXTENSIONS) {\n candidates.push(`${base}${extension}`);\n candidates.push(resolve(base, `index${extension}`));\n }\n }\n\n for (const candidate of candidates) {\n if (!isFile(candidate)) {\n continue;\n }\n\n const relative = relativePosix(cwd, candidate);\n if (files.has(relative)) {\n return relative;\n }\n }\n\n return undefined;\n };\n}\n\nfunction isFile(path: string): boolean {\n if (!existsSync(path)) {\n return false;\n }\n\n try {\n return statSync(path).isFile();\n } catch {\n return false;\n }\n}\n","import { createHash } from 'node:crypto';\nimport { mkdir, readFile, rename, writeFile } from 'node:fs/promises';\nimport { dirname, resolve } from 'node:path';\nimport { glob } from 'tinyglobby';\nimport { ConfigSchema } from '../schema/config.js';\nimport {\n ManifestSchema,\n sortManifest,\n type ComponentNode,\n type Edge,\n type Manifest,\n type ScanError,\n} from '../schema/manifest.js';\nimport { MANIFEST_VERSION } from '../schema/version.js';\nimport { scanStyles } from '../styles/scan.js';\nimport type { StyleIndex } from '../schema/styles.js';\nimport { createRulesEngine } from '../rules/index.js';\nimport {\n DiagnosticsFileSchema,\n sortDiagnostics,\n type DiagnosticsFile,\n} from '../schema/diagnostics.js';\nimport { mapLimit } from '../utils/async.js';\nimport { ALWAYS_IGNORED } from '../utils/globs.js';\nimport { sanitizeMessage, toPosixPath } from '../utils/paths.js';\nimport { analyzeFile } from './analyze.js';\nimport { createImportResolver } from './resolve.js';\nimport {\n SCANNER_CACHE_VERSION,\n ScannerCacheSchema,\n type ComponentAnalysis,\n type FileAnalysis,\n type ScannerCache,\n} from './types.js';\n\nconst CACHE_PATH = '.snoop/cache/scanner.v2.json';\nconst READ_CONCURRENCY = 8;\n\nexport interface ScanProjectOptions {\n cwd?: string;\n include?: string[];\n exclude?: string[];\n /** Extra CSS token files from `snoop.config.ts`. */\n tokens?: string[];\n /** Cache parsed files by content hash. Enabled by default. */\n cache?: boolean;\n /** Resolve Vite CSS Modules class names. The dev plugin supplies this. */\n resolveCssModules?: (files: string[]) => Promise<Record<string, Record<string, string>>>;\n}\n\nexport interface ScanStats {\n files: number;\n parsedFiles: number;\n cachedFiles: number;\n components: number;\n edges: number;\n errors: number;\n}\n\nexport interface ScanResult {\n manifest: Manifest;\n styles: StyleIndex;\n diagnostics: DiagnosticsFile;\n stats: ScanStats;\n}\n\ninterface FileScanResult {\n analysis?: FileAnalysis;\n error?: ScanError;\n cached: boolean;\n parsed: boolean;\n}\n\n/**\n * Scan a project and return a deterministic manifest. Failures are per file:\n * a broken file becomes an entry in `manifest.errors` and never stops the scan.\n */\nexport async function scanProject(options: ScanProjectOptions = {}): Promise<ScanResult> {\n const cwd = resolve(options.cwd ?? process.cwd());\n const defaults = ConfigSchema.parse({});\n const include = options.include ?? defaults.include;\n const exclude = options.exclude ?? defaults.exclude;\n const useCache = options.cache !== false;\n const cachePath = resolve(cwd, CACHE_PATH);\n\n const discovered = await glob(include, {\n cwd,\n ignore: [...exclude, ...ALWAYS_IGNORED],\n absolute: false,\n onlyFiles: true,\n dot: false,\n });\n const files = [...new Set(discovered.map(toPosixPath))].sort(compare);\n const fileSet = new Set(files);\n const cache = useCache ? await readCache(cachePath) : undefined;\n\n const results = await mapLimit<string, FileScanResult>(files, READ_CONCURRENCY, async (file) => {\n const absolutePath = resolve(cwd, file);\n let source: string;\n\n try {\n source = await readFile(absolutePath, 'utf8');\n } catch (error) {\n return {\n error: {\n code: 'scan/read',\n file,\n message: sanitizeMessage(\n error instanceof Error ? error.message : 'Could not read file',\n cwd,\n ),\n } satisfies ScanError,\n cached: false,\n parsed: false,\n };\n }\n\n const hash = hashSource(source);\n const cached = cache?.files[file];\n\n if (cached && cached.hash === hash) {\n return { analysis: cached, cached: true, parsed: false };\n }\n\n const analyzed = analyzeFile({\n absolutePath,\n cwd,\n file,\n hash,\n source,\n });\n\n return {\n ...(analyzed.analysis ? { analysis: analyzed.analysis } : {}),\n ...(analyzed.error ? { error: analyzed.error } : {}),\n cached: false,\n parsed: true,\n };\n });\n\n const analyses = results.flatMap((result) => (result.analysis ? [result.analysis] : []));\n const errors = results.flatMap((result) => (result.error ? [result.error] : []));\n\n if (useCache) {\n await writeCache(cachePath, analyses);\n }\n\n const componentIds = new Map<ComponentAnalysis, string>();\n const componentsByFile = new Map<string, ComponentAnalysis[]>();\n const nodes: ComponentNode[] = [];\n const usedIds = new Set<string>();\n\n for (const analysis of [...analyses].sort((a, b) => compare(a.file, b.file))) {\n componentsByFile.set(analysis.file, analysis.components);\n\n for (const component of analysis.components) {\n const id = uniqueId(`cmp:${analysis.file}#${component.name}`, usedIds);\n const exportName = component.exportNames.includes('default')\n ? 'default'\n : component.exportNames[0];\n\n componentIds.set(component, id);\n nodes.push({\n id,\n kind: 'component',\n name: component.name,\n file: analysis.file,\n ...(exportName ? { exportName } : {}),\n loc: component.loc,\n props: component.props,\n });\n }\n }\n\n const edges = new Map<string, Edge>();\n const addEdge = (\n from: string | undefined,\n to: string | undefined,\n relation: Edge['relation'],\n confidence: Edge['confidence'],\n ) => {\n if (!from || !to) {\n return;\n }\n\n const key = `${from}\\u0000${to}\\u0000${relation}`;\n if (!edges.has(key)) {\n edges.set(key, { from, to, relation, confidence });\n }\n };\n\n const resolveImport = createImportResolver(cwd, fileSet);\n\n for (const analysis of analyses) {\n const components = analysis.components;\n const importTargets = new Map<string, ComponentAnalysis>();\n const namespaceTargets = new Map<string, ComponentAnalysis[]>();\n\n for (const binding of analysis.imports) {\n const targetFile = resolveImport(analysis.file, binding.source);\n if (!targetFile) {\n continue;\n }\n\n const targetComponents = componentsByFile.get(targetFile) ?? [];\n\n if (binding.imported === '*') {\n namespaceTargets.set(binding.local, targetComponents);\n continue;\n }\n\n const target = selectComponent(targetComponents, binding.imported);\n if (target) {\n importTargets.set(binding.local, target);\n }\n }\n\n for (const usage of analysis.usages) {\n const source = containingComponent(components, usage.start);\n if (!source) {\n continue;\n }\n\n let target: ComponentAnalysis | undefined;\n\n if (usage.member) {\n const namespace = namespaceTargets.get(usage.local);\n if (namespace) {\n target = selectComponent(namespace, usage.member);\n }\n } else {\n target =\n components.find((component) => component.name === usage.local) ??\n importTargets.get(usage.local);\n }\n\n addEdge(\n componentIds.get(source),\n target ? componentIds.get(target) : undefined,\n 'renders',\n 'EXTRACTED',\n );\n }\n\n // A single-component module makes a file-level import a meaningful,\n // extracted edge. Multi-component modules rely on JSX usage instead of\n // guessing which sibling imported the dependency.\n if (components.length === 1) {\n const source = components[0];\n if (!source) {\n continue;\n }\n\n for (const target of new Set(importTargets.values())) {\n if (target === source) {\n continue;\n }\n\n const fromId = componentIds.get(source);\n const toId = componentIds.get(target);\n if (!fromId || !toId || hasEdgeBetween(edges, fromId, toId)) {\n continue;\n }\n\n addEdge(fromId, toId, 'imports', 'EXTRACTED');\n }\n }\n }\n\n const styles = await scanStyles({\n cwd,\n ...(options.tokens ? { tokenFiles: options.tokens } : {}),\n exclude,\n inlineStyles: analyses.flatMap((analysis) => analysis.inlineStyles),\n ...(options.resolveCssModules ? { resolveCssModules: options.resolveCssModules } : {}),\n });\n\n const manifest = ManifestSchema.parse(\n sortManifest({\n version: MANIFEST_VERSION,\n tokens: styles.tokens,\n nodes,\n edges: [...edges.values()],\n errors,\n }),\n );\n\n // Run rules to generate diagnostics\n const config = ConfigSchema.parse({\n include,\n exclude,\n ...(options.tokens ? { tokens: options.tokens } : {}),\n });\n const rulesResult = createRulesEngine({ manifest, styleIndex: styles, config });\n const diagnostics = DiagnosticsFileSchema.parse(\n sortDiagnostics({\n version: 1,\n diagnostics: rulesResult.diagnostics,\n }),\n );\n\n return {\n manifest,\n styles,\n diagnostics,\n stats: {\n files: files.length,\n parsedFiles: results.filter((result) => result.parsed).length,\n cachedFiles: results.filter((result) => result.cached).length,\n components: nodes.length,\n edges: edges.size,\n errors: errors.length,\n },\n };\n}\n\nexport async function writeManifest(outPath: string, manifest: Manifest): Promise<void> {\n await mkdir(dirname(outPath), { recursive: true });\n await writeFile(outPath, `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n}\n\nfunction selectComponent(\n components: readonly ComponentAnalysis[],\n imported: string,\n): ComponentAnalysis | undefined {\n return (\n components.find((component) => component.exportNames.includes(imported)) ??\n components.find((component) => component.name === imported)\n );\n}\n\nfunction containingComponent(\n components: readonly ComponentAnalysis[],\n start: number,\n): ComponentAnalysis | undefined {\n let best: ComponentAnalysis | undefined;\n\n for (const component of components) {\n if (start < component.start || start >= component.end) {\n continue;\n }\n\n if (!best || component.end - component.start < best.end - best.start) {\n best = component;\n }\n }\n\n return best;\n}\n\nfunction hasEdgeBetween(edges: Map<string, Edge>, from: string, to: string): boolean {\n const prefix = `${from}\\u0000${to}\\u0000`;\n for (const key of edges.keys()) {\n if (key.startsWith(prefix)) {\n return true;\n }\n }\n return false;\n}\n\nfunction uniqueId(candidate: string, used: Set<string>): string {\n if (!used.has(candidate)) {\n used.add(candidate);\n return candidate;\n }\n\n let counter = 2;\n while (used.has(`${candidate}~${counter}`)) {\n counter += 1;\n }\n\n const unique = `${candidate}~${counter}`;\n used.add(unique);\n return unique;\n}\n\nasync function readCache(path: string): Promise<ScannerCache | undefined> {\n try {\n const raw = await readFile(path, 'utf8');\n const parsed = ScannerCacheSchema.safeParse(JSON.parse(raw));\n return parsed.success ? parsed.data : undefined;\n } catch {\n return undefined;\n }\n}\n\nasync function writeCache(path: string, analyses: readonly FileAnalysis[]): Promise<void> {\n try {\n await mkdir(dirname(path), { recursive: true });\n\n const files: Record<string, FileAnalysis> = {};\n for (const analysis of [...analyses].sort((a, b) => compare(a.file, b.file))) {\n files[analysis.file] = analysis;\n }\n\n const payload: ScannerCache = {\n version: SCANNER_CACHE_VERSION,\n files,\n };\n const temporaryPath = `${path}.tmp`;\n\n await writeFile(temporaryPath, `${JSON.stringify(payload, null, 2)}\\n`, 'utf8');\n await rename(temporaryPath, path);\n } catch {\n // The cache is an optimization. A read-only or full disk must not fail a scan.\n }\n}\n\nfunction hashSource(source: string): string {\n return createHash('sha256').update(source).digest('hex');\n}\n\nfunction compare(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","import { z } from 'zod';\nimport { ConfidenceSchema, PosixPathSchema, RangeSchema, compareStrings } from './common.js';\nimport { MANIFEST_VERSION } from './version.js';\n\nexport const PropSchema = z.object({\n name: z.string().min(1),\n type: z.string().optional(),\n required: z.boolean().default(false),\n defaultValue: z.string().optional(),\n});\nexport type Prop = z.infer<typeof PropSchema>;\n\nexport const ComponentNodeSchema = z.object({\n id: z.string().min(1),\n kind: z.literal('component'),\n name: z.string().min(1),\n file: PosixPathSchema,\n exportName: z.string().optional(),\n loc: RangeSchema.optional(),\n props: z.array(PropSchema).default([]),\n});\nexport type ComponentNode = z.infer<typeof ComponentNodeSchema>;\n\nexport const EdgeRelationSchema = z.enum(['renders', 'imports']);\nexport type EdgeRelation = z.infer<typeof EdgeRelationSchema>;\n\nexport const EdgeSchema = z.object({\n from: z.string().min(1),\n to: z.string().min(1),\n relation: EdgeRelationSchema,\n confidence: ConfidenceSchema,\n});\nexport type Edge = z.infer<typeof EdgeSchema>;\n\nexport const ScanErrorSchema = z.object({\n code: z.string().min(1),\n file: PosixPathSchema,\n message: z.string().min(1),\n});\nexport type ScanError = z.infer<typeof ScanErrorSchema>;\n\nexport const TokenTableSchema = z.record(z.string(), z.string());\nexport type TokenTable = z.infer<typeof TokenTableSchema>;\n\nexport const ManifestSchema = z.object({\n version: z.literal(MANIFEST_VERSION),\n tokens: TokenTableSchema.default({}),\n nodes: z.array(ComponentNodeSchema).default([]),\n edges: z.array(EdgeSchema).default([]),\n errors: z.array(ScanErrorSchema).default([]),\n});\nexport type Manifest = z.infer<typeof ManifestSchema>;\n\n/**\n * Produce deterministic manifest output for golden tests, CI diffs, and\n * reproducible `snoop scan` results.\n */\nexport function sortManifest(manifest: Manifest): Manifest {\n return {\n ...manifest,\n tokens: Object.fromEntries(\n Object.entries(manifest.tokens).sort(([a], [b]) => compareStrings(a, b)),\n ),\n nodes: [...manifest.nodes].sort((a, b) => compareStrings(a.id, b.id)),\n edges: [...manifest.edges].sort((a, b) => {\n const left = `${a.from}\\u0000${a.to}\\u0000${a.relation}`;\n const right = `${b.from}\\u0000${b.to}\\u0000${b.relation}`;\n return compareStrings(left, right);\n }),\n errors: [...manifest.errors].sort((a, b) => {\n const left = `${a.file}\\u0000${a.code}\\u0000${a.message}`;\n const right = `${b.file}\\u0000${b.code}\\u0000${b.message}`;\n return compareStrings(left, right);\n }),\n };\n}\n","import { z } from 'zod';\n\nexport const ConfidenceSchema = z.enum(['EXTRACTED', 'INFERRED']);\nexport type Confidence = z.infer<typeof ConfidenceSchema>;\n\nexport const PositionSchema = z.object({\n line: z.number().int().positive(),\n col: z.number().int().positive(),\n});\nexport type Position = z.infer<typeof PositionSchema>;\n\nexport const RangeSchema = z.object({\n start: PositionSchema,\n end: PositionSchema,\n});\nexport type SourceRange = z.infer<typeof RangeSchema>;\n\nexport const PosixPathSchema = z\n .string()\n .min(1)\n .refine((value) => !value.includes('\\\\'), 'Use POSIX path separators');\nexport type PosixPath = z.infer<typeof PosixPathSchema>;\n\nexport function compareStrings(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","export const MANIFEST_VERSION = 1 as const;\nexport const DIAGNOSTICS_VERSION = 1 as const;\nexport const STYLE_INDEX_VERSION = 1 as const;\n","import { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { glob } from 'tinyglobby';\nimport { ConfigSchema } from '../schema/config.js';\nimport {\n StyleIndexSchema,\n sortStyleIndex,\n type StyleIndex,\n type InlineStyle,\n} from '../schema/styles.js';\nimport { STYLE_INDEX_VERSION } from '../schema/version.js';\nimport { mapLimit } from '../utils/async.js';\nimport { ALWAYS_IGNORED } from '../utils/globs.js';\nimport { sanitizeMessage, toPosixPath } from '../utils/paths.js';\nimport { parseStyleSheet } from './css.js';\nimport { extractTailwindTheme } from './tailwind.js';\n\nconst READ_CONCURRENCY = 8;\n\nexport interface ScanStylesOptions {\n cwd?: string;\n /** Extra token files from `snoop.config.ts`; read even outside `src`. */\n tokenFiles?: readonly string[];\n exclude?: readonly string[];\n /** Inline `style` props found by the component scanner. */\n inlineStyles?: readonly InlineStyle[];\n /**\n * Resolve Vite's CSS Modules class names for module files. The plugin\n * supplies this; the CLI leaves it out and keeps original selectors.\n */\n resolveCssModules?: (files: string[]) => Promise<Record<string, Record<string, string>>>;\n}\n\n/** Scan CSS and build the static half of style provenance. */\nexport async function scanStyles(options: ScanStylesOptions = {}): Promise<StyleIndex> {\n const cwd = resolve(options.cwd ?? process.cwd());\n const defaults = ConfigSchema.parse({});\n const exclude = options.exclude ?? defaults.exclude;\n\n const discovered = await glob('**/*.css', {\n cwd,\n ignore: [...exclude, ...ALWAYS_IGNORED],\n absolute: false,\n onlyFiles: true,\n dot: false,\n });\n\n const files = new Set([...discovered.map(toPosixPath), ...tokenFiles(cwd, options.tokenFiles)]);\n const sortedFiles = [...files].sort(compare);\n const moduleFiles = sortedFiles.filter((file) => file.endsWith('.module.css'));\n const errors: StyleIndex['errors'] = [];\n\n let classMaps: Record<string, Record<string, string>> = {};\n\n if (moduleFiles.length > 0 && options.resolveCssModules) {\n try {\n classMaps = await options.resolveCssModules(moduleFiles);\n } catch (error) {\n errors.push({\n code: 'style/modules',\n file: moduleFiles[0] ?? 'src',\n message: sanitizeMessage(\n error instanceof Error ? error.message : 'Could not resolve CSS Modules',\n cwd,\n ),\n });\n }\n }\n\n const parsed = await mapLimit(sortedFiles, READ_CONCURRENCY, async (file) => {\n const absolutePath = resolve(cwd, file);\n\n try {\n const source = await readFile(absolutePath, 'utf8');\n return {\n file,\n result: parseStyleSheet(file, source, {\n ...(classMaps[file] ? { classMap: classMaps[file] } : {}),\n }),\n };\n } catch (error) {\n errors.push({\n code: 'style/parse',\n file,\n message: sanitizeMessage(\n error instanceof Error ? error.message : 'Could not parse CSS',\n cwd,\n ),\n });\n return undefined;\n }\n });\n\n const tailwind = await extractTailwindTheme(cwd);\n errors.push(...tailwind.errors);\n\n const tokens: Record<string, string> = { ...tailwind.tokens };\n const rules: StyleIndex['rules'] = [];\n let usesTailwind = tailwind.found;\n\n for (const entry of parsed) {\n if (!entry) {\n continue;\n }\n\n rules.push(...entry.result.rules);\n Object.assign(tokens, entry.result.tokens);\n usesTailwind = usesTailwind || entry.result.tailwind || entry.result.theme;\n }\n\n return StyleIndexSchema.parse(\n sortStyleIndex({\n version: STYLE_INDEX_VERSION,\n tokens,\n rules,\n inlineStyles: [...(options.inlineStyles ?? [])],\n tailwind: usesTailwind,\n errors,\n }),\n );\n}\n\nfunction tokenFiles(cwd: string, entries: readonly string[] | undefined): string[] {\n if (!entries) {\n return [];\n }\n\n return entries\n .map((entry) => toPosixPath(relative(cwd, resolve(cwd, entry))))\n .filter((entry) => entry.length > 0);\n}\n\nfunction compare(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","import { z } from 'zod';\nimport { ConfidenceSchema, PosixPathSchema, RangeSchema, compareStrings } from './common.js';\nimport { STYLE_INDEX_VERSION } from './version.js';\n\nexport const StyleDeclarationSchema = z.object({\n property: z.string().min(1),\n value: z.string(),\n important: z.boolean().default(false),\n line: z.number().int().positive(),\n col: z.number().int().positive(),\n});\nexport type StyleDeclaration = z.infer<typeof StyleDeclarationSchema>;\n\nexport const StyleRuleSchema = z.object({\n file: PosixPathSchema,\n /** The selector exactly as written in the source file, normalized for lookup. */\n selector: z.string().min(1),\n /**\n * The selector the browser matches after CSS Modules rename classes. Absent\n * when it is identical to `selector`.\n */\n runtimeSelector: z.string().min(1).optional(),\n declarations: z.array(StyleDeclarationSchema).default([]),\n /** Enclosing conditional at-rules, outermost first, for example `@media (...)` */\n atRules: z.array(z.string()).default([]),\n /** True when the rule comes from a `*.module.css` file. */\n module: z.boolean().default(false),\n line: z.number().int().positive(),\n col: z.number().int().positive(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\nexport const InlineStyleSchema = z.object({\n /** `file:line:col` of the JSX element, matching `data-snoop-src`. */\n src: z.string().min(1),\n file: PosixPathSchema,\n range: RangeSchema,\n /** EXTRACTED for an object literal, INFERRED for a spread or expression. */\n confidence: ConfidenceSchema,\n});\nexport type InlineStyle = z.infer<typeof InlineStyleSchema>;\n\nexport const StyleErrorSchema = z.object({\n code: z.string().min(1),\n file: PosixPathSchema,\n message: z.string().min(1),\n});\nexport type StyleError = z.infer<typeof StyleErrorSchema>;\n\n/**\n * Static style knowledge served alongside the manifest. It is not part of the\n * manifest artifact: the browser CSSOM remains the source of truth for values,\n * and this index only supplies file/line provenance and tokens.\n */\nexport const StyleIndexSchema = z.object({\n version: z.literal(STYLE_INDEX_VERSION),\n tokens: z.record(z.string(), z.string()).default({}),\n rules: z.array(StyleRuleSchema).default([]),\n inlineStyles: z.array(InlineStyleSchema).default([]),\n /** True when the project uses Tailwind classes or a Tailwind config. */\n tailwind: z.boolean().default(false),\n errors: z.array(StyleErrorSchema).default([]),\n});\nexport type StyleIndex = z.infer<typeof StyleIndexSchema>;\n\nexport function sortStyleIndex(index: StyleIndex): StyleIndex {\n return {\n ...index,\n tokens: Object.fromEntries(\n Object.entries(index.tokens).sort(([a], [b]) => compareStrings(a, b)),\n ),\n rules: [...index.rules].sort((a, b) => {\n const left = `${a.file}\\u0000${String(a.line).padStart(8, '0')}\\u0000${String(a.col).padStart(4, '0')}\\u0000${a.selector}\\u0000${a.runtimeSelector ?? ''}`;\n const right = `${b.file}\\u0000${String(b.line).padStart(8, '0')}\\u0000${String(b.col).padStart(4, '0')}\\u0000${b.selector}\\u0000${b.runtimeSelector ?? ''}`;\n return compareStrings(left, right);\n }),\n inlineStyles: [...index.inlineStyles].sort((a, b) => compareStrings(a.src, b.src)),\n errors: [...index.errors].sort((a, b) => {\n const left = `${a.file}\\u0000${a.code}\\u0000${a.message}`;\n const right = `${b.file}\\u0000${b.code}\\u0000${b.message}`;\n return compareStrings(left, right);\n }),\n };\n}\n","export async function mapLimit<T, R>(\n items: readonly T[],\n limit: number,\n task: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let nextIndex = 0;\n\n const workerCount = Math.max(1, Math.min(limit, items.length));\n const workers = Array.from({ length: workerCount }, async () => {\n while (true) {\n const index = nextIndex;\n nextIndex += 1;\n\n if (index >= items.length) {\n return;\n }\n\n const item = items[index];\n if (item === undefined) {\n return;\n }\n\n results[index] = await task(item, index);\n }\n });\n\n await Promise.all(workers);\n return results;\n}\n","/**\n * Directories that never contain project source. Both the component scanner\n * and the style scanner share the list so a build artifact cannot become a\n * component or a token by accident.\n */\nexport const ALWAYS_IGNORED = [\n '.snoop/**',\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/coverage/**',\n] as const;\n","import postcss, {\n type AtRule,\n type ChildNode,\n type Container,\n type Declaration,\n type Document,\n type Rule,\n} from 'postcss';\nimport selectorParser from 'postcss-selector-parser';\nimport { normalizeSelector } from './selector.js';\nimport type { StyleDeclaration, StyleRule } from '../schema/styles.js';\n\nexport interface ParseStyleSheetOptions {\n /** Generated class name -> original class name, from Vite's CSS Modules output. */\n classMap?: Record<string, string>;\n}\n\nexport interface ParsedStyleSheet {\n rules: StyleRule[];\n /** CSS custom properties found in the sheet, including `@theme` values. */\n tokens: Record<string, string>;\n /** The sheet references Tailwind (`@tailwind` or `@import \"tailwindcss\"`). */\n tailwind: boolean;\n /** The sheet declares a Tailwind v4 `@theme` block. */\n theme: boolean;\n}\n\n/**\n * Parse one stylesheet into the static style index. The browser CSSOM remains\n * the source of truth for computed values; this only records where a rule and\n * its declarations live in source.\n */\nexport function parseStyleSheet(\n file: string,\n source: string,\n options: ParseStyleSheetOptions = {},\n): ParsedStyleSheet {\n const root = postcss.parse(source, { from: file });\n const rules: StyleRule[] = [];\n const tokens: Record<string, string> = {};\n let tailwind = false;\n let theme = false;\n\n root.walkAtRules((atRule) => {\n if (atRule.name === 'tailwind') {\n tailwind = true;\n }\n\n if (atRule.name === 'theme') {\n theme = true;\n }\n\n if (atRule.name === 'import' && /(^|[\"'\\s])tailwindcss(\\/|[\"'\\s]|$)/.test(atRule.params)) {\n tailwind = true;\n }\n });\n\n root.walkDecls((declaration) => {\n if (declaration.prop.startsWith('--')) {\n tokens[declaration.prop] = declaration.value.trim();\n }\n });\n\n root.walkRules((rule) => {\n if (isKeyframeRule(rule)) {\n return;\n }\n\n const selector = normalizeSelector(rule.selector);\n\n if (!selector) {\n return;\n }\n\n const declarations = directDeclarations(rule);\n\n if (declarations.length === 0) {\n return;\n }\n\n const runtimeSelector = options.classMap\n ? rewriteClasses(selector, options.classMap)\n : undefined;\n const normalizedRuntime = runtimeSelector ? normalizeSelector(runtimeSelector) : undefined;\n\n rules.push({\n file,\n selector,\n ...(normalizedRuntime && normalizedRuntime !== selector\n ? { runtimeSelector: normalizedRuntime }\n : {}),\n declarations,\n atRules: enclosingAtRules(rule),\n module: file.endsWith('.module.css'),\n line: rule.source?.start?.line ?? 1,\n col: rule.source?.start?.column ?? 1,\n });\n });\n\n return { rules, tokens, tailwind, theme };\n}\n\n/** Walk up the tree to the conditional at-rule wrappers around a rule. */\nfunction enclosingAtRules(node: ChildNode): string[] {\n const atRules: string[] = [];\n let parent: Container | Document | undefined = node.parent;\n\n while (parent) {\n if (parent.type === 'atrule') {\n const atRule = parent as AtRule;\n\n if (atRule.name === 'media' || atRule.name === 'supports' || atRule.name === 'container') {\n atRules.unshift(`@${atRule.name} ${atRule.params}`);\n } else if (atRule.name === 'layer') {\n atRules.unshift(`@layer ${atRule.params}`);\n }\n }\n\n parent = parent.parent;\n }\n\n return atRules;\n}\n\nfunction directDeclarations(rule: Rule): StyleDeclaration[] {\n const declarations: StyleDeclaration[] = [];\n\n for (const node of rule.nodes ?? []) {\n if (node.type !== 'decl') {\n continue;\n }\n\n const declaration = node as Declaration;\n\n if (declaration.prop === 'composes') {\n continue;\n }\n\n declarations.push({\n property: declaration.prop,\n value: declaration.value,\n important: declaration.important ?? false,\n line: declaration.source?.start?.line ?? rule.source?.start?.line ?? 1,\n col: declaration.source?.start?.column ?? rule.source?.start?.column ?? 1,\n });\n }\n\n return declarations;\n}\n\nfunction isKeyframeRule(rule: Rule): boolean {\n let parent: Container | Document | undefined = rule.parent;\n\n while (parent) {\n if (parent.type === 'atrule') {\n const name = (parent as AtRule).name.toLowerCase();\n if (name === 'keyframes' || name.endsWith('-keyframes')) {\n return true;\n }\n }\n\n parent = parent.parent;\n }\n\n return false;\n}\n\n/** Rename classes in a selector using Vite's generated CSS Modules names. */\nexport function rewriteClasses(selector: string, classMap: Record<string, string>): string {\n try {\n return selectorParser((root) => {\n root.walkClasses((node) => {\n const replacement = classMap[node.value];\n if (replacement) {\n node.value = replacement;\n }\n });\n }).processSync(selector);\n } catch {\n return selector;\n }\n}\n","/**\n * Selector helpers shared by the static CSS parser and the dashboard. They are\n * deliberately dependency-free so they can run in the browser dashboard and in\n * the Node tests without pulling PostCSS into the client bundle.\n */\nexport interface Specificity {\n id: number;\n class: number;\n type: number;\n}\n\n/**\n * Normalize a selector list for lookup. Whitespace and spaces around\n * combinators are insignificant, but the contents of strings, attribute\n * selectors, and pseudo-class arguments are preserved.\n */\nexport function normalizeSelector(selector: string): string {\n return splitSelectorList(selector)\n .map(normalizeComplexSelector)\n .filter((part) => part.length > 0)\n .join(', ');\n}\n\n/** Split a selector list on top-level commas, ignoring commas in functions. */\nexport function splitSelectorList(selector: string): string[] {\n const parts: string[] = [];\n let current = '';\n let quote: string | undefined;\n let brackets = 0;\n let parentheses = 0;\n\n for (let index = 0; index < selector.length; index += 1) {\n const character = selector[index] as string;\n\n if (quote) {\n current += character;\n if (character === '\\\\') {\n const next = selector[index + 1];\n if (next !== undefined) {\n current += next;\n index += 1;\n }\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n quote = character;\n current += character;\n continue;\n }\n\n if (character === '[') {\n brackets += 1;\n } else if (character === ']') {\n brackets = Math.max(0, brackets - 1);\n } else if (character === '(') {\n parentheses += 1;\n } else if (character === ')') {\n parentheses = Math.max(0, parentheses - 1);\n }\n\n if (character === ',' && brackets === 0 && parentheses === 0) {\n parts.push(current);\n current = '';\n continue;\n }\n\n current += character;\n }\n\n parts.push(current);\n return parts;\n}\n\nfunction normalizeComplexSelector(selector: string): string {\n let output = '';\n let quote: string | undefined;\n let brackets = 0;\n let parentheses = 0;\n let pendingSpace = false;\n\n const flushSpace = () => {\n if (pendingSpace && output.length > 0 && !/[\\s>+~|]$/.test(output)) {\n output += ' ';\n }\n pendingSpace = false;\n };\n\n for (let index = 0; index < selector.length; index += 1) {\n const character = selector[index] as string;\n\n if (quote) {\n output += character;\n if (character === '\\\\') {\n const next = selector[index + 1];\n if (next !== undefined) {\n output += next;\n index += 1;\n }\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n flushSpace();\n quote = character;\n output += character;\n continue;\n }\n\n if (character === '[') {\n flushSpace();\n brackets += 1;\n output += character;\n continue;\n }\n\n if (character === ']') {\n brackets = Math.max(0, brackets - 1);\n output += character;\n continue;\n }\n\n if (character === '(') {\n flushSpace();\n parentheses += 1;\n output += character;\n continue;\n }\n\n if (character === ')') {\n parentheses = Math.max(0, parentheses - 1);\n output += character;\n continue;\n }\n\n if (brackets > 0 || parentheses > 0) {\n output += character;\n continue;\n }\n\n if (/\\s/.test(character)) {\n pendingSpace = true;\n continue;\n }\n\n if (character === '>' || character === '+' || character === '~') {\n output = output.replace(/\\s+$/, '');\n output += character;\n pendingSpace = false;\n continue;\n }\n\n if (character === '|' && selector[index + 1] === '|') {\n output = output.replace(/\\s+$/, '');\n output += '||';\n pendingSpace = false;\n index += 1;\n continue;\n }\n\n flushSpace();\n output += character;\n }\n\n return output.trim();\n}\n\nconst LEGACY_PSEUDO_ELEMENTS = new Set(['before', 'after', 'first-line', 'first-letter']);\n\n/**\n * Compute selector specificity with a small, dependency-free parser. The\n * cascade only needs the values to be ordered correctly; this follows the\n * Selectors Level 4 rules for `:is`, `:not`, `:has`, `:where`, and\n * `:nth-child(… of …)`.\n */\nexport function specificityOf(selector: string): Specificity {\n let best: Specificity = { id: 0, class: 0, type: 0 };\n\n for (const part of splitSelectorList(selector)) {\n const value = specificityOfComplexSelector(part);\n if (compareSpecificity(value, best) > 0) {\n best = value;\n }\n }\n\n return best;\n}\n\nexport function compareSpecificity(a: Specificity, b: Specificity): number {\n return a.id - b.id || a.class - b.class || a.type - b.type;\n}\n\nfunction specificityOfComplexSelector(selector: string): Specificity {\n const result: Specificity = { id: 0, class: 0, type: 0 };\n let index = 0;\n\n while (index < selector.length) {\n const character = selector[index] as string;\n\n if (/\\s/.test(character) || character === '>' || character === '+' || character === '~') {\n index += 1;\n continue;\n }\n\n if (character === ',' || character === '*') {\n index += 1;\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n index = skipString(selector, index);\n continue;\n }\n\n if (character === '[') {\n result.class += 1;\n index = skipBalanced(selector, index, '[', ']');\n continue;\n }\n\n if (character === '#') {\n result.id += 1;\n index = skipIdentifier(selector, index + 1);\n continue;\n }\n\n if (character === '.') {\n result.class += 1;\n index = skipIdentifier(selector, index + 1);\n continue;\n }\n\n if (character === ':') {\n const doubleColon = selector[index + 1] === ':';\n const nameStart = index + (doubleColon ? 2 : 1);\n const nameEnd = skipIdentifier(selector, nameStart);\n const name = selector.slice(nameStart, nameEnd).toLowerCase();\n\n if (doubleColon || LEGACY_PSEUDO_ELEMENTS.has(name)) {\n result.type += 1;\n index = nameEnd;\n if (selector[index] === '(') {\n index = skipBalanced(selector, index, '(', ')');\n }\n continue;\n }\n\n if (selector[nameEnd] === '(') {\n const argumentEnd = skipBalanced(selector, nameEnd, '(', ')');\n const argument = selector.slice(nameEnd + 1, argumentEnd - 1);\n\n if (name === 'where') {\n // Zero specificity, including the arguments.\n } else if (name === 'is' || name === 'not' || name === 'has') {\n addInPlace(result, maxSpecificity(argument));\n } else if (name === 'nth-child' || name === 'nth-last-child') {\n result.class += 1;\n const ofIndex = findNthOf(argument);\n if (ofIndex >= 0) {\n addInPlace(result, maxSpecificity(argument.slice(ofIndex)));\n }\n } else {\n result.class += 1;\n }\n\n index = argumentEnd;\n continue;\n }\n\n result.class += 1;\n index = nameEnd;\n continue;\n }\n\n if (character === '\\\\') {\n result.type += 1;\n index = skipIdentifier(selector, index);\n continue;\n }\n\n if (character === '&') {\n index += 1;\n continue;\n }\n\n if (isIdentifierStart(character)) {\n const end = skipIdentifier(selector, index);\n // A namespace prefix (`svg|rect`) is not an element of its own.\n if (selector[end] === '|' && selector[end + 1] !== '|') {\n index = end + 1;\n continue;\n }\n\n result.type += 1;\n index = end;\n continue;\n }\n\n index += 1;\n }\n\n return result;\n}\n\nfunction maxSpecificity(selectorList: string): Specificity {\n let best: Specificity = { id: 0, class: 0, type: 0 };\n\n for (const part of splitSelectorList(selectorList)) {\n const value = specificityOfComplexSelector(part);\n if (compareSpecificity(value, best) > 0) {\n best = value;\n }\n }\n\n return best;\n}\n\nfunction addInPlace(target: Specificity, value: Specificity): void {\n target.id += value.id;\n target.class += value.class;\n target.type += value.type;\n}\n\n/** Find the top-level `of` keyword in an `:nth-child(… of …)` argument. */\nfunction findNthOf(argument: string): number {\n let quote: string | undefined;\n let brackets = 0;\n let parentheses = 0;\n\n for (let index = 0; index < argument.length; index += 1) {\n const character = argument[index] as string;\n\n if (quote) {\n if (character === '\\\\') {\n index += 1;\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n\n if (character === '[') {\n brackets += 1;\n } else if (character === ']') {\n brackets = Math.max(0, brackets - 1);\n } else if (character === '(') {\n parentheses += 1;\n } else if (character === ')') {\n parentheses = Math.max(0, parentheses - 1);\n } else if (\n brackets === 0 &&\n parentheses === 0 &&\n character.toLowerCase() === 'o' &&\n argument[index + 1]?.toLowerCase() === 'f' &&\n /\\s/.test(argument[index - 1] ?? ' ') &&\n /[\\s.:#[]/.test(argument[index + 2] ?? ' ')\n ) {\n return index + 2;\n }\n }\n\n return -1;\n}\n\nfunction skipString(value: string, start: number): number {\n const quote = value[start];\n let index = start + 1;\n\n while (index < value.length) {\n if (value[index] === '\\\\') {\n index += 2;\n continue;\n }\n\n if (value[index] === quote) {\n return index + 1;\n }\n\n index += 1;\n }\n\n return value.length;\n}\n\nfunction skipBalanced(value: string, start: number, open: string, close: string): number {\n let depth = 0;\n let quote: string | undefined;\n\n for (let index = start; index < value.length; index += 1) {\n const character = value[index] as string;\n\n if (quote) {\n if (character === '\\\\') {\n index += 1;\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n\n if (character === open) {\n depth += 1;\n } else if (character === close) {\n depth -= 1;\n if (depth === 0) {\n return index + 1;\n }\n }\n }\n\n return value.length;\n}\n\nfunction skipIdentifier(value: string, start: number): number {\n let index = start;\n\n while (index < value.length) {\n const character = value[index] as string;\n\n if (character === '\\\\') {\n index += 2;\n continue;\n }\n\n if (!isIdentifierCharacter(character)) {\n return index;\n }\n\n index += 1;\n }\n\n return index;\n}\n\nfunction isIdentifierStart(character: string): boolean {\n return /[a-zA-Z_\\u0080-\\uffff-]/.test(character);\n}\n\nfunction isIdentifierCharacter(character: string): boolean {\n return /[a-zA-Z0-9_\\u0080-\\uffff-]/.test(character);\n}\n","import { existsSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { resolve } from 'node:path';\nimport { createJiti } from 'jiti';\nimport { sanitizeMessage } from '../utils/paths.js';\nimport type { StyleError } from '../schema/styles.js';\n\nconst CONFIG_FILES = [\n 'tailwind.config.js',\n 'tailwind.config.cjs',\n 'tailwind.config.mjs',\n 'tailwind.config.ts',\n 'tailwind.config.cts',\n 'tailwind.config.mts',\n] as const;\n\n/**\n * Tailwind theme categories that map cleanly to CSS variables. Anything not\n * listed here is skipped: inventing token names for every Tailwind default\n * would drown the real project values.\n */\nconst CATEGORY_PREFIXES: Record<string, string> = {\n colors: '--color',\n spacing: '--spacing',\n borderRadius: '--radius',\n fontSize: '--text',\n fontFamily: '--font',\n fontWeight: '--font-weight',\n boxShadow: '--shadow',\n screens: '--breakpoint',\n transitionDuration: '--duration',\n transitionTimingFunction: '--ease',\n letterSpacing: '--tracking',\n lineHeight: '--leading',\n maxWidth: '--container',\n};\n\nexport interface TailwindThemeResult {\n tokens: Record<string, string>;\n found: boolean;\n errors: StyleError[];\n}\n\n/**\n * Read Tailwind v3 theme values through Tailwind's own `resolveConfig` and keep\n * only values the project changed from the default theme. Tailwind v4 values\n * arrive as CSS custom properties from `@theme` and are collected by the CSS\n * parser instead.\n */\nexport async function extractTailwindTheme(cwd: string): Promise<TailwindThemeResult> {\n const configFile = CONFIG_FILES.map((name) => resolve(cwd, name)).find((path) =>\n existsSync(path),\n );\n\n if (!configFile) {\n return { tokens: {}, found: false, errors: [] };\n }\n\n try {\n const require = createRequire(resolve(cwd, 'package.json'));\n const resolveConfig = require('tailwindcss/resolveConfig') as (config: unknown) => {\n theme: Record<string, unknown>;\n };\n const defaultConfig = require('tailwindcss/defaultConfig') as unknown;\n\n const jiti = createJiti(import.meta.url, { interopDefault: true });\n const loaded = (await jiti.import(configFile)) as unknown;\n const userConfig = isRecord(loaded) && 'default' in loaded ? loaded.default : loaded;\n\n const resolved = resolveConfig(userConfig);\n const defaults = resolveConfig(defaultConfig);\n const tokens: Record<string, string> = {};\n\n for (const [category, prefix] of Object.entries(CATEGORY_PREFIXES)) {\n const projectValues = flattenCategory(resolved.theme[category]);\n const defaultValues = flattenCategory(defaults.theme[category]);\n\n for (const [path, value] of projectValues) {\n if (defaultValues.get(path) === value) {\n continue;\n }\n\n tokens[`${prefix}-${tokenName(path)}`] = value;\n }\n }\n\n return { tokens, found: true, errors: [] };\n } catch (error) {\n return {\n tokens: {},\n found: true,\n errors: [\n {\n code: 'style/tailwind',\n file: toRelative(cwd, configFile),\n message: sanitizeMessage(\n error instanceof Error ? error.message : 'Could not resolve the Tailwind theme',\n cwd,\n ),\n },\n ],\n };\n }\n}\n\nfunction flattenCategory(value: unknown): Map<string, string> {\n const result = new Map<string, string>();\n flatten(value, [], result);\n return result;\n}\n\nfunction flatten(value: unknown, path: string[], result: Map<string, string>): void {\n if (value === null || value === undefined) {\n return;\n }\n\n if (Array.isArray(value)) {\n const strings = value.filter((entry): entry is string => typeof entry === 'string');\n if (strings.length > 0) {\n result.set(path.join('.'), strings.join(', '));\n }\n return;\n }\n\n if (typeof value === 'object') {\n for (const [key, child] of Object.entries(value)) {\n flatten(child, [...path, key], result);\n }\n return;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n result.set(path.join('.'), String(value));\n }\n}\n\nfunction tokenName(path: string): string {\n return path\n .split('.')\n .filter((part) => part !== 'DEFAULT')\n .map((part) =>\n part\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[^a-zA-Z0-9-]+/g, '-')\n .toLowerCase(),\n )\n .filter((part) => part.length > 0)\n .join('-');\n}\n\nfunction toRelative(cwd: string, file: string): string {\n return file\n .slice(cwd.length + 1)\n .split('\\\\')\n .join('/');\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n","import type { Manifest } from '../schema/manifest.js';\nimport type { StyleIndex } from '../schema/styles.js';\nimport type { ResolvedConfig } from '../schema/config.js';\nimport type { Diagnostic } from '../schema/diagnostics.js';\n\nexport type RuleName = 'token/hardcoded-match' | 'token/near-match' | 'token/undefined-var';\n\nexport interface RuleContext {\n manifest: Manifest;\n styleIndex: StyleIndex;\n config: ResolvedConfig;\n}\n\nexport interface RuleResult {\n diagnostics: Diagnostic[];\n}\n\nexport type Rule = (context: RuleContext) => RuleResult;\n\nexport const RULE_NAMES: RuleName[] = [\n 'token/hardcoded-match',\n 'token/near-match',\n 'token/undefined-var',\n];\n\nexport function createRulesEngine(\n context: RuleContext,\n enabled: Partial<Record<RuleName, boolean>> = {},\n): RuleResult {\n const allDiagnostics: Diagnostic[] = [];\n\n // Hardcoded token match\n if (enabled['token/hardcoded-match'] !== false) {\n allDiagnostics.push(...runHardcodedTokenMatch(context).diagnostics);\n }\n\n // Near token match\n if (enabled['token/near-match'] !== false) {\n allDiagnostics.push(...runNearTokenMatch(context).diagnostics);\n }\n\n // Undefined CSS variable\n if (enabled['token/undefined-var'] !== false) {\n allDiagnostics.push(...runUndefinedCssVar(context).diagnostics);\n }\n\n return { diagnostics: allDiagnostics };\n}\n\nfunction runHardcodedTokenMatch(context: RuleContext): RuleResult {\n const { manifest, styleIndex } = context;\n const diagnostics: Diagnostic[] = [];\n\n // We check the style index rules for hardcoded values that match tokens\n // Tokens are CSS custom properties like --space-4: 16px\n // We look for declarations with values that exactly match token values\n\n const tokenValues = new Map<string, string>(); // value -> token name\n for (const [token, value] of Object.entries(manifest.tokens)) {\n tokenValues.set(normalizeTokenValue(value), token);\n }\n\n for (const rule of styleIndex.rules) {\n for (const declaration of rule.declarations) {\n // A token definition (--space-4: 16px) is the source of truth, not a use.\n if (declaration.property.startsWith('--')) continue;\n\n if (isLengthOrColor(declaration.value)) {\n const normalized = normalizeTokenValue(declaration.value);\n const token = tokenValues.get(normalized);\n\n if (token) {\n // Exact match found - report if the declaration doesn't already use the token\n if (!declaration.value.includes('var(')) {\n diagnostics.push({\n code: 'token/hardcoded-match',\n severity: 'warning',\n confidence: 'EXTRACTED',\n file: rule.file,\n range: {\n start: { line: declaration.line, col: declaration.col },\n end: { line: declaration.line, col: declaration.col + declaration.value.length },\n },\n message: `${declaration.property}: ${declaration.value} matches token ${token} (${normalized}).`,\n fix: { kind: 'replace', text: `var(${token})` },\n fingerprint: `token/hardcoded-match:${rule.file}:${declaration.property}:${normalized}`,\n });\n }\n }\n }\n }\n }\n\n return { diagnostics };\n}\n\nfunction runNearTokenMatch(context: RuleContext): RuleResult {\n const { manifest, styleIndex, config } = context;\n const diagnostics: Diagnostic[] = [];\n const tolerance = config.tolerance.px;\n\n // Build token length map: token name -> { value, unit, numericValue }\n const tokenLengths: Array<{\n token: string;\n value: string;\n unit: string;\n numeric: number;\n }> = [];\n\n for (const [token, value] of Object.entries(manifest.tokens)) {\n const parsed = parseLength(value);\n if (parsed) {\n tokenLengths.push({ token, value, ...parsed });\n }\n }\n\n for (const rule of styleIndex.rules) {\n for (const declaration of rule.declarations) {\n // A token definition is the source of truth, not a use.\n if (declaration.property.startsWith('--')) continue;\n\n const parsed = parseLength(declaration.value);\n if (!parsed) continue;\n\n // Skip if already using a token\n if (declaration.value.includes('var(')) continue;\n\n for (const token of tokenLengths) {\n if (parsed.unit !== token.unit) continue;\n\n // The tolerance is in pixels, so express the gap in pixels. Units with no\n // fixed pixel size (em, vw, ch, ...) cannot be compared this way.\n const pixelsPerUnit = PIXELS_PER_UNIT[parsed.unit];\n if (pixelsPerUnit === undefined) continue;\n\n const diff = Math.abs(parsed.numeric - token.numeric) * pixelsPerUnit;\n if (diff > 0 && diff <= tolerance) {\n diagnostics.push({\n code: 'token/near-match',\n severity: 'info',\n confidence: 'INFERRED',\n file: rule.file,\n range: {\n start: { line: declaration.line, col: declaration.col },\n end: { line: declaration.line, col: declaration.col + declaration.value.length },\n },\n message: `${declaration.property}: ${declaration.value} is close to ${token.token} (${token.value}).`,\n fix: { kind: 'replace', text: `var(${token.token})` },\n fingerprint: `token/near-match:${rule.file}:${declaration.property}:${parsed.numeric}${parsed.unit}:${token.token}`,\n });\n }\n }\n }\n }\n\n return { diagnostics };\n}\n\nfunction runUndefinedCssVar(context: RuleContext): RuleResult {\n const { manifest, styleIndex } = context;\n const diagnostics: Diagnostic[] = [];\n\n // Collect all defined CSS custom properties from tokens\n const definedTokens = new Set(Object.keys(manifest.tokens));\n\n // Also collect from style index rules that define custom properties\n for (const rule of styleIndex.rules) {\n for (const declaration of rule.declarations) {\n if (declaration.property.startsWith('--')) {\n definedTokens.add(declaration.property);\n }\n }\n }\n\n for (const rule of styleIndex.rules) {\n for (const declaration of rule.declarations) {\n // Find var() references in the value\n const varMatches = declaration.value.match(/var\\((--[^)]+)\\)/g);\n if (!varMatches) continue;\n\n for (const match of varMatches) {\n const varName = match.slice(4, -1).trim().split(',')[0]?.trim() ?? '';\n\n if (!definedTokens.has(varName)) {\n // Find closest match using Levenshtein distance\n const suggestion = findClosestToken(varName, definedTokens);\n\n diagnostics.push({\n code: 'token/undefined-var',\n severity: 'error',\n confidence: 'INFERRED',\n file: rule.file,\n range: {\n start: { line: declaration.line, col: declaration.col },\n end: { line: declaration.line, col: declaration.col + declaration.value.length },\n },\n message: `Undefined CSS variable ${varName}.${suggestion ? ` Did you mean ${suggestion}?` : ''}`,\n fix: suggestion\n ? { kind: 'replace', text: declaration.value.replace(varName, suggestion) }\n : undefined,\n fingerprint: `token/undefined-var:${rule.file}:${varName}`,\n });\n }\n }\n }\n }\n\n return { diagnostics };\n}\n\n/** Absolute pixel size of one unit, assuming the browser default 16 px root. */\nconst PIXELS_PER_UNIT: Partial<Record<string, number>> = {\n px: 1,\n rem: 16,\n};\n\nfunction normalizeTokenValue(value: string): string {\n return value.trim().toLowerCase();\n}\n\nfunction isLengthOrColor(value: string): boolean {\n const trimmed = value.trim();\n // Check for length units\n if (/^[\\d.]+\\s*(px|rem|em|ch|ex|vw|vh|vmin|vmax|cm|mm|in|pt|pc)$/i.test(trimmed)) {\n return true;\n }\n // Check for color values\n if (/^(#[0-9a-f]{3,8}|rgb\\(|rgba\\(|hsl\\(|hsla\\()/i.test(trimmed)) {\n return true;\n }\n return false;\n}\n\nfunction parseLength(value: string): { unit: string; numeric: number } | null {\n const match = /^([\\d.]+)\\s*(px|rem|em|ch|ex|vw|vh|vmin|vmax|cm|mm|in|pt|pc)$/i.exec(value.trim());\n if (!match || !match[1] || !match[2]) return null;\n return { numeric: parseFloat(match[1]), unit: match[2].toLowerCase() };\n}\n\nfunction findClosestToken(target: string, candidates: Set<string>): string | null {\n let best: string | null = null;\n let bestDistance = Infinity;\n\n for (const candidate of candidates) {\n const distance = levenshteinDistance(target, candidate);\n if (distance < bestDistance && distance <= 3) {\n // Only suggest if reasonably close\n bestDistance = distance;\n best = candidate;\n }\n }\n\n return best;\n}\n\nfunction levenshteinDistance(a: string, b: string): number {\n const matrix: number[][] = Array.from({ length: b.length + 1 }, () =>\n Array.from({ length: a.length + 1 }, () => 0),\n );\n\n for (let i = 0; i <= b.length; i++) {\n matrix[i]![0] = i;\n }\n for (let j = 0; j <= a.length; j++) {\n matrix[0]![j] = j;\n }\n\n for (let i = 1; i <= b.length; i++) {\n for (let j = 1; j <= a.length; j++) {\n if (b.charAt(i - 1) === a.charAt(j - 1)) {\n matrix[i]![j] = matrix[i - 1]![j - 1]!;\n } else {\n matrix[i]![j] = Math.min(\n matrix[i - 1]![j - 1]! + 1, // substitution\n matrix[i]![j - 1]! + 1, // insertion\n matrix[i - 1]![j]! + 1, // deletion\n );\n }\n }\n }\n\n return matrix[b.length]![a.length]!;\n}\n","import { z } from 'zod';\nimport { ConfidenceSchema, PosixPathSchema, RangeSchema, compareStrings } from './common.js';\nimport { DIAGNOSTICS_VERSION } from './version.js';\n\nexport const SeveritySchema = z.enum(['info', 'warning', 'error']);\nexport type Severity = z.infer<typeof SeveritySchema>;\n\nexport const DiagnosticFixSchema = z.object({\n kind: z.literal('replace'),\n text: z.string(),\n});\nexport type DiagnosticFix = z.infer<typeof DiagnosticFixSchema>;\n\nexport const DiagnosticSchema = z.object({\n code: z.string().min(1),\n severity: SeveritySchema,\n confidence: ConfidenceSchema,\n file: PosixPathSchema,\n range: RangeSchema,\n message: z.string().min(1),\n fix: DiagnosticFixSchema.optional(),\n /**\n * Stable identifier for baselines. It must not include line numbers, so an\n * edit elsewhere in the file does not resurface a known issue.\n */\n fingerprint: z.string().min(1),\n});\nexport type Diagnostic = z.infer<typeof DiagnosticSchema>;\n\nexport const DiagnosticsFileSchema = z.object({\n version: z.literal(DIAGNOSTICS_VERSION),\n diagnostics: z.array(DiagnosticSchema).default([]),\n});\nexport type DiagnosticsFile = z.infer<typeof DiagnosticsFileSchema>;\n\nexport function sortDiagnostics(file: DiagnosticsFile): DiagnosticsFile {\n return {\n ...file,\n diagnostics: [...file.diagnostics].sort((a, b) => {\n const left = `${a.file}\\u0000${String(a.range.start.line).padStart(8, '0')}\\u0000${a.code}\\u0000${a.fingerprint}`;\n const right = `${b.file}\\u0000${String(b.range.start.line).padStart(8, '0')}\\u0000${b.code}\\u0000${b.fingerprint}`;\n return compareStrings(left, right);\n }),\n };\n}\n","import { z } from 'zod';\nimport { ConfidenceSchema, PosixPathSchema, RangeSchema } from '../schema/common.js';\nimport { PropSchema } from '../schema/manifest.js';\n\n/**\n * Internal analysis produced for one source file. This shape is cached on disk,\n * so bump the cache version whenever it changes.\n */\nexport const ComponentAnalysisSchema = z.object({\n name: z.string().min(1),\n /** Every name this component is exported under, including `default`. */\n exportNames: z.array(z.string().min(1)).min(1),\n loc: RangeSchema,\n /** Character offsets, used to attribute JSX to the smallest containing component. */\n start: z.number().int().nonnegative(),\n end: z.number().int().nonnegative(),\n props: z.array(PropSchema),\n});\nexport type ComponentAnalysis = z.infer<typeof ComponentAnalysisSchema>;\n\nexport const ImportBindingSchema = z.object({\n source: z.string().min(1),\n /** `default`, `*`, or the imported export name. */\n imported: z.string().min(1),\n local: z.string().min(1),\n});\nexport type ImportBinding = z.infer<typeof ImportBindingSchema>;\n\nexport const JsxUsageSchema = z.object({\n local: z.string().min(1),\n member: z.string().min(1).optional(),\n start: z.number().int().nonnegative(),\n loc: RangeSchema,\n});\nexport type JsxUsage = z.infer<typeof JsxUsageSchema>;\n\nexport const InlineStyleAnalysisSchema = z.object({\n /** `file:line:col` of the tagged JSX element. */\n src: z.string().min(1),\n file: PosixPathSchema,\n range: RangeSchema,\n /** EXTRACTED for an object literal, INFERRED for a spread or expression. */\n confidence: ConfidenceSchema,\n});\nexport type InlineStyleAnalysis = z.infer<typeof InlineStyleAnalysisSchema>;\n\nexport const FileAnalysisSchema = z.object({\n file: PosixPathSchema,\n hash: z.string().regex(/^[a-f0-9]{64}$/),\n components: z.array(ComponentAnalysisSchema),\n imports: z.array(ImportBindingSchema),\n usages: z.array(JsxUsageSchema),\n inlineStyles: z.array(InlineStyleAnalysisSchema).default([]),\n});\nexport type FileAnalysis = z.infer<typeof FileAnalysisSchema>;\n\nexport const SCANNER_CACHE_VERSION = 2 as const;\n\nexport const ScannerCacheSchema = z.object({\n version: z.literal(SCANNER_CACHE_VERSION),\n files: z.record(PosixPathSchema, FileAnalysisSchema),\n});\nexport type ScannerCache = z.infer<typeof ScannerCacheSchema>;\n","import type { ComponentNode, Manifest } from '../schema/manifest.js';\n\nexport interface SourceLocation {\n file: string;\n line: number;\n col: number;\n}\n\nexport interface ContainmentIndex {\n /** Innermost component that contains the source location. */\n resolve(src: string): string | undefined;\n /** Every component whose source range contains the location, innermost first. */\n componentsFor(src: string): string[];\n /** True when the source location sits inside the component's source range. */\n contains(componentId: string, src: string): boolean;\n}\n\n/**\n * Map a `file:line:col` source location to the component that contains it.\n *\n * The tagging transform records where an element is written; the scanner\n * records the source range of every component. The innermost component whose\n * range covers the element is the one that renders it, which is what\n * click-to-source needs.\n */\nexport function buildContainmentIndex(manifest: Manifest): ContainmentIndex {\n const byFile = new Map<string, ComponentNode[]>();\n\n for (const node of manifest.nodes) {\n if (!node.loc) {\n continue;\n }\n\n const list = byFile.get(node.file) ?? [];\n list.push(node);\n byFile.set(node.file, list);\n }\n\n const byId = new Map<string, ComponentNode>();\n for (const node of manifest.nodes) {\n byId.set(node.id, node);\n }\n\n function componentsFor(src: string): string[] {\n const location = parseSourceLocation(src);\n if (!location) {\n return [];\n }\n\n const candidates = byFile.get(location.file) ?? [];\n\n return candidates\n .filter((node) => node.loc && containsPosition(node.loc, location))\n .sort((a, b) => rangeSize(a) - rangeSize(b))\n .map((node) => node.id);\n }\n\n return {\n componentsFor,\n resolve(src) {\n return componentsFor(src)[0];\n },\n contains(componentId, src) {\n const node = byId.get(componentId);\n const location = parseSourceLocation(src);\n\n // A line range only means something inside the component's own file.\n if (!node?.loc || !location || node.file !== location.file) {\n return false;\n }\n\n return containsPosition(node.loc, location);\n },\n };\n}\n\n/** Parse the `file:line:col` format written by the tagging transform. */\nexport function parseSourceLocation(src: string): SourceLocation | undefined {\n const match = /^(.*):(\\d+):(\\d+)$/.exec(src);\n if (!match) {\n return undefined;\n }\n\n const [, file, line, col] = match;\n if (!file) {\n return undefined;\n }\n\n return { file, line: Number(line), col: Number(col) };\n}\n\nfunction containsPosition(\n range: { start: { line: number; col: number }; end: { line: number; col: number } },\n location: SourceLocation,\n): boolean {\n return comparePositions(location, range.start) >= 0 && comparePositions(location, range.end) <= 0;\n}\n\nfunction comparePositions(\n a: { line: number; col: number },\n b: { line: number; col: number },\n): number {\n if (a.line !== b.line) {\n return a.line < b.line ? -1 : 1;\n }\n\n if (a.col !== b.col) {\n return a.col < b.col ? -1 : 1;\n }\n\n return 0;\n}\n\nfunction rangeSize(node: ComponentNode): number {\n if (!node.loc) {\n return Number.MAX_SAFE_INTEGER;\n }\n\n const lines = node.loc.end.line - node.loc.start.line;\n const columns = node.loc.end.col - node.loc.start.col;\n\n return lines * 1_000_000 + columns;\n}\n","import type { Confidence } from '../schema/common.js';\nimport type { InlineStyle, StyleDeclaration, StyleIndex, StyleRule } from '../schema/styles.js';\nimport type { ElementDetail, MatchedRule } from '../runtime/protocol.js';\nimport { parseSourceLocation } from '../scanner/containment.js';\nimport {\n compareSpecificity,\n normalizeSelector,\n specificityOf,\n type Specificity,\n} from './selector.js';\n\nexport type StyleSourceKind = 'inline' | 'stylesheet' | 'css-module' | 'tailwind' | 'unknown';\n\nexport interface StyleSource {\n kind: StyleSourceKind;\n confidence: Confidence;\n file?: string;\n line?: number;\n col?: number;\n selector?: string;\n atRules?: string[];\n /** Number of static rules that matched the same selector and property. */\n candidates?: number;\n}\n\nexport type StyleProvenance = Record<string, StyleSource>;\n\nexport interface StyleIndexer {\n resolve(detail: ElementDetail): StyleProvenance;\n}\n\ninterface StaticMatch {\n rule: StyleRule;\n declaration: StyleDeclaration;\n}\n\ninterface Candidate {\n rule?: MatchedRule;\n declaration: MatchedDeclarationLike;\n specificity: Specificity;\n important: boolean;\n order: number;\n inline: boolean;\n}\n\ninterface MatchedDeclarationLike {\n property: string;\n value: string;\n important: boolean;\n}\n\n/**\n * Combine the browser's matched rules with the static CSS index. The browser\n * decides the winning declaration; the index says where that declaration was\n * written. Ambiguity is reported as INFERRED instead of guessed.\n */\nexport function createStyleIndexer(index: StyleIndex): StyleIndexer {\n const staticRules = new Map<string, StaticMatch[]>();\n\n for (const rule of index.rules) {\n addRule(staticRules, rule.selector, rule);\n if (rule.runtimeSelector) {\n addRule(staticRules, rule.runtimeSelector, rule);\n }\n }\n\n const inlineBySrc = new Map<string, InlineStyle>();\n for (const inline of index.inlineStyles) {\n inlineBySrc.set(inline.src, inline);\n }\n\n return {\n resolve(detail: ElementDetail): StyleProvenance {\n const provenance: StyleProvenance = {};\n const matchedRules = detail.matchedRules ?? [];\n const inlineStyle = detail.inlineStyle ?? {};\n const classes = detail.classes ?? [];\n\n for (const [property, value] of Object.entries(detail.style)) {\n const candidates: Candidate[] = [];\n\n if (inlineStyle[property] !== undefined) {\n candidates.push({\n declaration: {\n property,\n value: inlineStyle[property] ?? value,\n important: false,\n },\n specificity: { id: 1_000_000, class: 0, type: 0 },\n important: false,\n order: Number.MAX_SAFE_INTEGER,\n inline: true,\n });\n }\n\n for (const rule of matchedRules) {\n for (const declaration of rule.declarations) {\n if (declaration.property !== property) {\n continue;\n }\n\n candidates.push({\n rule,\n declaration,\n specificity: specificityOf(rule.selector),\n important: declaration.important,\n order: rule.order,\n inline: false,\n });\n }\n }\n\n if (candidates.length === 0) {\n continue;\n }\n\n const winner = candidates.reduce((best, candidate) =>\n isBetter(candidate, best) ? candidate : best,\n );\n\n const source = winner.inline\n ? inlineSource(detail.src, inlineBySrc)\n : stylesheetSource(winner, staticRules, index, detail, classes);\n\n provenance[property] = source;\n }\n\n return provenance;\n },\n };\n}\n\nfunction addRule(target: Map<string, StaticMatch[]>, selector: string, rule: StyleRule): void {\n const key = normalizeSelector(selector);\n const list = target.get(key) ?? [];\n target.set(key, list);\n\n for (const declaration of rule.declarations) {\n list.push({ rule, declaration });\n }\n}\n\nfunction isBetter(candidate: Candidate, current: Candidate): boolean {\n if (candidate.important !== current.important) {\n return candidate.important;\n }\n\n const specificity = compareSpecificity(candidate.specificity, current.specificity);\n if (specificity !== 0) {\n return specificity > 0;\n }\n\n return candidate.order >= current.order;\n}\n\nfunction inlineSource(src: string, inlineBySrc: Map<string, InlineStyle>): StyleSource {\n const inline = inlineBySrc.get(src);\n\n if (inline) {\n return {\n kind: 'inline',\n file: inline.file,\n line: inline.range.start.line,\n col: inline.range.start.col,\n selector: 'style',\n confidence: inline.confidence,\n };\n }\n\n const location = parseSourceLocation(src);\n return {\n kind: 'inline',\n ...(location ? { file: location.file, line: location.line, col: location.col } : {}),\n selector: 'style',\n confidence: 'INFERRED',\n };\n}\n\nfunction stylesheetSource(\n winner: Candidate,\n staticRules: Map<string, StaticMatch[]>,\n index: StyleIndex,\n detail: ElementDetail,\n classes: string[],\n): StyleSource {\n const rule = winner.rule;\n const selector = rule?.selector ?? 'style';\n const atRules = rule?.atRules ?? [];\n const matches = staticRules.get(normalizeSelector(selector)) ?? [];\n // The browser reports longhands (`padding-top`) while the source usually\n // writes the shorthand (`padding`). Prefer an exact property, then shorthands.\n const properties = [winner.declaration.property, ...shorthandsFor(winner.declaration.property)];\n const forProperty = matches\n .filter((match) => properties.includes(match.declaration.property))\n .sort(\n (a, b) =>\n properties.indexOf(a.declaration.property) - properties.indexOf(b.declaration.property),\n );\n\n if (forProperty.length > 0) {\n const exact = forProperty.find(\n (match) =>\n normalizeValue(match.declaration.value) === normalizeValue(winner.declaration.value),\n );\n const chosen = exact ?? (forProperty[0] as StaticMatch);\n const locations = new Set(\n forProperty.map((match) => `${match.rule.file}:${match.declaration.line}`),\n );\n const confidence: Confidence = locations.size === 1 ? 'EXTRACTED' : 'INFERRED';\n\n return {\n kind: chosen.rule.module ? 'css-module' : 'stylesheet',\n file: chosen.rule.file,\n line: chosen.declaration.line,\n col: chosen.declaration.col,\n selector,\n ...(atRules.length > 0 ? { atRules } : {}),\n ...(locations.size > 1 ? { candidates: locations.size } : {}),\n confidence,\n };\n }\n\n if (index.tailwind && isTailwindUtility(selector, classes)) {\n const location = parseSourceLocation(detail.src);\n return {\n kind: 'tailwind',\n ...(location ? { file: location.file, line: location.line, col: location.col } : {}),\n selector,\n ...(atRules.length > 0 ? { atRules } : {}),\n confidence: 'INFERRED',\n };\n }\n\n return {\n kind: 'unknown',\n selector,\n ...(atRules.length > 0 ? { atRules } : {}),\n confidence: 'INFERRED',\n };\n}\n\n/** Shorthand properties that can set the given longhand, most specific first. */\nexport function shorthandsFor(property: string): string[] {\n const shorthands: string[] = [];\n\n const box = /^(margin|padding)-(?:top|right|bottom|left)$/.exec(property);\n if (box?.[1]) {\n shorthands.push(box[1]);\n }\n\n const borderWidth = /^border-(top|right|bottom|left)-width$/.exec(property);\n if (borderWidth?.[1]) {\n shorthands.push(`border-${borderWidth[1]}`, 'border-width', 'border');\n }\n\n if (/^border-(?:top|bottom)-(?:left|right)-radius$/.test(property)) {\n shorthands.push('border-radius');\n }\n\n if (property === 'background-color') {\n shorthands.push('background');\n }\n\n if (property === 'flex-direction' || property === 'flex-wrap') {\n shorthands.push('flex-flow');\n }\n\n if (/^(?:row|column)-gap$/.test(property)) {\n shorthands.push('gap');\n }\n\n if (/^font-(?:size|weight|family)$|^line-height$/.test(property)) {\n shorthands.push('font');\n }\n\n if (property.startsWith('grid-template-')) {\n shorthands.push('grid-template', 'grid');\n }\n\n if (property.startsWith('overflow-')) {\n shorthands.push('overflow');\n }\n\n return shorthands;\n}\n\nfunction normalizeValue(value: string): string {\n return value.trim().replace(/\\s+/g, ' ').toLowerCase();\n}\n\n/**\n * A generated Tailwind utility is a single class selector that the element\n * actually carries, optionally with a variant pseudo-class. Dynamic class\n * names stay read-only: the element's source location is the best label.\n */\nfunction isTailwindUtility(selector: string, classes: string[]): boolean {\n const match = /^\\.((?:\\\\.|[^.#:[\\]\\s>+~])+)/.exec(selector);\n\n if (!match?.[1]) {\n return false;\n }\n\n const className = match[1].replace(/\\\\(.)/g, '$1');\n\n if (!classes.includes(className)) {\n return false;\n }\n\n // A bare element, id, or compound selector is not a Tailwind utility.\n const remainder = selector.slice(match[0].length);\n return /^(?::[a-zA-Z-]+(?:\\([^)]*\\))?)*$/.test(remainder);\n}\n","/**\n * Wire protocol shared by the dashboard, the runtime agent, and the dev-server\n * bridge.\n *\n * The bridge is a relay: dashboard messages travel to agents, agent messages\n * travel to dashboards. The server never interprets the payload, so both sides\n * can evolve without changing the server.\n */\n\nexport type BridgeRole = 'agent' | 'dashboard';\n\nexport const AGENT_ROLE: BridgeRole = 'agent';\nexport const DASHBOARD_ROLE: BridgeRole = 'dashboard';\n\nexport interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n top: number;\n left: number;\n right: number;\n bottom: number;\n}\n\nexport interface MeasuredElement {\n /** `file:line:col` taken from the `data-snoop-src` attribute. */\n src: string;\n tag: string;\n rect: Rect;\n}\n\nexport interface MatchedDeclaration {\n property: string;\n /** The declaration as written, before the browser resolves variables. */\n value: string;\n important: boolean;\n}\n\nexport interface MatchedRule {\n /** Selector text from the browser CSSOM. */\n selector: string;\n declarations: MatchedDeclaration[];\n /** Source order across the document's stylesheets. */\n order: number;\n /** Enclosing conditional at-rules, outermost first. */\n atRules: string[];\n}\n\nexport interface ElementDetail {\n src: string;\n tag: string;\n rect: Rect;\n /** Curated computed-style values for the selected element only. */\n style: Record<string, string>;\n /** Class names currently on the element. */\n classes: string[];\n /** Inline declarations, limited to the curated style properties. */\n inlineStyle: Record<string, string>;\n /** Stylesheet rules that match the element, in document order. */\n matchedRules: MatchedRule[];\n}\n\n/** Messages sent by the runtime agent to the dashboard. */\nexport type AgentMessage =\n | { kind: 'ready' }\n | { kind: 'presence'; connected: boolean }\n | { kind: 'elements'; elements: MeasuredElement[] }\n | { kind: 'detail'; detail: ElementDetail }\n | { kind: 'click'; src: string }\n | { kind: 'hover'; src: string | null };\n\n/** Messages sent by the dashboard to the runtime agent. */\nexport type DashboardMessage =\n | { kind: 'measure'; enabled: boolean }\n | { kind: 'inspect'; enabled: boolean }\n | { kind: 'isolate'; enabled: boolean }\n | {\n kind: 'select';\n srcs: string[];\n /** Scroll the first source to the centre of the viewport. */\n reveal?: boolean;\n }\n | { kind: 'sync' };\n\nexport type RelayPayload = AgentMessage | DashboardMessage;\n\nexport interface RelayEnvelope {\n type: 'relay';\n payload: RelayPayload;\n}\n\nexport function isAgentMessage(value: unknown): value is AgentMessage {\n if (!isRecord(value) || typeof value.kind !== 'string') {\n return false;\n }\n\n switch (value.kind) {\n case 'ready':\n case 'presence':\n case 'elements':\n case 'detail':\n case 'click':\n case 'hover':\n return true;\n default:\n return false;\n }\n}\n\nexport function isDashboardMessage(value: unknown): value is DashboardMessage {\n if (!isRecord(value) || typeof value.kind !== 'string') {\n return false;\n }\n\n switch (value.kind) {\n case 'measure':\n case 'inspect':\n case 'isolate':\n case 'select':\n case 'sync':\n return true;\n default:\n return false;\n }\n}\n\nexport function isRelayEnvelope(value: unknown): value is RelayEnvelope {\n return (\n isRecord(value) &&\n value.type === 'relay' &&\n isRecord(value.payload) &&\n typeof value.payload.kind === 'string'\n );\n}\n\nexport function parseRole(value: string | null | undefined): BridgeRole {\n return value === AGENT_ROLE ? AGENT_ROLE : DASHBOARD_ROLE;\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n","import pkg from '../package.json' with { type: 'json' };\nimport { defineConfig, findConfigFile, loadConfig } from './config.js';\n\nexport { defineConfig, findConfigFile, loadConfig };\nexport {\n scanProject,\n writeManifest,\n type ScanProjectOptions,\n type ScanResult,\n type ScanStats,\n} from './scanner/index.js';\nexport * from './schema/index.js';\nexport * from './styles/index.js';\nexport * from './rules/index.js';\nexport * from './runtime/protocol.js';\n\nexport const VERSION: string = pkg.version;\n"],"mappings":";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,EACX,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,eAAe;AAAA,EACjB;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,MAAQ;AAAA,IACR,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,gBAAgB;AAAA,I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AAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,CAACA,UAAS,KAAK,KAAK,OAAO,MAAM,SAAS,UAAU;AACtD,WAAO;AAAA,EACT;AAEA,UAAQ,MAAM,MAAM;AAAA,IAClB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,SAAS,gBAAgB,OAAwC;AACtE,SACEA,UAAS,KAAK,KACd,MAAM,SAAS,WACfA,UAAS,MAAM,OAAO,KACtB,OAAO,MAAM,QAAQ,SAAS;AAElC;AAEO,SAAS,UAAU,OAA8C;AACtE,SAAO,UAAU,aAAa,aAAa;AAC7C;AAEO,SAASA,UAAS,OAAkD;AACzE,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;;;AC9HO,IAAM,UAAkB,gBAAI;","names":["resolve","resolve","relative","readFile","dirname","resolve","glob","z","z","z","relative","resolve","z","z","existsSync","resolve","createJiti","CONFIG_FILES","resolve","existsSync","require","createJiti","isRecord","resolve","compare","relative","z","z","z","z","READ_CONCURRENCY","resolve","glob","compare","readFile","dirname","isRecord"]}