@tailwind-merge/next 0.0.0-dev.50b1d1e9f69ac68604be38dabea94cccdc6b070a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +41 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +124 -0
- package/dist/index.mjs.map +1 -0
- package/dist/loader.d.mts +23 -0
- package/dist/loader.d.mts.map +1 -0
- package/dist/loader.mjs +2815 -0
- package/dist/loader.mjs.map +1 -0
- package/dist/options-B1iOW6tJ.d.mts +38 -0
- package/dist/options-B1iOW6tJ.d.mts.map +1 -0
- package/dist/runtime.d.mts +2 -0
- package/dist/runtime.mjs +7 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +80 -0
- package/src/index.ts +162 -0
- package/src/loader.ts +183 -0
- package/src/options.ts +81 -0
- package/src/runtime.ts +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.mjs","names":[],"sources":["../../configurator/src/css-statements.ts","../../configurator/src/declarations.ts","../../configurator/src/resolvers.ts","../../configurator/src/design-system.ts","../../configurator/src/augment.ts","../../configurator/src/compress.ts","../../configurator/src/property-coverage.ts","../../configurator/src/custom-utilities.ts","../../configurator/src/emit.ts","../../configurator/src/materialize.ts","../../configurator/src/plan.ts","../../configurator/src/prune.ts","../../configurator/src/snapshot.ts","../../configurator/src/generate.ts","../../configurator/src/scan.ts","../../plugin-core/src/discovery.ts","../../plugin-core/src/generation.ts","../../plugin-core/src/generation-session.ts","../src/loader.ts"],"sourcesContent":["/**\n * Reads active CSS statements and block headers for build-time inspection without interpreting their contents. Comments cannot introduce directives, and quoted text and function arguments cannot end a statement or open a block. Sharing this between source scanning and root discovery keeps both integrations' view of active directives consistent.\n * Unlike declaration analysis of compiled CSS, discovery must tolerate unfinished edits so generation can select the entrypoint and report its error through the normal recovery path.\n */\nexport function* cssStatements(css: string): Generator<string> {\n let statement = ''\n let quote = ''\n let parenDepth = 0\n for (let index = 0; index < css.length; index++) {\n const character = css[index]!\n if (character === '\\\\') {\n statement += css.slice(index, index + 2)\n index += 1\n continue\n }\n if (quote) {\n statement += character\n if (character === quote) {\n quote = ''\n }\n continue\n }\n if (character === '/' && css[index + 1] === '*') {\n const end = css.indexOf('*/', index + 2)\n index = end === -1 ? css.length : end + 1\n statement += ' '\n continue\n }\n if (character === '\"' || character === \"'\") {\n quote = character\n } else if (character === '(') {\n parenDepth += 1\n } else if (character === ')') {\n parenDepth -= 1\n } else if (\n parenDepth === 0 &&\n (character === ';' || character === '{' || character === '}')\n ) {\n if (statement.trim() !== '') {\n yield statement.trim()\n }\n statement = ''\n continue\n }\n statement += character\n }\n if (statement.trim() !== '') {\n yield statement.trim()\n }\n}\n\n/**\n * Splits at a separator that sits outside any parentheses, brackets, braces, and quotes (Tailwind's `segment`), so `a(b,c),d` splits into two parts at the top-level comma and quoted separators stay put.\n */\nexport function segment(input: string, separator: string): string[] {\n const parts: string[] = []\n const stack: string[] = []\n let last = 0\n\n for (let index = 0; index < input.length; index++) {\n const character = input[index]!\n\n if (stack.length === 0 && character === separator) {\n parts.push(input.slice(last, index))\n last = index + 1\n continue\n }\n\n switch (character) {\n case '\\\\':\n index += 1\n break\n case '\"':\n case \"'\":\n // Quoted content is opaque until the matching quote.\n while (++index < input.length) {\n if (input[index] === '\\\\') {\n index += 1\n } else if (input[index] === character) {\n break\n }\n }\n break\n case '(':\n stack.push(')')\n break\n case '[':\n stack.push(']')\n break\n case '{':\n stack.push('}')\n break\n case ')':\n case ']':\n case '}':\n if (stack.length > 0 && stack[stack.length - 1] === character) {\n stack.pop()\n }\n break\n }\n }\n\n parts.push(input.slice(last))\n return parts\n}\n","import { type ChildNode, parse } from 'postcss'\n\nimport { segment } from './css-statements.ts'\n\n/**\n * Interprets the CSS Tailwind compiles for one class: which render target each declaration styles and under which conditions. Kept free of any design-system dependency so the scope and selector rules can be tested against literal CSS; `declaredDeclarations` in design-system.ts is the compile-and-cache layer on top.\n */\n\n/**\n * One CSS declaration of a compiled class, annotated with where and when it applies. The annotations exist because conflict semantics depend on them: a `border-color` set on an `::after` overlay never fights with a `border-color` on the element itself, and a padding that only applies inside a media query cannot be said to fully override an unconditional one.\n */\nexport interface DeclarationEntry {\n /** Render target of the declaration: `''` for the element the class sits on, a pseudo-element chain like `'::after'`, or a combinator tail like `'> :not(:last-child)'` when the declaration styles a different element entirely. */\n context: string\n /** True under a style-grouping at-rule, a pseudo-class guard, or a selector list whose combined effects cannot be treated as one unconditional target. */\n conditional: boolean\n /** Enclosing block headers relative to the utility's own selector (`&`). Keeping the full path distinguishes both guard expressions and which render target a guard surrounds. */\n scope: readonly string[]\n property: string\n /** Declaration-level importance, independent of an important modifier on the class name. */\n important: boolean\n value: string\n}\n\ninterface BlockFrame {\n context: string\n conditional: boolean\n scope: readonly string[]\n /** Set for blocks whose declarations are not element styles (`@property`, `@keyframes` and their descendants). */\n skip: boolean\n}\n\n/** Annotates compiled CSS with the target and conditions needed for coverage checks. PostCSS owns CSS syntax (including escaped identifiers, importance, and nested value blocks); this walker only interprets style scopes. `candidate` is the class the CSS was compiled for, so its own selector can be told apart from ancestor classes a variant adds (`.in-dark\\:block` inside `:where(.dark *) .in-dark\\:block`); without it the first class selector is taken. */\nexport function parseDeclarations(css: string, candidate?: string): DeclarationEntry[] {\n const entries: DeclarationEntry[] = []\n visit(parse(css).nodes)\n return entries\n\n function visit(nodes: ChildNode[], frame?: BlockFrame) {\n for (const node of nodes) {\n if (node.type === 'decl') {\n if (frame && !frame.skip) {\n entries.push({\n context: frame.context,\n conditional: frame.conditional,\n scope: frame.scope,\n property: node.prop,\n important: node.important ?? false,\n value: node.value,\n })\n }\n } else if (node.type === 'rule' || node.type === 'atrule') {\n const header = node.type === 'rule'\n ? node.selector\n : `@${node.name}${node.params ? ` ${node.params}` : ''}`\n visit(node.nodes ?? [], frameForHeader(header, frame, candidate))\n }\n }\n }\n}\n\nfunction frameForHeader(\n header: string,\n parent: BlockFrame | undefined,\n candidate: string | undefined,\n): BlockFrame {\n const parentContext = parent?.context ?? ''\n const parentConditional = parent?.conditional ?? false\n const parentScope = parent?.scope ?? []\n const parentSkip = parent?.skip ?? false\n\n if (header.startsWith('@')) {\n // Registrations and animation frames are not element styles. Other wrappers, including @starting-style and unfamiliar grouping rules, retain their declarations conservatively under their full scope.\n const isNonStyle = /^@(?:property|(?:-[\\w]+-)?keyframes)(?:\\s|$)/i.test(header)\n return {\n context: parentContext,\n conditional: true,\n scope: [...parentScope, header],\n skip: parentSkip || isNonStyle,\n }\n }\n\n const { contextFragment, conditional, relativeSelector } = analyzeSelector(header, candidate)\n return {\n context:\n parentContext === '' || contextFragment === ''\n ? parentContext + contextFragment\n : `${parentContext} ${contextFragment}`,\n conditional: parentConditional || conditional,\n scope: [...parentScope, relativeSelector],\n skip: parentSkip,\n }\n}\n\n/** The class selector to anchor on: the one spelling the candidate, or the first one when the candidate is unknown or absent (a selector Tailwind built without the class itself). */\nfunction findClassAnchor(subject: string, candidate: string | undefined): RegExpExecArray | null {\n const classSelectors = [...subject.matchAll(/\\.(?:[\\w-]|\\\\(?:[\\da-f]{1,6}\\s?|.))+/gi)]\n if (candidate !== undefined) {\n const own = classSelectors.find((match) => unescapeIdentifier(match[0].slice(1)) === candidate)\n if (own) {\n return own\n }\n }\n return classSelectors[0] ?? null\n}\n\n/** Reverses CSS identifier escaping: `\\:` → `:`, `\\32 xl` → `2xl`. */\nfunction unescapeIdentifier(identifier: string): string {\n return identifier.replace(/\\\\(?:([\\da-f]{1,6})\\s?|(.))/gi, (_, hex: string | undefined, char: string | undefined) =>\n hex !== undefined ? String.fromCodePoint(Number.parseInt(hex, 16)) : (char as string),\n )\n}\n\n/** Single-colon selectors that are pseudo-elements by CSS's legacy compatibility rule; everything else single-colon is a pseudo-class. */\nconst LEGACY_PSEUDO_ELEMENTS = new Set(['before', 'after', 'first-line', 'first-letter'])\n\n/**\n * Determines what a selector does to the render target relative to the class's base element. The subject anchor is `&` (nested rules) or the class selector itself (top-level rules, possibly wrapped in `:where(...)`). Pseudo-elements and combinator tails after the anchor change the target; pseudo-classes and ancestor prefixes only add conditions.\n */\nfunction analyzeSelector(\n selector: string,\n candidate: string | undefined,\n): {\n contextFragment: string\n conditional: boolean\n relativeSelector: string\n} {\n // The first selector supplies the property signature. The complete list stays in the scope, and list declarations conservatively avoid unconditional coverage below. Split only at top-level commas: a list inside `:where(.dark, .dark *)` is one selector.\n let subject = segment(selector, ',')[0]!.trim()\n\n // Unwrap a `:where(...)` / `:is(...)` enclosing the entire selector — it only changes specificity, not the target.\n const wrapper = /^:(?:where|is)\\((.*)\\)$/.exec(subject)\n if (wrapper) {\n subject = wrapper[1]!.trim()\n }\n\n // Prefer the nesting anchor over an ancestor class (`.dark &`), then the candidate's own class over any other: ancestor variants like `in-*` and `group-*` put their ancestor's class first (`:where(.dark *) .in-dark\\:block`), and anchoring there would turn the utility's own element into a combinator target. A hexadecimal escape consumes its optional trailing space too (`\\32 xl`): that space belongs to a numeric variant's class name, not a descendant selector.\n const anchorMatch = /&/.exec(subject) ?? findClassAnchor(subject, candidate)\n if (!anchorMatch) {\n // No recognizable anchor means the block targets something unrelated (not emitted by current Tailwind); give it a distinct context so it can never collide with base declarations.\n return {\n contextFragment: subject.replace(/\\s+/g, ' '),\n conditional: false,\n relativeSelector: selector,\n }\n }\n\n // Anything before the anchor is ancestor context (`.dark .foo`), a condition on the same target.\n let conditional = anchorMatch.index > 0 || segment(selector, ',').length > 1\n let contextFragment = ''\n let rest = subject.slice(anchorMatch.index + anchorMatch[0].length)\n\n while (rest !== '') {\n const pseudo = /^::?([\\w-]+)(\\((?:[^()]|\\([^()]*\\))*\\))?/.exec(rest)\n if (pseudo) {\n const isPseudoElement =\n pseudo[0].startsWith('::') || LEGACY_PSEUDO_ELEMENTS.has(pseudo[1]!)\n if (isPseudoElement) {\n contextFragment += `::${pseudo[1]!}`\n } else {\n conditional = true\n }\n rest = rest.slice(pseudo[0].length)\n continue\n }\n\n const compound = /^(?:\\.(?:[\\w-]|\\\\(?:[\\da-f]{1,6}\\s?|.))+|\\[[^\\]]*\\])/i.exec(rest)\n if (compound) {\n // Additional class or attribute requirements on the same element are conditions.\n conditional = true\n rest = rest.slice(compound[0].length)\n continue\n }\n\n // A combinator: the remainder selects a different element and becomes part of the target context.\n contextFragment += (contextFragment === '' ? '' : ' ') + rest.trim().replace(/\\s+/g, ' ')\n break\n }\n\n return {\n contextFragment,\n conditional,\n // Keep the entire selector in the scope even when target classification only analyzes its first comma segment.\n relativeSelector: selector.replace(anchorMatch[0], '&'),\n }\n}\n","import fs from 'node:fs'\nimport { readFile, stat } from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { type Resolver } from '@tailwindcss/node'\nimport enhancedResolve, { type ResolveOptions } from 'enhanced-resolve'\n\n/**\n * Resolves stylesheet requests with Tailwind's package fields and conditions after optional bundler resolution. An alias-expanded request may still need an extension or package lookup; finish that lookup here so failures report missing targets under the alias rather than the original specifier. Tracking at this boundary records the file's CSS role, including .pcss and extensionless imports, without mistaking JavaScript dependencies for stylesheets.\n * Each caller gets an uncached filesystem view so regeneration sees imports created or repaired after an earlier resolution attempt.\n * Failed resolution reports attempted missing paths separately from stylesheet roles, so integrations can watch for their creation without treating resolver metadata such as package.json as CSS.\n */\nexport function createStylesheetResolver(\n customResolver?: Resolver,\n onStylesheet?: (file: string) => void,\n onMissingDependency?: (file: string) => void,\n): (id: string, base: string) => Promise<string> {\n return createResolver(\n [{ extensions: ['.css'], mainFields: ['style'], conditionNames: ['style'] }],\n customResolver,\n onStylesheet,\n onMissingDependency,\n )\n}\n\n/** Resolves JavaScript configs/plugins with Tailwind's import-then-require fallback. Report the module before loading can fail, and missing targets before rejecting, so integrations can recover from repairs and creation. An uncached filesystem also avoids retaining a missing result across the first retry. */\nexport function createModuleResolver(\n customResolver?: Resolver,\n onDependency?: (file: string) => void,\n): (id: string, base: string) => Promise<string> {\n const extensions = ['.js', '.json', '.node', '.ts']\n return createResolver(\n [\n { extensions, conditionNames: ['node', 'import'] },\n { extensions, conditionNames: ['node', 'require'] },\n ],\n customResolver,\n onDependency,\n onDependency,\n )\n}\n\n/**\n * Retains local transitive dependencies after module execution fails. Tailwind reports its own import walk only after a successful load, leaving a broken child (or a missing grandchild) invisible to watchers. Recognize its literal-import forms without a JavaScript parser so syntax errors cannot stop the walk. Matches only add watches: they never execute code or decide how Tailwind loads a module.\n * This recovery-only walk uses fresh resolution, reports missing alternatives, follows cycles once, and leaves the original loader responsible for errors. Bare package imports stay outside the local graph, as in Tailwind's dependency collector.\n */\nexport async function trackModuleDependencies(file: string, onDependency: (file: string) => void) {\n const visited = new Set<string>()\n // Match Tailwind's JS/TS extension preference, with JSON and native modules retained as leaf dependencies. Directory imports also honor package.json's main field through the shared resolver.\n const jsExtensions = ['.js', '.cjs', '.mjs', '.ts', '.cts', '.mts', '.jsx', '.tsx', '.json', '.node']\n const tsExtensions = ['.ts', '.cts', '.mts', '.tsx', '.js', '.cjs', '.mjs', '.jsx', '.json', '.node']\n const resolveJs = createResolver(\n [{ extensions: jsExtensions, conditionNames: ['node', 'import', 'require'] }],\n undefined, undefined, onDependency,\n )\n const resolveTs = createResolver(\n [{ extensions: tsExtensions, conditionNames: ['node', 'import', 'require'] }],\n undefined, undefined, onDependency,\n )\n await visit(file)\n\n async function visit(file: string): Promise<void> {\n if (visited.has(file)) {\n return\n }\n visited.add(file)\n onDependency(file)\n const extension = path.extname(file)\n if (extension === '.json' || extension === '.node') {\n return\n }\n const source = await readFile(file, 'utf8').catch(() => null)\n if (source === null) {\n return\n }\n const imports = new Set<string>()\n for (const pattern of MODULE_IMPORT_PATTERNS) {\n for (const match of source.matchAll(pattern)) {\n if (match[1]!.startsWith('.')) {\n imports.add(match[1]!)\n }\n }\n }\n const resolve = ['.js', '.cjs', '.mjs'].includes(extension) ? resolveJs : resolveTs\n await Promise.all([...imports].map(async (id) => {\n const dependency = await resolve(id, path.dirname(file)).catch(() => undefined)\n if (dependency) {\n await visit(dependency)\n }\n }))\n }\n}\n\n/** Shares fresh filesystem access and dependency reporting across stylesheet and module resolution. Keep failed alternatives private until every condition set fails; a successful fallback must not turn missing package metadata into watched dependencies or stylesheet inputs. */\nfunction createResolver(\n alternatives: Pick<ResolveOptions, 'extensions' | 'mainFields' | 'conditionNames'>[],\n customResolver?: Resolver,\n onResolved?: (file: string) => void,\n onMissingDependency?: (file: string) => void,\n): (id: string, base: string) => Promise<string> {\n const resolvers = alternatives.map((options) => enhancedResolve.ResolverFactory.createResolver({\n ...options,\n fileSystem: fs,\n useSyncFileSystemCalls: true,\n // An empty or trailing-delimiter NODE_PATH must not add '' as a module directory: enhanced-resolve turns that into the working directory itself, and a missing bare import would then resolve to the project's own entry file instead of failing.\n modules: ['node_modules', ...(process.env.NODE_PATH?.split(path.delimiter).filter(Boolean) ?? [])],\n }))\n return async (id, base) => {\n const request = (await customResolver?.(id, base)) || id\n const missingDependencies = onMissingDependency ? new Set<string>() : undefined\n let resolutionError: unknown\n for (const resolver of resolvers) {\n let file: string\n try {\n file = await new Promise<string>((resolve, reject) => {\n resolver.resolve({}, base, request, { missingDependencies }, (error, result) => {\n if (error || !result) {\n reject(error ?? new Error(`Could not resolve '${id}' from '${base}'`))\n } else {\n resolve(result)\n }\n })\n })\n } catch (error) {\n resolutionError = error\n continue\n }\n onResolved?.(file)\n return file\n }\n for (const file of missingDependencies ?? []) {\n onMissingDependency?.(file)\n }\n // Rollup's watcher can miss creation when several unresolved filenames share a directory. Watch the nearest existing parent of the actual local request too; resolver metadata such as ancestor package.json attempts must not widen this to unrelated directories.\n if (onMissingDependency && (request.startsWith('.') || path.isAbsolute(request))) {\n const directory = await existingParentDirectory(path.resolve(base, request))\n if (directory) {\n onMissingDependency(directory)\n }\n }\n throw resolutionError\n }\n}\n\n/** A missing nested directory cannot be watched yet; its closest existing ancestor observes creation of the remaining path. Only failed local requests use this recovery watch, which drops out after successful resolution. */\nasync function existingParentDirectory(file: string): Promise<string | undefined> {\n let directory = path.dirname(file)\n while (!(await stat(directory).catch(() => null))?.isDirectory()) {\n const parent = path.dirname(directory)\n if (parent === directory) {\n return undefined\n }\n directory = parent\n }\n return directory\n}\n\n/** Recognize local static imports, re-exports, dynamic imports, and requires even in incomplete source. Do not greedily span later statements' `from` clauses; extra matches in comments or strings only broaden failure-recovery watches. */\nconst MODULE_IMPORT_PATTERNS = [\n /\\b(?:import|export)\\s+(?:[^'\";]*?\\s+from\\s*)?['\"]([^'\"]+)['\"]/g,\n /\\b(?:require|import)\\s*\\(\\s*['\"`]([^'\"`]+)['\"`]/g,\n]\n","import { readFile } from 'node:fs/promises'\nimport path from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\n\nimport { type Resolver, __unstable__loadDesignSystem, loadModule } from '@tailwindcss/node'\nimport type * as TailwindEngine from 'tailwindcss'\n\nimport { type DeclarationEntry, parseDeclarations } from './declarations.ts'\nimport { createModuleResolver, createStylesheetResolver, trackModuleDependencies } from './resolvers.ts'\n\nexport type { DeclarationEntry } from './declarations.ts'\n\n/** Bundler-owned resolution shared by design-system loading and source scanning. Either resolver can defer to Tailwind's normal filesystem/package resolution or return an alias-expanded request; the shared resolvers finish extension/package lookup and track missing targets. */\nexport interface TailwindIntegration {\n resolveCss?: Resolver\n resolveJs?: Resolver\n /** Files read by generation, plus missing resolution targets and their existing parent directories on failure so integrations can observe creation and retry. */\n onDependency?: (file: string) => void\n}\n\n/**\n * The structural slice of Tailwind's design system the configurator relies on. The real object's types hide most of this behind private fields, so the loader narrows to what is actually used; verified against tailwindcss 4.3.x and guarded by tests.\n */\nexport interface DesignSystemAccess {\n theme: {\n prefix: string | null\n entries(): Iterable<[string, unknown]>\n }\n utilities: {\n keys(kind: 'static' | 'functional'): string[]\n /** Suggestions retain their utility branches here; getClassList deduplicates overlapping names and omits modifiers for roots without named base values. */\n getCompletions(root: string): {\n values: (string | null)[]\n modifiers: string[]\n supportsNegative?: boolean\n }[]\n }\n /** Whether `@import 'tailwindcss' important` marks every utility declaration important. */\n important: boolean\n getClassList(): [string, { modifiers: string[] }][]\n /** Variant suggestions and selector templates, including CSS and JavaScript registrations. */\n getVariants(): {\n name: string\n values: string[]\n hasDash: boolean\n selectors(options?: { value?: string }): string[]\n }[]\n candidatesToCss(classes: string[]): (string | null)[]\n}\n\nexport interface LoadDesignSystemsOptions {\n css: string\n base: string\n integration?: TailwindIntegration\n}\n\n/**\n * Loads project and vanilla systems through the same installed compiler and CSS-resolution base. The vanilla system is the reference for diffing and classifying theme-created classes; comparisons are only meaningful with an identical compiler.\n */\nexport async function loadDesignSystems({\n css,\n base,\n integration,\n}: LoadDesignSystemsOptions): Promise<{\n project: DesignSystemAccess\n vanilla: DesignSystemAccess\n}> {\n const project = (await loadDesignSystem(css, base, integration)) as unknown as DesignSystemAccess\n // The baseline mirrors the entrypoint's `important` import option: under it every project declaration is important, and the coverage checks that recognize custom utilities as aliases of built-in ones compare importance, so the vanilla exemplars must carry it too. The prefix option needs no mirroring — candidates are prefixed at the compile boundary.\n const vanilla = await loadDesignSystem(\n `@import 'tailwindcss'${project.important ? ' important' : ''};`,\n base,\n integration,\n )\n\n return {\n project: memoizeClassList(project),\n vanilla: memoizeClassList(vanilla as unknown as DesignSystemAccess),\n }\n}\n\n/** The node wrapper currently drops resolver hooks when loading a design system. Use its own Tailwind engine with explicit loaders for bundler integrations, without changing globals or resolving a different compiler from the project. */\nasync function loadDesignSystem(css: string, base: string, integration?: TailwindIntegration) {\n if (!integration) {\n return __unstable__loadDesignSystem(css, { base })\n }\n const engine = await (tailwindEngine ??= loadTailwindEngine())\n const resolveStylesheet = createStylesheetResolver(\n integration.resolveCss,\n integration.onDependency,\n integration.onDependency,\n )\n const resolveModule = createModuleResolver(integration.resolveJs, integration.onDependency)\n return engine.__unstable__loadDesignSystem(css, {\n base,\n async loadStylesheet(id, from) {\n const file = await resolveStylesheet(id, from)\n return { path: file, base: path.dirname(file), content: await readFile(file, 'utf8') }\n },\n async loadModule(id, from) {\n const file = await resolveModule(id, from)\n // Tailwind reports a module's transitive imports only after importing it. Walk them first, so an integration records each file (and its modification time) before the import reads it, and so a missing transitive target is reported even when the import fails.\n if (integration.onDependency) {\n await trackModuleDependencies(file, integration.onDependency)\n }\n // Tailwind only collects transitive dependencies and busts ESM caches for relative module requests. Aliases resolving to local configs/plugins must follow that same path.\n return loadModule(\n `./${path.relative(from, file)}`,\n from,\n integration.onDependency ?? (() => {}),\n // Reuse the fresh resolution instead of re-entering Tailwind's cached resolver, which can still consider a newly created module missing.\n async () => file,\n )\n },\n })\n}\n\nlet tailwindEngine: Promise<typeof TailwindEngine> | undefined\n\n/** Resolves and imports the compiler once per process. A failed load is not kept: the next generation retries, e.g. once an install has finished relinking node_modules, instead of every later generation in a dev server rethrowing the stale error. */\nfunction loadTailwindEngine(): Promise<typeof TailwindEngine> {\n const engine = loadModule(\n 'tailwindcss',\n path.dirname(fileURLToPath(import.meta.resolve('@tailwindcss/node'))),\n () => {},\n ).then<typeof TailwindEngine>(({ path: file }) => import(pathToFileURL(file).href))\n engine.catch(() => {\n tailwindEngine = undefined\n })\n return engine\n}\n\n/**\n * Caches `getClassList()` on a loaded design system. Tailwind rebuilds the list on every call, and the custom-utility, augmentation, and collision passes share it. Repeated rebuilds previously dominated generation time on themes with many custom utilities. A loaded design system never changes, so caching is safe; consumers replace the object for a new theme.\n */\nfunction memoizeClassList(designSystem: DesignSystemAccess): DesignSystemAccess {\n const original = designSystem.getClassList.bind(designSystem)\n let classList: ReturnType<DesignSystemAccess['getClassList']> | undefined\n designSystem.getClassList = () => (classList ??= original())\n return designSystem\n}\n\n/**\n * Compiles a class through Tailwind and returns its declarations, or null when the class produces no CSS. Callers pass unprefixed class names (the form `getClassList()` uses everywhere); the candidate is prefixed automatically when the theme defines a prefix, because Tailwind only compiles `tw:p-2`-style candidates there — without this, every declaration-based pass silently saw prefixed themes as producing no CSS. `@property` registrations and `@keyframes` bodies are skipped: composable utilities share the former without conflicting, and the latter describe animation frames, not what the class sets on an element. Values matter to the conflict oracle: two classes re-declaring the same property with identical text are idempotent together and carry their real state elsewhere (usually in custom properties).\n */\nexport function declaredDeclarations(\n designSystem: DesignSystemAccess,\n className: string,\n): DeclarationEntry[] | null {\n let cache = declarationsCache.get(designSystem)\n if (!cache) {\n cache = new Map()\n declarationsCache.set(designSystem, cache)\n }\n\n let declarations = cache.get(className)\n if (declarations === undefined) {\n const candidate = toCandidate(designSystem, className)\n const css = designSystem.candidatesToCss([candidate])[0] ?? null\n declarations = css === null ? null : parseDeclarations(css, candidate)\n cache.set(className, declarations)\n }\n\n return declarations\n}\n\n/**\n * The context-qualified property names of a class — the signature used for class-group classification, where values and conditions don't matter but render targets do: `color` on the element and `color` on `::before` are different things to set.\n */\nexport function declaredProperties(\n designSystem: DesignSystemAccess,\n className: string,\n): Set<string> | null {\n const declarations = declaredDeclarations(designSystem, className)\n return declarations === null\n ? null\n : new Set(declarations.map((entry) => qualifiedProperty(entry)))\n}\n\n/** Key joining render target and property name, e.g. `'::after border-color'`; base-context entries stay the bare property name. */\nexport function qualifiedProperty(entry: { context: string; property: string }): string {\n return entry.context === '' ? entry.property : `${entry.context} ${entry.property}`\n}\n\n/** Shared scaffolding must apply under the same guards on the same target; equal property/value text alone cannot prove that. Header order is kept conservatively rather than attempting CSS condition equivalence. */\nexport function sameDeclarationScope(first: DeclarationEntry, second: DeclarationEntry): boolean {\n return (\n first.context === second.context &&\n first.scope.length === second.scope.length &&\n first.scope.every((header, index) => header === second.scope[index])\n )\n}\n\n/**\n * Whether each class name compiles to CSS, checked in one `candidatesToCss` batch — the batched boolean form of the prefix-aware compilation `declaredDeclarations` does per class. Use one of the two over raw `candidatesToCss` so the answer holds for prefixed themes.\n */\nexport function classesCompile(designSystem: DesignSystemAccess, classNames: string[]): boolean[] {\n const candidates = classNames.map((className) => toCandidate(designSystem, className))\n return designSystem.candidatesToCss(candidates).map((compiledCss) => compiledCss !== null)\n}\n\n/** The candidate string Tailwind compiles for a class name: prefixed under a theme prefix (`tw:p-2`), the name itself otherwise. Class lists and everything downstream of them stay unprefixed, so the prefix exists only at this compilation boundary. */\nfunction toCandidate(designSystem: DesignSystemAccess, className: string): string {\n const prefix = designSystem.theme.prefix\n return prefix === null ? className : `${prefix}:${className}`\n}\n\nconst declarationsCache = new WeakMap<DesignSystemAccess, Map<string, DeclarationEntry[] | null>>()\n\n/** Proper-subset check over property names, used to recognize classes whose declarations span multiple groups' signatures. */\nexport function haveProperSubset(subset: Set<string>, superset: Set<string>): boolean {\n return subset.size < superset.size && [...subset].every((property) => superset.has(property))\n}\n\n/** Set equality over property names — the strict form of \"these classes set the same things\". */\nexport function havePropertiesEqual(first: Set<string>, second: Set<string>): boolean {\n return first.size === second.size && [...first].every((property) => second.has(property))\n}\n","import {\n type DeclarationEntry,\n type DesignSystemAccess,\n declaredDeclarations,\n declaredProperties,\n haveProperSubset,\n havePropertiesEqual,\n sameDeclarationScope,\n} from './design-system.ts'\n\nexport interface CollisionResolution {\n className: string\n /** The group whose scale value wrongly claims the class. */\n claimingGroupId: string\n /** The corrected owner for restoration, or the pre-theme matcher also removed during neutralization. If the name had no pre-theme matcher, neutralization repeats the claiming group here. */\n ownerGroupId: string\n /** 'restore': the owner's classification is the correct one, take the claim away from the claiming group. 'neutralize': the class now resolves through multiple utilities at once, so it must not belong to any group — take every claim away and let it pass through unmerged. */\n resolution: 'restore' | 'neutralize'\n}\n\nexport interface AugmentationResult {\n /** Full class names to append per class group ID, in class-list order. */\n assignments: Map<string, string[]>\n /** Classes with incompatible claims from theme-derived or default matchers, including newly suggested names already covered by a vanilla validator. */\n collisions: CollisionResolution[]\n /** Classes no group could be determined for, with the reason — reported instead of guessed. */\n unassigned: { className: string; reason: string }[]\n}\n\nexport interface BuildAugmentationsOptions {\n project: DesignSystemAccess\n vanilla: DesignSystemAccess\n /** Classifies a class name against the config generated from the project's theme (before augmentation). Classes it already places correctly need no augmentation. */\n projectClassGroupId: (className: string) => string | undefined\n /** Classifies a class name against a config generated from the vanilla theme, used to bucket vanilla sibling classes into candidate groups. */\n vanillaClassGroupId: (className: string) => string | undefined\n /** Class-name prefixes per group ID, from the group definitions' object keys. Groups listing several prefixes (`start` holds both `inset-s` and the deprecated `start` spelling) drive alias-spelling expansion: Tailwind's class list only suggests one spelling, so the others must be probed. */\n groupPrefixKeys: Map<string, string[]>\n /** Groups already classified by custom-utility inference. Property signatures alone must not undo its condition-aware decisions. */\n customGroupIds: ReadonlySet<string>\n /** Custom names whose opposite-sign or postfix effects cannot safely share runtime lookup. */\n preservedCustomClasses: ReadonlySet<string>\n}\n\n/**\n * Finds new and reinterpreted project classes and determines their owning groups empirically, without a maintained namespace table.\n *\n * Mechanism: diff the project's class list against the vanilla one. Every new class is matched against candidate groups derived from its vanilla siblings (classes sharing the first name segment, e.g. `text-…`), where each candidate group is represented by the declared-property signature of one exemplar class. A unique signature match assigns the group — `text-primary` declares `color` like `text-red-500` does, not `font-size` like `text-xl` — which handles Tailwind's undocumented compat sub-namespaces (`--text-color-*`, `--background-color-*`) and namespaces tailwind-merge has no theme key for (`--z-index-*`, `--border-width-*`) with one rule. Ambiguous or unmatched classes are reported, never guessed.\n * Existing names are also checked when their group claim or membership in Tailwind's grouped suggestions changes; the deduplicated class list alone cannot reveal an added interpretation.\n */\nexport function buildAugmentations({\n project,\n vanilla,\n projectClassGroupId,\n vanillaClassGroupId,\n groupPrefixKeys,\n customGroupIds,\n preservedCustomClasses,\n}: BuildAugmentationsOptions): AugmentationResult {\n const vanillaClassNames = vanilla.getClassList().map(([className]) => className)\n const vanillaClassNameSet = new Set(vanillaClassNames)\n\n const projectClassNames = project.getClassList().map(([className]) => className)\n const newClassNames = projectClassNames.filter((className) => !vanillaClassNameSet.has(className))\n const projectClassNameSet = new Set(projectClassNames)\n\n const exemplarsByFirstSegment = collectExemplars(vanillaClassNames, vanillaClassGroupId)\n const changedSuggestionNames = changedUtilitySuggestions(project, vanilla)\n\n const assignments = new Map<string, string[]>()\n const collisions: CollisionResolution[] = []\n const unassigned: { className: string; reason: string }[] = []\n const handledNames = new Set<string>()\n\n for (const className of newClassNames) {\n // Negative utilities ('-z-header') resolve through the same class-map path as their positive form because the parser skips the leading dash, so only the positive name gets registered and each positive/negative pair is handled once.\n const registrationName = className.startsWith('-') ? className.slice(1) : className\n if (handledNames.has(registrationName)) {\n continue\n }\n if (preservedCustomClasses.has(registrationName)) {\n handledNames.add(registrationName)\n unassigned.push({\n className: registrationName,\n reason: 'Custom utility effects cannot be distinguished safely by runtime lookup',\n })\n continue\n }\n const claimingGroupId = projectClassGroupId(registrationName)\n if (claimingGroupId !== undefined && customGroupIds.has(claimingGroupId)) {\n // A custom border-grid can share border-color's property names while adding dark-mode effects. Keep its established ownership even when its name resembles a built-in root.\n continue\n }\n\n const properties = declaredProperties(project, className)\n if (properties === null || properties.size === 0) {\n // Suggestion-only entries that don't compile produce no CSS and can't conflict with anything.\n continue\n }\n handledNames.add(registrationName)\n\n // Classify the positive spelling: the class list sorts negative names first, and `-col-full` bucketed under its empty first segment would only see vanilla negatives — none exist for grid columns — while the `col` bucket holds the exemplar it needs.\n const targetGroupId = classifyByProperties(\n registrationName,\n properties,\n exemplarsByFirstSegment,\n vanilla,\n )\n\n if (typeof targetGroupId !== 'string') {\n if (targetGroupId.isJanus && claimingGroupId !== undefined) {\n // New suggestions can already match a vanilla validator: border-x-13 gains color while retaining its width. Remove both claims just as for an existing suggested name, or removing only the color would expose the width matcher again.\n collisions.push({\n className: registrationName,\n claimingGroupId,\n ownerGroupId: vanillaClassGroupId(registrationName) ?? claimingGroupId,\n resolution: 'neutralize',\n })\n continue\n }\n // The generated config may already classify the class correctly through the standard namespaces (e.g. a custom `--text-*` size); only real gaps are worth reporting.\n if (claimingGroupId === undefined) {\n unassigned.push({ className: registrationName, reason: targetGroupId.reason })\n }\n continue\n }\n\n if (claimingGroupId === targetGroupId) {\n continue\n }\n if (claimingGroupId !== undefined) {\n // Another group's scale already claims the new class — a theme value name that exists in two namespaces one utility reads (`--shadow-brand` next to `--color-brand` makes `shadow-brand` a box shadow, yet the color scale's `brand` claims it for shadow-color too), or a numeric color token shadowing a bare-number value (`--color-4` vs `decoration-4`, which Tailwind keeps as a thickness). Appending the class to its owner group below is not enough when both claims are literals on the same path — the later group in the config would win — so the wrong claim is also removed like any other collision.\n collisions.push({\n className: registrationName,\n claimingGroupId,\n ownerGroupId: targetGroupId,\n resolution: 'restore',\n })\n }\n\n const groupClassNames = assignments.get(targetGroupId)\n if (groupClassNames) {\n groupClassNames.push(registrationName)\n } else {\n assignments.set(targetGroupId, [registrationName])\n }\n\n // Alias-spelling expansion: the class list only suggests one spelling of utilities that exist under several names (`inset-s-sm` but never the deprecated `start-sm`), so a value assigned through one of a group's prefixes is probed under the group's other prefixes. Only spellings Tailwind compiles to the identical declarations join — empirically verified, like everything else here.\n for (const aliasName of aliasSpellings(registrationName, targetGroupId, groupPrefixKeys)) {\n if (handledNames.has(aliasName) || projectClassGroupId(aliasName) === targetGroupId) {\n continue\n }\n const aliasDeclarations = declaredDeclarations(project, aliasName)\n const classDeclarations = declaredDeclarations(project, registrationName)\n if (\n aliasDeclarations !== null &&\n classDeclarations !== null &&\n declarationsEqual(aliasDeclarations, classDeclarations)\n ) {\n handledNames.add(aliasName)\n assignments.get(targetGroupId)!.push(aliasName)\n }\n }\n }\n\n // Existing names need a declaration check when their suggestion branch changes, even if both classifiers return the same group: --text-color-base adds text-base to the color suggestions without changing its old font-size matcher. Checking the grouped suggestions avoids compiling every unchanged vanilla class. Custom-utility inference already checked its own groups and must retain ownership.\n for (const className of vanillaClassNames) {\n const registrationName = className.startsWith('-') ? className.slice(1) : className\n const projectGroupId = projectClassGroupId(className)\n const vanillaGroupId = vanillaClassGroupId(className)\n if (\n (projectGroupId === vanillaGroupId && !changedSuggestionNames.has(registrationName)) ||\n (projectGroupId === undefined && !projectClassNameSet.has(className)) ||\n vanillaGroupId === undefined ||\n (projectGroupId !== undefined && customGroupIds.has(projectGroupId))\n ) {\n continue\n }\n\n if (handledNames.has(registrationName)) {\n continue\n }\n\n const properties = declaredProperties(project, className)\n if (properties === null || properties.size === 0) {\n continue\n }\n handledNames.add(registrationName)\n\n if (projectGroupId === undefined) {\n // The project config lost its claim on a vanilla name that Tailwind still suggests and compiles: a reset namespace re-added through a compat sub-namespace (`--color-*: initial` plus `--background-color-white`). Neither loop would otherwise register it — it is not new, and there is no claim to correct — so classify it like a new class. A plain reset drops the name from the project's class list, which keeps this off the thousands of classes a reset removes.\n const targetGroupId = classifyByProperties(\n registrationName,\n properties,\n exemplarsByFirstSegment,\n vanilla,\n )\n if (typeof targetGroupId === 'string') {\n const groupClassNames = assignments.get(targetGroupId) ?? []\n groupClassNames.push(registrationName)\n assignments.set(targetGroupId, groupClassNames)\n } else if (!targetGroupId.isJanus) {\n unassigned.push({ className: registrationName, reason: targetGroupId.reason })\n }\n continue\n }\n\n const vanillaProperties = declaredProperties(vanilla, className)\n if (vanillaProperties !== null && havePropertiesEqual(properties, vanillaProperties)) {\n if (projectGroupId !== vanillaGroupId) {\n collisions.push({\n className: registrationName,\n claimingGroupId: projectGroupId,\n ownerGroupId: vanillaGroupId,\n resolution: 'restore',\n })\n }\n continue\n }\n const claimingSignature = exemplarsByFirstSegment\n .get(firstNameSegment(className))\n ?.get(projectGroupId)\n const claimingProperties =\n claimingSignature === undefined ? null : declaredProperties(vanilla, claimingSignature)\n if (\n vanillaProperties !== null &&\n claimingProperties !== null &&\n haveProperSubset(vanillaProperties, properties) &&\n [...claimingProperties].every((property) => properties.has(property))\n ) {\n collisions.push({\n className: registrationName,\n claimingGroupId: projectGroupId,\n ownerGroupId: vanillaGroupId,\n resolution: 'neutralize',\n })\n continue\n }\n\n const targetGroupId = classifyByProperties(\n className,\n properties,\n exemplarsByFirstSegment,\n vanilla,\n )\n\n if (targetGroupId === projectGroupId) {\n // Tailwind really does resolve the class differently now (e.g. `text-xl` becoming a color) — the new classification is correct.\n continue\n }\n if (typeof targetGroupId !== 'string' && targetGroupId.isJanus) {\n collisions.push({\n className: registrationName,\n claimingGroupId: projectGroupId,\n ownerGroupId: vanillaGroupId,\n resolution: 'neutralize',\n })\n } else if (typeof targetGroupId === 'string') {\n if (targetGroupId !== vanillaGroupId) {\n // The new owner may have no existing matcher for this name (or may have been reset entirely), so removing the old claim alone is insufficient.\n const groupClassNames = assignments.get(targetGroupId) ?? []\n groupClassNames.push(registrationName)\n assignments.set(targetGroupId, groupClassNames)\n }\n collisions.push({\n className: registrationName,\n claimingGroupId: projectGroupId,\n ownerGroupId: targetGroupId,\n resolution: 'restore',\n })\n } else {\n unassigned.push({\n className: registrationName,\n reason: `classification changed but ${targetGroupId.reason}`,\n })\n }\n }\n\n return { assignments, collisions, unassigned }\n}\n\n/**\n * Finds names added to or removed from each Tailwind suggestion branch, before getClassList merges duplicate names. A name can move between branches or gain a second interpretation while remaining in the final class list. Branches are compared by position within the same compiler's utility definition; a reordered branch only causes extra declaration checks. Negative forms share their positive registration path.\n */\nfunction changedUtilitySuggestions(project: DesignSystemAccess, vanilla: DesignSystemAccess): Set<string> {\n const changed = new Set<string>()\n for (const root of vanilla.utilities.keys('functional')) {\n const before = vanilla.utilities.getCompletions(root)\n const after = project.utilities.getCompletions(root)\n for (let index = 0; index < Math.max(before.length, after.length); index++) {\n const previousValues = new Set(before[index]?.values ?? [])\n const nextValues = new Set(after[index]?.values ?? [])\n for (const value of new Set([...previousValues, ...nextValues])) {\n if (previousValues.has(value) !== nextValues.has(value)) {\n changed.add(value === null ? root : `${root}-${value}`)\n }\n }\n }\n }\n return changed\n}\n\n/**\n * One exemplar class per (first name segment, class group) pair, e.g. `text` → text-color: `text-red-500`. Only exemplars for segments that actually need classification get compiled later, so collecting names here is cheap.\n */\nfunction collectExemplars(\n vanillaClassNames: string[],\n vanillaClassGroupId: (className: string) => string | undefined,\n): Map<string, Map<string, string>> {\n const exemplarsByFirstSegment = new Map<string, Map<string, string>>()\n\n for (const className of vanillaClassNames) {\n const firstSegment = firstNameSegment(className)\n let groupExemplars = exemplarsByFirstSegment.get(firstSegment)\n if (groupExemplars === undefined) {\n groupExemplars = new Map()\n exemplarsByFirstSegment.set(firstSegment, groupExemplars)\n }\n\n const classGroupId = vanillaClassGroupId(className)\n if (classGroupId !== undefined && !groupExemplars.has(classGroupId)) {\n groupExemplars.set(classGroupId, className)\n }\n }\n\n return exemplarsByFirstSegment\n}\n\nfunction classifyByProperties(\n className: string,\n properties: Set<string>,\n exemplarsByFirstSegment: Map<string, Map<string, string>>,\n vanilla: DesignSystemAccess,\n): string | { reason: string; isJanus: boolean } {\n const groupExemplars = exemplarsByFirstSegment.get(firstNameSegment(className))\n if (!groupExemplars || groupExemplars.size === 0) {\n return { reason: 'no vanilla classes share its root', isJanus: false }\n }\n\n const matches: string[] = []\n let containedSignatures = 0\n for (const [classGroupId, exemplarClassName] of groupExemplars) {\n const exemplarProperties = declaredProperties(vanilla, exemplarClassName)\n if (exemplarProperties === null) {\n continue\n }\n if (havePropertiesEqual(properties, exemplarProperties)) {\n matches.push(classGroupId)\n } else if (haveProperSubset(exemplarProperties, properties)) {\n containedSignatures += 1\n }\n }\n\n if (matches.length === 1) {\n return matches[0]!\n }\n if (matches.length === 0 && containedSignatures >= 2) {\n // Tailwind resolved the candidate through several interpretations at once and emitted all their declarations in one rule (e.g. `bg-bottom` with a `--color-bottom` theme value declares both background-color and background-position). Such a class cannot belong to one conflict group: merging it away in either direction would lose part of its effect.\n return { reason: 'resolves as multiple utilities at once', isJanus: true }\n }\n return {\n reason:\n matches.length === 0\n ? 'no candidate group declares the same CSS properties'\n : `ambiguous between class groups ${matches.join(', ')}`,\n isJanus: false,\n }\n}\n\nfunction firstNameSegment(className: string): string {\n const separatorIndex = className.indexOf('-')\n return separatorIndex === -1 ? className : className.slice(0, separatorIndex)\n}\n\n/**\n * The same value under the target group's other class-name prefixes: `inset-s-sm` assigned to the `start` group (prefixes `inset-s` and `start`) yields the candidate `start-sm`. The longest matching prefix decides where the value part begins, so a prefix that happens to prefix another never mis-splits the name.\n */\nfunction aliasSpellings(\n className: string,\n groupId: string,\n groupPrefixKeys: Map<string, string[]>,\n): string[] {\n const prefixes = groupPrefixKeys.get(groupId)\n if (!prefixes || prefixes.length < 2) {\n return []\n }\n\n const matchedPrefix = prefixes\n .filter((prefix) => className.startsWith(`${prefix}-`))\n .sort((first, second) => second.length - first.length)[0]\n if (matchedPrefix === undefined) {\n return []\n }\n\n const value = className.slice(matchedPrefix.length + 1)\n return prefixes\n .filter((prefix) => prefix !== matchedPrefix)\n .map((prefix) => `${prefix}-${value}`)\n}\n\n/** Exact equality of two compiled declaration lists — the bar for treating two spellings as the same utility. */\nfunction declarationsEqual(first: DeclarationEntry[], second: DeclarationEntry[]): boolean {\n return (\n first.length === second.length &&\n first.every((entry, index) => {\n const other = second[index]!\n return (\n sameDeclarationScope(entry, other) &&\n entry.property === other.property &&\n entry.important === other.important &&\n entry.value === other.value\n )\n })\n )\n}\n","import { validators } from 'tailwind-merge'\n\nimport { type PlanValue, type ValidatorName } from './plan.ts'\n\n/**\n * How finite value sets (theme scales, custom-utility value spaces) are encoded into class-group matchers.\n *\n * - 'compact': smallest emitted representation wins, even when a validator matches names beyond the actual set. The classic overmatch premise \"merging a class that produces no CSS is harmless\" turned out to be wrong for merge semantics — a classified class gains eviction power, so `twMerge('rounded-md', 'rounded-xs')` drops the real `rounded-md` when `rounded-xs` isn't in the theme but matches the scale's validator (first reported from the field, 2026-08-13). Compact stays the default because the damage is limited to class names outside the theme, which linting normally rules out — the config is correct for correct usage of the theme's tokens.\n * - 'exact': finite named scales enumerate only names that exist, avoiding eviction by nonexistent named tokens at a size cost. Arbitrary-value types remain approximate; this is not validation of every possible CSS value.\n *\n * Genuinely open-ended value spaces (the bare `--spacing` multiplier, arbitrary values, bare numbers on utilities that accept any) keep their validators in both modes — a validator is only \"overmatching\" when the real value set is finite.\n */\nexport type EncodingMode = 'compact' | 'exact'\n\nexport interface ScaleEncoding {\n items: PlanValue[]\n /** Which encoding won, for reporting. Not part of the generated output. */\n strategy: string\n}\n\n/**\n * Encodes a theme scale's value names into the smallest class-group representation the mode allows.\n *\n * Policy: the encoding must never fail to match a name that exists in the theme; whether it may overmatch names that don't exist is what `EncodingMode` decides. Candidates are compared by estimated emitted size:\n * - plain enumeration of all names\n * - 'compact' only: a validator covering all names, plus enumerated outliers (e.g. t-shirt sizes with a `base` outlier)\n * - families with a shared first segment collapsed into a nested entry (e.g. `{ red: [isNumber] }` for `red-50` … `red-950` — in 'exact' mode the tails enumerate instead, staying exact because only listed prefix+tail combinations match)\n *\n * The family encoding also mirrors Tailwind's own resolution order better than a flat validator: a named part match wins over sibling validators in the class map, exactly like Tailwind prefers a color namespace hit over a bare value interpretation.\n */\nexport function encodeScale(names: string[], encoding: EncodingMode): ScaleEncoding {\n if (names.length === 0) {\n return { items: [], strategy: 'empty' }\n }\n\n const candidates = [\n ...(encoding === 'compact' ? encodeWithValidators(names) : []),\n encodeAsFamilies(names, encoding),\n { items: names.map(literal), strategy: 'enumerated' },\n ].filter((candidate): candidate is ScaleEncoding => candidate !== null)\n\n let best = candidates[0]!\n let bestCost = estimateCost(best.items)\n\n for (let index = 1; index < candidates.length; index++) {\n const candidate = candidates[index]!\n const cost = estimateCost(candidate.items)\n if (cost < bestCost) {\n best = candidate\n bestCost = cost\n }\n }\n\n return best\n}\n\n/**\n * Rough size in characters of the emitted representation. Only used to compare encodings of the same scale against each other, so precision doesn't matter as long as it is monotonic with real output size.\n */\nexport function estimateCost(items: PlanValue[]): number {\n let cost = 0\n\n for (const item of items) {\n if (item.kind === 'class') {\n cost += item.value.length + 4\n } else if (item.kind === 'validator') {\n cost += item.name.length + 4\n } else {\n cost += 4\n for (const [key, entryItems] of item.entries) {\n cost += key.length + 4 + estimateCost(entryItems)\n }\n }\n }\n\n return cost\n}\n\n/**\n * Validators that are worth trying as whole-scale replacements. Ordered from most to least specific so that on equal cost the least overmatching candidate wins via first-strictly-smaller comparison in `encodeScale`.\n */\nconst VALIDATOR_CANDIDATES: [ValidatorName, (value: string) => boolean][] = [\n ['isTshirtSize', validators.isTshirtSize],\n ['isFraction', validators.isFraction],\n ['isNumber', validators.isNumber],\n]\n\nfunction encodeWithValidators(names: string[]): ScaleEncoding[] {\n return VALIDATOR_CANDIDATES.flatMap(([name, validator]) => {\n const outliers = names.filter((value) => !validator(value))\n const coveredCount = names.length - outliers.length\n\n // A validator needs to replace a meaningful number of names to be worth the overmatching, and outliers dominating means it's the wrong validator for this scale.\n if (coveredCount < 3 || outliers.length > coveredCount) {\n return []\n }\n\n return [\n {\n items: [...outliers.map(literal), { kind: 'validator' as const, name }],\n strategy: outliers.length === 0 ? `validator:${name}` : `mixed:${name}`,\n },\n ]\n })\n}\n\n/**\n * Collapses names sharing a first segment into one nested entry per family, with the tails themselves encoded recursively through `encodeScale` — so numeric shades still end in a validator (`{ red: [isNumber] }`), word tails enumerate without repeating the prefix (`{ gap: ['narrow', 'wide'] }`), and multi-segment names factor further (`{ background: [{ alternative: [isNumber] }] }`). Each family keeps the factored form only when it estimates smaller than enumerating its members, so short families don't pay the object overhead. Structural factoring measures smaller on minified AND compressed output (unlike reference-based sharing, it removes repetition without adding entropy — see EmitOptions.sharing for that contrast).\n */\nfunction encodeAsFamilies(names: string[], encoding: EncodingMode): ScaleEncoding | null {\n const families = new Map<string, { tails: string[]; enumeratedCost: number }>()\n\n for (const name of names) {\n const separatorIndex = name.indexOf('-')\n if (separatorIndex > 0) {\n const familyName = name.slice(0, separatorIndex)\n const tail = name.slice(separatorIndex + 1)\n let family = families.get(familyName)\n if (!family) {\n family = { tails: [], enumeratedCost: 0 }\n families.set(familyName, family)\n }\n family.tails.push(tail)\n family.enumeratedCost += name.length + 4\n }\n }\n\n const factoredFamilies = new Map<string, PlanValue[]>()\n for (const [familyName, { tails, enumeratedCost }] of families) {\n if (tails.length < 2) {\n continue\n }\n const tailEncoding = encodeScale(tails, encoding)\n if (familyName.length + 4 + estimateCost(tailEncoding.items) < enumeratedCost) {\n factoredFamilies.set(familyName, tailEncoding.items)\n }\n }\n\n if (factoredFamilies.size === 0) {\n return null\n }\n\n // Emit in original theme order: the first member of a factored family becomes the shared object (all families in one object literal), other members are skipped, everything else stays enumerated.\n const items: PlanValue[] = []\n const familiesObject: PlanValue = { kind: 'object', entries: [] }\n const emittedFamilies = new Set<string>()\n\n for (const name of names) {\n const separatorIndex = name.indexOf('-')\n const familyName = separatorIndex > 0 ? name.slice(0, separatorIndex) : null\n\n if (familyName === null || !factoredFamilies.has(familyName)) {\n items.push(literal(name))\n continue\n }\n\n if (!emittedFamilies.has(familyName)) {\n emittedFamilies.add(familyName)\n if (familiesObject.entries.length === 0) {\n items.push(familiesObject)\n }\n familiesObject.entries.push([familyName, factoredFamilies.get(familyName)!])\n }\n }\n\n return { items, strategy: 'families' }\n}\n\nfunction literal(value: string): PlanValue {\n return { kind: 'class', value }\n}\n","/**\n * Whether setting one property fully controls another, using only known CSS shorthand relationships. Name resemblance is insufficient: `font` excludes `font-synthesis`, and `border-width` excludes `border-image-width`. Unknown relationships preserve classes conservatively.\n * Logical axis coverage follows the default config's horizontal-tb policy (`padding-inline` covers left/right). Single logical sides remain unrelated to physical sides because their mapping also depends on text direction.\n */\nexport function propertyCovers(property: string, target: string): boolean {\n if (property === target) {\n return true\n }\n const longhands = SHORTHAND_LONGHANDS.get(property)\n if (!longhands) {\n return false\n }\n const targetLonghands = SHORTHAND_LONGHANDS.get(target)\n return targetLonghands\n ? [...targetLonghands].every((longhand) => longhands.has(longhand))\n : longhands.has(target)\n}\n\n/** Expands the known shorthand graph once, including reset-only longhands. This also handles overlapping shorthands, such as border-inline covering border-left under the horizontal-tb policy, without guessing from property names. */\nfunction buildShorthandLonghands(): Map<string, Set<string>> {\n const shorthands = new Map<string, string[]>(Object.entries({\n animation: [\n 'animation-name', 'animation-duration', 'animation-timing-function',\n 'animation-delay', 'animation-iteration-count', 'animation-direction',\n 'animation-fill-mode', 'animation-play-state',\n ],\n background: [\n 'background-image', 'background-position', 'background-size', 'background-repeat',\n 'background-origin', 'background-clip', 'background-attachment', 'background-color',\n ],\n 'background-position': ['background-position-x', 'background-position-y'],\n border: ['border-width', 'border-style', 'border-color', 'border-image'],\n 'border-image': [\n 'border-image-source', 'border-image-slice', 'border-image-width',\n 'border-image-outset', 'border-image-repeat',\n ],\n 'border-radius': [\n 'border-top-left-radius', 'border-top-right-radius',\n 'border-bottom-left-radius', 'border-bottom-right-radius',\n 'border-start-start-radius', 'border-start-end-radius',\n 'border-end-start-radius', 'border-end-end-radius',\n ],\n 'column-rule': ['column-rule-width', 'column-rule-style', 'column-rule-color'],\n columns: ['column-width', 'column-count'],\n container: ['container-name', 'container-type'],\n flex: ['flex-grow', 'flex-shrink', 'flex-basis'],\n 'flex-flow': ['flex-direction', 'flex-wrap'],\n // CSS Fonts Level 4 defines these longhands, including reset-only ones. Synthesis and palette remain independent: https://www.w3.org/TR/css-fonts-4/#font-prop\n font: [\n 'font-family', 'font-size', 'font-width', 'font-stretch', 'font-style',\n 'font-weight', 'line-height', 'font-variant', 'font-feature-settings',\n 'font-kerning', 'font-language-override', 'font-optical-sizing',\n 'font-size-adjust', 'font-variation-settings',\n ],\n 'font-variant': [\n 'font-variant-alternates', 'font-variant-caps', 'font-variant-east-asian',\n 'font-variant-emoji', 'font-variant-ligatures', 'font-variant-numeric',\n 'font-variant-position',\n ],\n 'font-synthesis': [\n 'font-synthesis-weight', 'font-synthesis-style',\n 'font-synthesis-small-caps', 'font-synthesis-position',\n ],\n gap: ['row-gap', 'column-gap'],\n grid: ['grid-template', 'grid-auto-flow', 'grid-auto-rows', 'grid-auto-columns'],\n 'grid-template': ['grid-template-rows', 'grid-template-columns', 'grid-template-areas'],\n 'grid-area': ['grid-row', 'grid-column'],\n 'grid-row': ['grid-row-start', 'grid-row-end'],\n 'grid-column': ['grid-column-start', 'grid-column-end'],\n 'list-style': ['list-style-image', 'list-style-position', 'list-style-type'],\n mask: [\n 'mask-image', 'mask-mode', 'mask-position', 'mask-size', 'mask-repeat',\n 'mask-origin', 'mask-clip', 'mask-composite',\n ],\n 'mask-border': [\n 'mask-border-source', 'mask-border-slice', 'mask-border-width',\n 'mask-border-outset', 'mask-border-repeat', 'mask-border-mode',\n ],\n offset: ['offset-position', 'offset-path', 'offset-distance', 'offset-rotate', 'offset-anchor'],\n outline: ['outline-width', 'outline-style', 'outline-color'],\n overflow: ['overflow-x', 'overflow-y'],\n 'overscroll-behavior': ['overscroll-behavior-x', 'overscroll-behavior-y'],\n 'place-content': ['align-content', 'justify-content'],\n 'place-items': ['align-items', 'justify-items'],\n 'place-self': ['align-self', 'justify-self'],\n 'text-decoration': [\n 'text-decoration-line', 'text-decoration-style',\n 'text-decoration-color', 'text-decoration-thickness',\n ],\n 'text-emphasis': ['text-emphasis-style', 'text-emphasis-color'],\n transition: [\n 'transition-property', 'transition-duration', 'transition-timing-function',\n 'transition-delay', 'transition-behavior',\n ],\n '-webkit-text-stroke': ['-webkit-text-stroke-width', '-webkit-text-stroke-color'],\n }))\n\n for (const name of ['margin', 'padding', 'scroll-margin', 'scroll-padding']) {\n addBoxShorthand(shorthands, name, (side) => `${name}-${side}`)\n }\n addBoxShorthand(shorthands, 'inset', (side) =>\n side.startsWith('inline') || side.startsWith('block') ? `inset-${side}` : side,\n )\n // Border side shorthands set width/style/color; only the whole border also resets border-image. None cover radii: https://www.w3.org/TR/css-backgrounds-3/#border-shorthands\n const borderComponents = ['width', 'style', 'color']\n for (const component of borderComponents) {\n addBoxShorthand(shorthands, `border-${component}`, (side) => `border-${side}-${component}`)\n }\n for (const side of [\n 'top', 'right', 'bottom', 'left', 'inline', 'block',\n 'inline-start', 'inline-end', 'block-start', 'block-end',\n ]) {\n shorthands.set(`border-${side}`, borderComponents.map((part) => `border-${side}-${part}`))\n }\n\n const expanded = new Map<string, Set<string>>()\n const expand = (property: string): Set<string> => {\n const cached = expanded.get(property)\n if (cached) {\n return cached\n }\n const longhands = new Set<string>()\n for (const child of shorthands.get(property)!) {\n for (const longhand of shorthands.has(child) ? expand(child) : [child]) {\n longhands.add(longhand)\n }\n }\n expanded.set(property, longhands)\n return longhands\n }\n for (const property of shorthands.keys()) {\n expand(property)\n }\n return expanded\n}\n\n/** Registers a known four-sided shorthand and its logical axes, retaining the library's horizontal-tb axis policy without equating individual logical and physical sides. */\nfunction addBoxShorthand(\n shorthands: Map<string, string[]>,\n name: string,\n sideProperty: (side: string) => string,\n): void {\n shorthands.set(name, ['top', 'right', 'bottom', 'left', 'inline', 'block'].map(sideProperty))\n for (const [axis, sides] of [\n ['inline', ['left', 'right']],\n ['block', ['top', 'bottom']],\n ] as const) {\n shorthands.set(\n sideProperty(axis),\n [`${axis}-start`, `${axis}-end`, ...sides].map(sideProperty),\n )\n }\n}\n\nconst SHORTHAND_LONGHANDS = buildShorthandLonghands()\n","import { validators } from 'tailwind-merge'\n\nimport { type EncodingMode, encodeScale } from './compress.ts'\nimport { segment } from './css-statements.ts'\nimport {\n type DeclarationEntry,\n type DesignSystemAccess,\n classesCompile,\n declaredDeclarations,\n declaredProperties,\n sameDeclarationScope,\n} from './design-system.ts'\nimport { type PlanValue, type ValidatorName } from './plan.ts'\nimport { propertyCovers } from './property-coverage.ts'\n\nexport interface CustomUtilityPlan {\n /** Self-conflict groups to register (group ID → items), for utilities that are not aliases of a built-in group. */\n groups: Map<string, PlanValue[]>\n /** Static utility classes that turned out to be aliases of a built-in group — their compiled declarations match that group's signature exactly, so they join it and get its full conflict behavior (class name → group ID). */\n aliases: Map<string, string>\n /** Inferred override relationships: group ID → built-in and custom group IDs whose declarations the utility fully covers, meaning the utility coming later in a class list makes the earlier class irrelevant. */\n conflicts: Map<string, string[]>\n /** Mixed functional groups need a complete lookup before treating a slash as a modifier of the base group. */\n postfixLookupClassGroups: string[]\n /** Suggested classes at normalized lookup keys deliberately left unclassified because runtime lookup cannot safely distinguish their effects. Augmentation must preserve this decision. */\n preservedClasses: Set<string>\n /** Built-in functional roots the project registers an additional `@utility` for (`@utility text-*`). The extension is not planned, since a registry diff cannot judge how it changes the built-in's behavior: its values are classified only as far as the built-in matchers accept them, and the root is reported. */\n extendedBuiltInRoots: string[]\n}\n\nexport interface BuildCustomUtilityPlanOptions {\n project: DesignSystemAccess\n vanilla: DesignSystemAccess\n /** Classifies a class name against a config generated from the vanilla theme, used to find one exemplar class per built-in group. */\n vanillaClassGroupId: (className: string) => string | undefined\n /** How functional utilities' value spaces are encoded — see `EncodingMode`. */\n encoding: EncodingMode\n}\n\n/**\n * Plans tailwind-merge support for utilities the project registers beyond the built-ins — both `@utility` definitions in CSS and utilities added by `@plugin` JS plugins land in the same registry, so one diff covers both.\n *\n * Support is empirical, derived entirely from each utility's compiled declarations, in three tiers:\n *\n * 1. A static utility whose declarations match exactly one built-in group's signature and mutually cover its effects is an alias of that group (an unconditional `color` utility behaves like `text-red-500`), so it joins the group and merges with its classes in both directions.\n * 2. Other utilities receive self-conflict groups, splitting functional values when their compiled effects differ. When a group's declarations fully cover what another group sets (`btn` with `padding` + `border-radius` covers everything `p-4` sets; see `fullyCovers` for the exact rule), an override edge is added so the utility coming later removes the covered class. The reverse direction stays out on purpose: `p-4` after `btn` only overrides part of `btn`, and removing `btn` would lose the rest of its effect — the same partial-override rule the default config applies between `px` and `p`.\n * 3. Declarations that are conditional (media queries, dark-mode guards) or target other elements (pseudo-elements, child selectors) only count as covered when they are byte-identical shared scaffolding: they overlap only sometimes or somewhere else, so a utility that merely touches them stays side by side with whatever it partially overlaps.\n *\n * Functional roots whose slash modifiers change effects without a matching full-class group remain unclassified: the runtime's fallback from an unknown full class to its base group would otherwise discard those effects.\n *\n * Roots that already exist as built-ins are skipped entirely: shadowing changes built-in behavior in ways a registry diff cannot judge. Such roots are reported so the gap is visible instead of silent.\n */\nexport function buildCustomUtilityPlan({\n project,\n vanilla,\n vanillaClassGroupId,\n encoding,\n}: BuildCustomUtilityPlanOptions): CustomUtilityPlan {\n const vanillaRoots = new Set([\n ...vanilla.utilities.keys('static'),\n ...vanilla.utilities.keys('functional'),\n ])\n const functionalRoots = project.utilities\n .keys('functional')\n .filter((root) => !vanillaRoots.has(root))\n // Each `@utility` registration adds a suggestion branch, so a built-in root with more branches than vanilla was extended by the project.\n const extendedBuiltInRoots = project.utilities\n .keys('functional')\n .filter(\n (root) =>\n vanillaRoots.has(root) &&\n project.utilities.getCompletions(root).length >\n vanilla.utilities.getCompletions(root).length,\n )\n const staticRoots = project.utilities.keys('static').filter((root) => !vanillaRoots.has(root))\n const staticRootSet = new Set(staticRoots)\n const lookupRoots = [\n ...project.utilities.keys('static'),\n ...project.utilities.keys('functional'),\n ].map((root) => (root.startsWith('-') ? root.slice(1) : root))\n const functionalClasses = collectFunctionalClasses(project, functionalRoots)\n const functionalShapes = new Map(\n [...functionalClasses].map(([root, classNames]) => [\n root,\n groupFunctionalClasses(project, root, classNames),\n ]),\n )\n const preservedClasses = reconcileNegativeRoots(project, functionalShapes, staticRoots)\n const functionalExemplars = new Map(\n [...functionalShapes].map(([root, shapes]) => [root, shapes?.[0]?.exemplar ?? null]),\n )\n\n const groupSignatures = collectGroupSignatures(vanilla, vanillaClassGroupId)\n\n const groups = new Map<string, CustomUtilityGroup>()\n const aliases = new Map<string, string>()\n const postfixLookupClassGroups: string[] = []\n\n for (const root of staticRoots) {\n // Runtime lookup strips a leading minus before walking the class map, so a static utility registers under its unsigned name: a literal `-solo` would sit on a trie path no lookup visits. Opposite signs with incompatible effects were preserved above and skip this loop.\n const lookupRoot = root.startsWith('-') ? root.slice(1) : root\n if (preservedClasses.has(lookupRoot)) {\n continue\n }\n // A static root sharing its name with a functional custom root joins the functional group only when the two provably have the same effect (they cover each other, like a `shimmer` default alongside `shimmer-*` values) — splitting those would stop them from merging. When the functional form carries state the bare form doesn't (supabase's `hit-area` scaffold vs `hit-area-*` offsets), they stay separate groups and override inference below adds the correct one-directional relationship instead.\n if (functionalClasses.has(root)) {\n const functionalExemplar = functionalExemplars.get(root) ?? null\n if (\n functionalExemplar !== null &&\n functionalShapes.get(root)?.length === 1 &&\n fullyCovers(\n declaredDeclarations(project, root),\n declaredDeclarations(project, functionalExemplar),\n ) &&\n fullyCovers(\n declaredDeclarations(project, functionalExemplar),\n declaredDeclarations(project, root),\n )\n ) {\n continue\n }\n groups.set(`${customUtilityGroupId(lookupRoot)}.static`, {\n items: [{ kind: 'class', value: lookupRoot }],\n exemplar: root,\n })\n continue\n }\n\n const aliasGroupId = findAliasGroup(project, root, groupSignatures)\n if (aliasGroupId !== null) {\n aliases.set(lookupRoot, aliasGroupId)\n } else {\n groups.set(customUtilityGroupId(lookupRoot), {\n items: [{ kind: 'class', value: lookupRoot }],\n exemplar: root,\n })\n }\n }\n\n for (const root of functionalRoots) {\n const lookupRoot = root.startsWith('-') ? root.slice(1) : root\n const groupId = customUtilityGroupId(lookupRoot)\n const shapes = functionalShapes.get(root)\n if (!shapes) {\n for (const className of functionalClasses.get(root)!) {\n preservedClasses.add(className.startsWith('-') ? className.slice(1) : className)\n }\n continue\n }\n if (shapes.length > 1) {\n // Unresolved --value() declarations disappear independently. Keep known names and numeric kinds in their own shapes; broad arbitrary matchers cannot distinguish the remaining branches safely.\n for (const [index, shape] of shapes.entries()) {\n const valueItems = encodeScale(\n shape.classNames.map((className) => className.slice(root.length + 1)),\n 'exact',\n ).items\n valueItems.push(\n ...shape.validators\n .filter(\n (name) =>\n name !== 'isInteger' || !shape.validators.includes('isNumber'),\n )\n .map((name): PlanValue => ({ kind: 'validator', name })),\n )\n if (valueItems.length > 0) {\n const shapeGroupId = `${groupId}.${index}`\n groups.set(shapeGroupId, {\n items: [{ kind: 'object', entries: [[lookupRoot, valueItems]] }],\n exemplar: shape.exemplar,\n })\n postfixLookupClassGroups.push(shapeGroupId)\n }\n }\n continue\n }\n const items: PlanValue[] = []\n if (\n staticRootSet.has(root) &&\n !preservedClasses.has(lookupRoot) &&\n !groups.has(`${groupId}.static`)\n ) {\n items.push({ kind: 'class', value: lookupRoot })\n } else if (!staticRootSet.has(root) && bareValueJoinsRoot(project, root, shapes[0]!)) {\n // A plugin's `DEFAULT` value: Tailwind suggests and compiles the bare `tint` but registers no static root for it, so it has no other way into the group. It joins only when it provably has the same effect as the root's values.\n items.push({ kind: 'class', value: lookupRoot })\n }\n // A failed descendant lookup retries ancestor validators. Even a uniform parent must use exact matchers when nested roots exist, or isAny would reclaim child utilities deliberately preserved for incompatible or unrepresentable effects. Normalize both signs just as runtime lookup does.\n const hasDescendantRoot = lookupRoots.some((candidate) =>\n candidate.startsWith(`${lookupRoot}-`),\n )\n const valueItems =\n encoding === 'compact' && !hasDescendantRoot\n ? [{ kind: 'validator', name: 'isAny' } satisfies PlanValue]\n : exactFunctionalValueItems(\n project,\n root,\n functionalClasses\n .get(root)!\n .map((className) => className.slice(root.length + 1)),\n )\n if (valueItems.length > 0) {\n items.push({ kind: 'object', entries: [[lookupRoot, valueItems]] })\n }\n if (items.length > 0) {\n const existing = groups.get(groupId)\n groups.set(groupId, {\n items: [...(existing?.items ?? []), ...items],\n exemplar: existing?.exemplar ?? functionalExemplars.get(root) ?? null,\n })\n }\n }\n\n return {\n groups: new Map([...groups].map(([groupId, group]) => [groupId, group.items])),\n aliases,\n conflicts: inferOverrideConflicts(project, groups, groupSignatures),\n postfixLookupClassGroups,\n preservedClasses,\n extendedBuiltInRoots,\n }\n}\n\n/** Runtime lookup removes a leading minus, so opposite static names, functional roots, and overlapping static/functional names share trie paths. Only compatible effects can share those paths. Preserve conflicting roots and their static claims together, including would-be aliases: either remaining claim could otherwise classify both signs and discard independent styles. */\nfunction reconcileNegativeRoots(\n project: DesignSystemAccess,\n shapesByRoot: Map<string, FunctionalClassGroup[] | null>,\n staticRoots: string[],\n): Set<string> {\n const preservedStaticClasses = new Set<string>()\n const staticRootSet = new Set(staticRoots)\n for (const root of staticRoots) {\n if (!root.startsWith('-') || !staticRootSet.has(root.slice(1))) {\n continue\n }\n const negative = declaredDeclarations(project, root)\n const positive = declaredDeclarations(project, root.slice(1))\n if (!fullyCovers(negative, positive) || !fullyCovers(positive, negative)) {\n preservedStaticClasses.add(root.slice(1))\n }\n }\n for (const [root, shapes] of shapesByRoot) {\n if (!root.startsWith('-')) {\n continue\n }\n const positiveRoot = root.slice(1)\n const positiveShapes = shapesByRoot.get(positiveRoot)\n let compatible = shapes !== null\n if (positiveShapes !== undefined) {\n if (shapes?.length === 1 && positiveShapes?.length === 1) {\n const negative = declaredDeclarations(project, shapes[0]!.exemplar)\n const positive = declaredDeclarations(project, positiveShapes[0]!.exemplar)\n compatible &&= fullyCovers(negative, positive) && fullyCovers(positive, negative)\n } else {\n compatible = false\n }\n }\n\n const staticClaims: string[] = []\n for (const className of staticRoots) {\n if (className !== positiveRoot && !className.startsWith(`${positiveRoot}-`)) {\n continue\n }\n const negative = declaredDeclarations(project, `-${className}`)\n if (!negative?.length) {\n continue\n }\n staticClaims.push(className)\n const positive = declaredDeclarations(project, className)\n compatible &&= fullyCovers(negative, positive) && fullyCovers(positive, negative)\n }\n if (compatible) {\n continue\n }\n shapesByRoot.set(root, null)\n if (shapesByRoot.has(positiveRoot)) {\n shapesByRoot.set(positiveRoot, null)\n }\n for (const className of staticClaims) {\n preservedStaticClasses.add(className)\n }\n }\n return preservedStaticClasses\n}\n\n/** Whether a functional root's bare class (a plugin `DEFAULT` value) compiles and covers its shape's exemplar both ways, like a static root that joins its functional group. */\nfunction bareValueJoinsRoot(\n project: DesignSystemAccess,\n root: string,\n shape: FunctionalClassGroup,\n): boolean {\n const bare = declaredDeclarations(project, root)\n if (!bare?.length) {\n return false\n }\n const exemplar = declaredDeclarations(project, shape.exemplar)\n return fullyCovers(bare, exemplar) && fullyCovers(exemplar, bare)\n}\n\n/** Group IDs get a `utility.` prefix so they cannot collide with the skeleton's group IDs and are recognizable in reports and the emitted config. */\nfunction customUtilityGroupId(root: string): string {\n return `utility.${root}`\n}\n\n/** Members and their representative class travel together, so override inference never has to reconstruct a utility root from a generated group ID. */\ninterface CustomUtilityGroup {\n items: PlanValue[]\n exemplar: string | null\n}\n\n/**\n * Indexes suggested classes and their slash modifiers once for both encoding and conflict inference. Modifiers can enable independent declarations through --modifier(), so their complete candidates must participate in effect grouping. Bare utility names belong to their own roots; other classes belong to the longest functional root that prefixes them. Using the same ownership rule prevents a nested root such as `demo-child-*` from becoming the exemplar or a named value of `demo-*`.\n */\nfunction collectFunctionalClasses(\n project: DesignSystemAccess,\n functionalRoots: string[],\n): Map<string, string[]> {\n const classesByRoot = new Map<string, string[]>(functionalRoots.map((root) => [root, []]))\n if (functionalRoots.length === 0) {\n return classesByRoot\n }\n // Built-ins retain ownership too: flow-root is not a value of flow-*, nor backdrop-blur-sm or the bare functional default backdrop-grayscale of backdrop-*.\n const projectFunctionalRoots = project.utilities.keys('functional')\n const bareRoots = new Set([...project.utilities.keys('static'), ...projectFunctionalRoots])\n const longestRootsFirst = projectFunctionalRoots.sort(\n (first, second) => second.length - first.length,\n )\n const seen = new Set<string>()\n\n for (const [className, { modifiers }] of project.getClassList()) {\n if (\n bareRoots.has(className) ||\n !functionalRoots.some((root) => className.startsWith(`${root}-`))\n ) {\n continue\n }\n const root = longestRootsFirst.find((candidate) => className.startsWith(`${candidate}-`))\n const classes = root === undefined ? undefined : classesByRoot.get(root)\n if (classes) {\n for (const candidate of [\n className,\n ...modifiers.map((modifier) => `${className}/${modifier}`),\n ]) {\n if (!seen.has(candidate)) {\n seen.add(candidate)\n classes.push(candidate)\n }\n }\n }\n }\n\n return classesByRoot\n}\n\ninterface FunctionalClassGroup {\n classNames: string[]\n exemplar: string\n validators: ValidatorName[]\n}\n\n/** Groups named values and numeric kinds by their compiled effects, ignoring values but preserving rule scope and importance. Probe-only shapes prevent unsafe root-wide matchers without registering probe names. Returns null when postfix effects lack a matching full-class group: the runtime falls back to a recognized base group on a full-lookup miss, so leaving only the postfix unclassified would still discard its independent styles. */\nfunction groupFunctionalClasses(\n project: DesignSystemAccess,\n root: string,\n classNames: string[],\n): FunctionalClassGroup[] | null {\n const groups = new Map<string, FunctionalClassGroup>()\n const groupsByClassName = new Map<string, FunctionalClassGroup>()\n const namedClasses = new Set(classNames)\n const candidates = new Set([\n ...classNames,\n ...FUNCTIONAL_VALUE_PROBES.map((tail) => `${root}-${tail}`),\n ])\n for (const className of candidates) {\n const declarations = declaredDeclarations(project, className)\n if (!declarations?.length) {\n continue\n }\n const signature = functionalEffectSignature(declarations)\n const group: FunctionalClassGroup = groups.get(signature) ?? {\n classNames: [],\n exemplar: className,\n validators: [],\n }\n if (namedClasses.has(className)) {\n group.classNames.push(className)\n }\n groups.set(signature, group)\n groupsByClassName.set(className, group)\n }\n\n for (const [validator, sentinels] of BARE_VALUE_PROBES) {\n const group = groupsByClassName.get(`${root}-${sentinels[0]!}`)\n if (\n group &&\n sentinels.every((tail) => groupsByClassName.get(`${root}-${tail}`) === group)\n ) {\n group.validators.push(validator)\n }\n }\n\n const result = [...groups.values()]\n const integerGroup = result.find((group) => group.validators.includes('isInteger'))\n // isNumber also accepts integers. A separate integer branch must be registered first so unsuggested integers keep the declarations --value(integer) adds; named literals outrank both validators automatically.\n if (integerGroup) {\n result.splice(result.indexOf(integerGroup), 1)\n result.unshift(integerGroup)\n }\n\n // Numeric/arbitrary-only roots can suggest named modifiers without contributing any class-list entries. Probe those completions independently of the named base candidates.\n const modifiers = new Set([\n ...project.utilities.getCompletions(root).flatMap((suggestion) => suggestion.modifiers),\n ...MODIFIER_PROBES,\n ])\n for (const className of candidates) {\n if (segment(className, '/').length > 1) {\n continue\n }\n const baseGroup = groupsByClassName.get(className)\n for (const modifier of modifiers) {\n const modifiedClass = `${className}/${modifier}`\n const declarations = declaredDeclarations(project, modifiedClass)\n if (!declarations?.length) {\n continue\n }\n const modifiedGroup = groups.get(functionalEffectSignature(declarations))\n if (baseGroup && modifiedGroup === baseGroup) {\n continue\n }\n // Named literals outrank validators, whose registration order matches `result`. Fractions can represent numeric base/modifier pairs, but cannot represent named bases such as `type-sm/2`.\n const tail = modifiedClass.slice(root.length + 1)\n const lookupGroup = namedClasses.has(modifiedClass)\n ? groupsByClassName.get(modifiedClass)\n : result.find((group) => group.validators.some((name) => validators[name](tail)))\n if (!modifiedGroup || lookupGroup !== modifiedGroup) {\n return null\n }\n }\n }\n return result\n}\n\n/** Values can vary within a functional group; its affected properties, targets, guards, and importance must remain the same. */\nfunction functionalEffectSignature(declarations: DeclarationEntry[]): string {\n return [\n ...new Set(\n declarations.map((entry) =>\n JSON.stringify([entry.context, entry.scope, entry.property, entry.important]),\n ),\n ),\n ]\n .sort()\n .join('\\n')\n}\n\n/**\n * Value kinds a functional utility can accept beyond its named values, tested with sentinel candidates: accepting the kind (`--value(number)` compiles every number) permits an open validator. The sentinels use unusual theme-token names, with two per kind to reduce the chance that named tokens impersonate open-ended support.\n */\nconst BARE_VALUE_PROBES: [ValidatorName, string[]][] = [\n ['isFraction', ['355/113', '19/97']],\n ['isNumber', ['971.5', '823.25']],\n ['isInteger', ['9713', '8231']],\n // Tailwind accepts bare percentages with integer amounts; decimal percentages would silently miss this branch.\n ['isPercent', ['79%', '61%']],\n]\n\n/**\n * Representatives covering Tailwind's recognized arbitrary data types for both base values and slash modifiers. Missing a type can make a root with independent branches look uniform, granting an unsafe broad matcher. Some types overlap: lengths also cover position, background size, and line width; URLs cover images; identifiers cover family names.\n */\nconst ARBITRARY_VALUE_PROBES = [\n '[3px]',\n '[7]',\n '[41%]',\n '[#650a1b]',\n '[twm-probe]',\n '[13/7]',\n '[url(twm-probe.svg)]',\n '[serif]',\n '[medium]',\n '[larger]',\n '[13deg]',\n '[1_2_3]',\n]\n\nconst ARBITRARY_VARIABLE_PROBE = '(--twm-probe)'\n\n// Tailwind suggests named modifiers, but bare numeric modifiers may have no suggestions at all. Probe them on valid named bases as well as the arbitrary base samples.\nconst MODIFIER_PROBES = [\n ...BARE_VALUE_PROBES.filter(([name]) => name !== 'isFraction').flatMap(\n ([, sentinels]) => sentinels,\n ),\n ...ARBITRARY_VALUE_PROBES,\n ARBITRARY_VARIABLE_PROBE,\n]\n\nconst FUNCTIONAL_VALUE_PROBES = [\n ...BARE_VALUE_PROBES.flatMap(([, sentinels]) => sentinels),\n ...ARBITRARY_VALUE_PROBES,\n ARBITRARY_VARIABLE_PROBE,\n]\n\n/**\n * The exact-mode value matchers of a functional root whose compiled effects are uniform across suggestions and probes: compile-verified named values (scale-encoded, so families still factor), plus validators for accepted open-ended value kinds. Arbitrary-value matchers still approximate Tailwind's type inference: `isArbitraryValue` can match a wrong type (`ll-[red]` on a `--value([length])` utility), and representative probes do not validate every possible arbitrary value or explicit type label. Mixed-effect roots bypass this helper to avoid assigning different arbitrary branches to one group.\n */\nfunction exactFunctionalValueItems(\n project: DesignSystemAccess,\n root: string,\n namedTails: string[],\n): PlanValue[] {\n const allTails = [...namedTails, ...FUNCTIONAL_VALUE_PROBES]\n const compileResults = classesCompile(\n project,\n allTails.map((tail) => `${root}-${tail}`),\n )\n const compiledTails = new Set(allTails.filter((_, index) => compileResults[index]))\n\n // Suggestions that don't compile produce no CSS and must not gain eviction power — the same rule that motivates exact mode in the first place.\n const items = encodeScale(\n namedTails.filter((tail) => compiledTails.has(tail)),\n 'exact',\n ).items\n\n const acceptedKinds = BARE_VALUE_PROBES.filter(([, sentinels]) =>\n sentinels.every((sentinel) => compiledTails.has(sentinel)),\n ).map(([validatorName]) => validatorName)\n for (const validatorName of acceptedKinds) {\n // isNumber accepting every integer makes isInteger redundant beside it.\n if (validatorName === 'isInteger' && acceptedKinds.includes('isNumber')) {\n continue\n }\n items.push({ kind: 'validator', name: validatorName })\n }\n if (ARBITRARY_VALUE_PROBES.some((probe) => compiledTails.has(probe))) {\n items.push({ kind: 'validator', name: 'isArbitraryValue' })\n }\n if (compiledTails.has(ARBITRARY_VARIABLE_PROBE)) {\n items.push({ kind: 'validator', name: 'isArbitraryVariable' })\n }\n\n return items\n}\n\ninterface GroupSignatures {\n groupIds: () => Iterable<string>\n /** Full context-qualified property signature of the group's exemplar class. */\n signature: (groupId: string) => Set<string> | null\n /** The group exemplar's full declarations, the target side of override-cover checks. */\n declarations: (groupId: string) => DeclarationEntry[] | null\n}\n\n/**\n * One exemplar vanilla class per built-in group, with lazily computed signatures — most groups are never compared against, and compiling ~300 exemplars eagerly would cost more than the whole rest of the pass.\n */\nfunction collectGroupSignatures(\n vanilla: DesignSystemAccess,\n vanillaClassGroupId: (className: string) => string | undefined,\n): GroupSignatures {\n const exemplars = new Map<string, string>()\n for (const [className] of vanilla.getClassList()) {\n const groupId = vanillaClassGroupId(className)\n if (groupId !== undefined && !exemplars.has(groupId)) {\n exemplars.set(groupId, className)\n }\n }\n\n const signatureCache = new Map<string, Set<string> | null>()\n\n return {\n groupIds: () => exemplars.keys(),\n signature: (groupId) => {\n let signature = signatureCache.get(groupId)\n if (signature === undefined) {\n const exemplar = exemplars.get(groupId)\n signature = exemplar === undefined ? null : declaredProperties(vanilla, exemplar)\n signatureCache.set(groupId, signature)\n }\n return signature\n },\n // declaredDeclarations caches per class behind the scenes, so no extra cache is needed here.\n declarations: (groupId) => {\n const exemplar = exemplars.get(groupId)\n return exemplar === undefined ? null : declaredDeclarations(vanilla, exemplar)\n },\n }\n}\n\n/**\n * Finds the single built-in group whose classes set exactly what the static utility sets: the signatures (context-qualified property names) must be equal, and utility and group exemplar must cover each other. Coverage checks conditions and importance, so media-query padding or inline-important padding cannot alias into the normal unconditional `p` group. Zero matches means the utility does its own thing; several matches would make the choice a guess, so both fall back to self-conflict grouping.\n */\nfunction findAliasGroup(\n project: DesignSystemAccess,\n className: string,\n groupSignatures: GroupSignatures,\n): string | null {\n const properties = declaredProperties(project, className)\n if (properties === null || properties.size === 0) {\n return null\n }\n const declarations = declaredDeclarations(project, className)\n\n const matches: string[] = []\n for (const groupId of groupSignatures.groupIds()) {\n const signature = groupSignatures.signature(groupId)\n if (\n signature !== null &&\n signature.size === properties.size &&\n [...properties].every((key) => signature.has(key)) &&\n aliasEquivalent(declarations, groupSignatures.declarations(groupId))\n ) {\n matches.push(groupId)\n }\n }\n\n return matches.length === 1 ? matches[0]! : null\n}\n\n/**\n * Signature equality alone is blind to conditions and importance. Aliases need an unconditional element-level effect and mutual coverage: a later built-in color must never remove a custom utility's important, hover, or dark-mode color, even when both touch only `color`.\n */\nfunction aliasEquivalent(\n first: DeclarationEntry[] | null,\n second: DeclarationEntry[] | null,\n): boolean {\n if (first === null || second === null) {\n return false\n }\n return (\n first.some((entry) => entry.context === '' && !entry.conditional) &&\n fullyCovers(first, second) &&\n fullyCovers(second, first)\n )\n}\n\n/**\n * Whether a class fully covers another, meaning: with the coverer coming later, the covered class has no independent effect left, so removing it loses nothing. Each declaration of the target must be accounted for — an unconditional element-level real property by an equal or shorthand property of the coverer, an unconditional element-level custom property (a state carrier like `--hit-area-l`) by the coverer re-declaring the same one, and everything conditional or targeting another element (shared `::before` scaffolding) only by a byte-identical declaration under the same enclosing rules in the coverer. Anything unaccounted for means partial overlap, and partial overlap never justifies removal — the same rule the default config applies between `px` and `p`.\n * Every match also needs at least the target declaration's importance: a normal declaration cannot replace an inline-important property or custom-property state, even when the names and values agree.\n */\nexport function fullyCovers(\n coverer: DeclarationEntry[] | null,\n target: DeclarationEntry[] | null,\n): boolean {\n if (coverer === null || target === null || target.length === 0) {\n return false\n }\n\n return target.every((targetEntry) =>\n coverer.some((entry) => {\n if (targetEntry.important && !entry.important) {\n return false\n }\n if (targetEntry.context === '' && !targetEntry.conditional) {\n if (entry.context !== '' || entry.conditional) {\n return false\n }\n return targetEntry.property.startsWith('--')\n ? entry.property === targetEntry.property\n : !entry.property.startsWith('--') &&\n propertyCovers(entry.property, targetEntry.property)\n }\n return (\n sameDeclarationScope(entry, targetEntry) &&\n entry.property === targetEntry.property &&\n entry.value === targetEntry.value\n )\n }),\n )\n}\n\n/**\n * For every custom group, finds the groups whose exemplar declarations its utility fully covers — whenever the utility comes later in a class list, the covered class is redundant and gets removed. One class stands in for each group: custom functional values are partitioned by their observed effects first, while built-in groups retain the representative-class approximation used in classification.\n */\nfunction inferOverrideConflicts(\n project: DesignSystemAccess,\n customGroups: Map<string, CustomUtilityGroup>,\n groupSignatures: GroupSignatures,\n): Map<string, string[]> {\n const customDeclarations = new Map<string, DeclarationEntry[] | null>()\n for (const [groupId, { exemplar }] of customGroups) {\n customDeclarations.set(\n groupId,\n exemplar === null ? null : declaredDeclarations(project, exemplar),\n )\n }\n\n const conflicts = new Map<string, string[]>()\n\n for (const [groupId, declarations] of customDeclarations) {\n if (declarations === null || declarations.length === 0) {\n continue\n }\n\n const covered: string[] = []\n\n for (const targetGroupId of groupSignatures.groupIds()) {\n if (fullyCovers(declarations, groupSignatures.declarations(targetGroupId))) {\n covered.push(targetGroupId)\n }\n }\n\n for (const [otherGroupId, otherDeclarations] of customDeclarations) {\n if (otherGroupId !== groupId && fullyCovers(declarations, otherDeclarations)) {\n covered.push(otherGroupId)\n }\n }\n\n if (covered.length > 0) {\n conflicts.set(groupId, covered)\n }\n }\n\n return conflicts\n}\n","import { type ConfigPlan, type PlanValue } from './plan.ts'\n\nexport interface EmitOptions {\n /** Additional comment lines placed below the standard generated-file notice, e.g. provenance info like the input path and content hash. */\n banner?: string\n /**\n * Output language. 'ts' (default) emits TypeScript whose config object is checked with `satisfies`; 'js' emits plain JavaScript with byte-identical runtime behavior — for projects that don't use TypeScript, and for consumers that must serve the module without a transform step (the Vite plugin's in-memory module, which Vite's own esbuild transform does not reliably process for virtual ids).\n */\n format?: 'ts' | 'js'\n /**\n * Module specifier the emitted code imports tailwind-merge's API from. Defaults to 'tailwind-merge'. A bundler plugin serving the module virtually has no filesystem location to resolve a bare 'tailwind-merge' from, so it substitutes a specifier of its own package that re-exports tailwind-merge — resolvable from anywhere because the plugin package is the user's direct dependency.\n */\n importSource?: string\n}\n\n/**\n * Serializes a plan into the source code of a standalone module exporting `getConfig` and `twMerge`.\n *\n * The whole config is built inside `getConfig` so that nothing is allocated at module evaluation — `createTailwindMerge` invokes the callback on the first `twMerge` call, preserving the library's lazy-init behavior. The module imports only `createTailwindMerge` and `validators` from tailwind-merge, so bundlers tree-shake the default config away.\n *\n * Two measured insights shape the output. Validators are destructured once and referenced as bare identifiers because property accesses like `v.isArbitraryVariable` survive minification while local bindings get mangled. And only the resolved theme scales are shared as consts, emitted as references or spreads (e.g. `['none', ...scaleBlur]`): deduplicating other repetition into consts shrinks the minified size but *grows* the compressed size, since references add entropy where gzip/brotli handled the repetition nearly for free (measured on the vanilla theme: 31,989 / 8,822 / 7,706 bytes minified / gzip / brotli with scale sharing, against 28,492 / 9,364 / 8,197 with every paying repetition hoisted). Sharing array identity across class groups is safe because tailwind-merge never mutates config arrays. Output is deterministic for identical input so the CLI's `--check` mode can diff against the file on disk.\n */\nexport function emitModule(plan: ConfigPlan, options: EmitOptions = {}): string {\n const format = options.format ?? 'ts'\n const candidates = collectConstantCandidates(plan)\n\n // Serialize with every scale const available, then emit only the consts actually referenced — directly from the config or transitively from another emitted const; a pruned plan can leave every scale unreferenced.\n const names = new Map([...candidates].map(([canonical, candidate]) => [canonical, candidate.name]))\n const output = serializeAll(plan, candidates, names, format)\n const usedCanonicals = resolveTransitiveUsage(output)\n const { configBody } = output\n\n const lines: string[] = []\n\n // Always present, independent of caller-supplied banner lines: readers of the file must be able to tell it is generated and where to regenerate it.\n lines.push('// Generated by @tailwind-merge/configurator. Do not edit manually.')\n if (options.banner) {\n lines.push(options.banner)\n }\n lines.push('')\n\n // Validators are referenced as bare identifiers instead of `v.name` property accesses: property names survive minification while local bindings get mangled to single characters, and validator references are among the most repeated tokens in the config. A pruned plan can need no validator at all; the import then goes too, or `noUnusedLocals` would reject the emitted TypeScript.\n const usedValidators = collectUsedValidatorNames(plan)\n const importSource = options.importSource ?? 'tailwind-merge'\n const validatorsImport = usedValidators.length > 0 ? ', validators as v' : ''\n lines.push(\n format === 'ts'\n ? `import { createTailwindMerge${validatorsImport}, type Config } from '${importSource}'`\n : `import { createTailwindMerge${validatorsImport} } from '${importSource}'`,\n )\n lines.push('')\n lines.push('/**')\n lines.push(\n ' * Builds the tailwind-merge config for this project. Called lazily on the first `twMerge` call. Can be composed further via `createTailwindMerge(getConfig, ...extensions)`.',\n )\n lines.push(' *')\n lines.push(\n \" * The structure mirrors tailwind-merge's default config. The `scale*` consts hold this project's resolved theme scales — each one's comment says which theme namespace it came from — and class groups use them by reference or as spreads. Patterns like `isTshirtSize` come from tailwind-merge's public validators.\",\n )\n lines.push(' */')\n lines.push('export const getConfig = () => {')\n\n if (usedValidators.length > 0) {\n const inline = `${INDENT}const { ${usedValidators.join(', ')} } = v`\n if (inline.length <= MAX_LINE_LENGTH) {\n lines.push(inline)\n } else {\n lines.push(`${INDENT}const {`)\n lines.push(...usedValidators.map((name) => `${INDENT}${INDENT}${name},`))\n lines.push(`${INDENT}} = v`)\n }\n lines.push('')\n }\n\n const emittedConstants = sortByDependencies(output, usedCanonicals)\n for (const [canonical, body] of emittedConstants) {\n const { name, comment } = candidates.get(canonical)!\n if (comment) {\n lines.push(`${INDENT}/** ${comment} */`)\n }\n lines.push(`${INDENT}const ${name} = ${body}`)\n }\n // Only the consts actually emitted earn the separating blank line — a pruned plan can leave every shared-scale candidate unreferenced.\n if (emittedConstants.length > 0) {\n lines.push('')\n }\n\n lines.push(...configBody)\n lines.push('}')\n lines.push('')\n lines.push('export const twMerge = createTailwindMerge(getConfig)')\n lines.push('')\n\n return lines.join('\\n')\n}\n\nconst MAX_LINE_LENGTH = 100\nconst INDENT = ' '\n\n/** Validator names in first-use order, for the destructuring statement at the top of `getConfig`. */\nfunction collectUsedValidatorNames(plan: ConfigPlan): string[] {\n const names = new Set<string>()\n\n function visitItems(items: PlanValue[]) {\n for (const item of items) {\n if (item.kind === 'validator') {\n names.add(item.name)\n } else if (item.kind === 'object') {\n for (const [, entryItems] of item.entries) {\n visitItems(entryItems)\n }\n }\n }\n }\n\n for (const [, items] of plan.classGroups) {\n visitItems(items)\n }\n\n return [...names]\n}\n\n/** A resolved theme scale emitted as a shared const, referenced or spread wherever a group array contains it. */\ninterface ConstantCandidate {\n items: PlanValue[]\n /** Item-wise canonical forms, used for run matching. */\n itemCanonicals: string[]\n /** Const name derived from the theme key (e.g. `scaleColor`). */\n name: string\n /** JSDoc text emitted above the const declaration. Stripped by minifiers, so it costs nothing in production bundles. */\n comment: string | null\n}\n\ntype CandidateMap = Map<string, ConstantCandidate>\n\ninterface SerializedOutput {\n configBody: string[]\n constantBodies: Map<string, string>\n /** Canonicals referenced from the config body itself. */\n directUsage: Set<string>\n /** Canonicals referenced from within each candidate's body. */\n usageByConstant: Map<string, Set<string>>\n}\n\n/** Gathers the resolved theme scales as shared-const candidates; group arrays contain them verbatim wherever a theme getter was substituted. Theme keys are unique, so the derived names are too. */\nfunction collectConstantCandidates(plan: ConfigPlan): CandidateMap {\n const candidates: CandidateMap = new Map()\n\n for (const [themeKey, scale] of plan.scales) {\n if (scale.items.length < 2) {\n continue\n }\n const canonical = canonicalArray(scale.items)\n const existing = candidates.get(canonical)\n if (!existing) {\n candidates.set(canonical, {\n items: scale.items,\n itemCanonicals: scale.items.map(canonicalValue),\n name: scaleConstName(themeKey),\n comment: scale.comment,\n })\n } else if (scale.comment !== null) {\n // Two theme scales resolved to identical content and share one const; the comment must mention both origins.\n existing.comment = `${existing.comment ?? ''} ${scale.comment}`.trim()\n }\n }\n\n return candidates\n}\n\n/** `color` → `scaleColor`, `font-weight` → `scaleFontWeight`. The `scale` prefix avoids collisions with destructured validator names. */\nfunction scaleConstName(themeKey: string): string {\n return `scale${themeKey\n .split('-')\n .map((segment) => `${segment[0]?.toUpperCase() ?? ''}${segment.slice(1)}`)\n .join('')}`\n}\n\n/**\n * Serializes the config body and every candidate's body with the given name map, recording which candidates each output references so usage can be resolved before final naming.\n */\nfunction serializeAll(\n plan: ConfigPlan,\n candidates: CandidateMap,\n names: Map<string, string>,\n format: 'ts' | 'js',\n): SerializedOutput {\n const directUsage = new Set<string>()\n const usageByConstant = new Map<string, Set<string>>()\n\n const constantBodies = new Map<string, string>()\n for (const [canonical, candidate] of candidates) {\n const usage = new Set<string>()\n constantBodies.set(\n canonical,\n serializeArrayBody(candidate.items, 4, {\n candidates,\n names,\n usage,\n selfCanonical: canonical,\n }),\n )\n usageByConstant.set(canonical, usage)\n }\n\n const context: SerializeContext = {\n candidates,\n names,\n usage: directUsage,\n selfCanonical: null,\n }\n\n const configBody: string[] = []\n configBody.push(`${INDENT}return {`)\n configBody.push(`${INDENT}${INDENT}cacheSize: ${plan.cacheSize},`)\n if (plan.prefix !== null) {\n configBody.push(`${INDENT}${INDENT}prefix: ${quote(plan.prefix)},`)\n }\n configBody.push(`${INDENT}${INDENT}theme: {},`)\n\n configBody.push(`${INDENT}${INDENT}classGroups: {`)\n for (const [classGroupId, items] of plan.classGroups) {\n configBody.push(\n `${INDENT.repeat(3)}${propertyKey(classGroupId)}: ${serializeArray(items, 12, context)},`,\n )\n }\n configBody.push(`${INDENT}${INDENT}},`)\n\n pushStringRecordMap(configBody, 'conflictingClassGroups', plan.conflictingClassGroups)\n pushStringRecordMap(\n configBody,\n 'conflictingClassGroupModifiers',\n plan.conflictingClassGroupModifiers,\n )\n\n configBody.push(\n `${INDENT}${INDENT}postfixLookupClassGroups: ${serializeStringArray(plan.postfixLookupClassGroups)},`,\n )\n configBody.push(\n `${INDENT}${INDENT}orderSensitiveModifiers: ${serializeStringArray(plan.orderSensitiveModifiers)},`,\n )\n configBody.push(format === 'ts' ? `${INDENT}} satisfies Config<string, never>` : `${INDENT}}`)\n\n return { configBody, constantBodies, directUsage, usageByConstant }\n}\n\n/** Usage is transitive: a const referenced only from another used const's body still has to be emitted. */\nfunction resolveTransitiveUsage(output: SerializedOutput): Set<string> {\n const used = new Set<string>(output.directUsage)\n let changed = true\n\n while (changed) {\n changed = false\n for (const canonical of used) {\n for (const referenced of output.usageByConstant.get(canonical) ?? []) {\n if (!used.has(referenced)) {\n used.add(referenced)\n changed = true\n }\n }\n }\n }\n\n return used\n}\n\n/** Orders the used consts so that every reference points to an already-declared name, using the exact usage sets recorded during serialization. Containment makes cycles impossible. */\nfunction sortByDependencies(output: SerializedOutput, used: Set<string>): [string, string][] {\n const remaining = new Map(\n [...output.constantBodies].filter(([canonical]) => used.has(canonical)),\n )\n const declared = new Set<string>()\n const sorted: [string, string][] = []\n\n while (remaining.size > 0) {\n let progressed = false\n\n for (const [canonical, body] of remaining) {\n const dependencies = [...(output.usageByConstant.get(canonical) ?? [])].filter(\n (dependency) => used.has(dependency) && dependency !== canonical,\n )\n if (dependencies.every((dependency) => declared.has(dependency))) {\n declared.add(canonical)\n sorted.push([canonical, body])\n remaining.delete(canonical)\n progressed = true\n }\n }\n\n if (!progressed) {\n throw new Error('Cyclic references between generated consts, this is a bug in emit.ts')\n }\n }\n\n return sorted\n}\n\ninterface SerializeContext {\n candidates: CandidateMap\n names: Map<string, string>\n usage: Set<string>\n /** Canonical of the candidate currently being defined, which must not reference itself. */\n selfCanonical: string | null\n}\n\nfunction serializeArray(items: PlanValue[], indent: number, context: SerializeContext): string {\n const canonical = canonicalArray(items)\n if (canonical !== context.selfCanonical) {\n const name = context.names.get(canonical)\n if (name) {\n context.usage.add(canonical)\n return name\n }\n }\n return serializeArrayBody(items, indent, context)\n}\n\nfunction serializeArrayBody(\n items: PlanValue[],\n indent: number,\n context: SerializeContext,\n): string {\n const itemCanonicals = items.map(canonicalValue)\n const parts: string[] = []\n\n let index = 0\n while (index < items.length) {\n const run = findLongestRun(items, itemCanonicals, index, context)\n if (run) {\n parts.push(`...${run.name}`)\n context.usage.add(run.canonical)\n index += run.length\n } else {\n parts.push(serializeValue(items[index]!, indent + 4, context))\n index += 1\n }\n }\n\n const inline = `[${parts.join(', ')}]`\n if (indent + inline.length <= MAX_LINE_LENGTH && !inline.includes('\\n')) {\n return inline\n }\n\n const itemIndent = INDENT.repeat(indent / 4 + 1)\n const closingIndent = INDENT.repeat(indent / 4)\n return `[\\n${parts.map((part) => `${itemIndent}${part},`).join('\\n')}\\n${closingIndent}]`\n}\n\n/** Finds the longest candidate array matching the items starting at `start`, to be emitted as a spread. Skips the candidate currently being defined and full-array matches (those are handled as plain references). */\nfunction findLongestRun(\n items: PlanValue[],\n itemCanonicals: string[],\n start: number,\n context: SerializeContext,\n): { name: string; canonical: string; length: number } | null {\n let best: { name: string; canonical: string; length: number } | null = null\n\n for (const [canonical, candidate] of context.candidates) {\n if (canonical === context.selfCanonical) {\n continue\n }\n const length = candidate.itemCanonicals.length\n if (\n length < 2 ||\n (start === 0 && length === items.length) ||\n start + length > items.length ||\n (best && length <= best.length)\n ) {\n continue\n }\n const name = context.names.get(canonical)\n if (!name) {\n continue\n }\n\n let matches = true\n for (let offset = 0; offset < length; offset++) {\n if (itemCanonicals[start + offset] !== candidate.itemCanonicals[offset]) {\n matches = false\n break\n }\n }\n if (matches) {\n best = { name, canonical, length }\n }\n }\n\n return best\n}\n\nfunction serializeValue(value: PlanValue, indent: number, context: SerializeContext): string {\n if (value.kind === 'class') {\n return quote(value.value)\n }\n if (value.kind === 'validator') {\n return value.name\n }\n return serializeObjectBody(value, indent, context)\n}\n\nfunction serializeObjectBody(\n value: Extract<PlanValue, { kind: 'object' }>,\n indent: number,\n context: SerializeContext,\n): string {\n const entryParts = value.entries.map(\n ([key, items]) => `${propertyKey(key)}: ${serializeArray(items, indent + 4, context)}`,\n )\n const inline = `{ ${entryParts.join(', ')} }`\n\n if (indent + inline.length <= MAX_LINE_LENGTH && !inline.includes('\\n')) {\n return inline\n }\n\n const entryIndent = INDENT.repeat(indent / 4 + 1)\n const closingIndent = INDENT.repeat(indent / 4)\n return `{\\n${entryParts.map((part) => `${entryIndent}${part},`).join('\\n')}\\n${closingIndent}}`\n}\n\n/**\n * Canonical string form used as identity for scale references and run matching: fully inlined, ignoring shared consts and line breaks, so identical content always produces identical keys. Cached by node identity since plans reuse instances for repeated scales.\n */\nfunction canonicalArray(items: PlanValue[]): string {\n let canonical = canonicalArrayCache.get(items)\n if (!canonical) {\n canonical = `[${items.map(canonicalValue).join(', ')}]`\n canonicalArrayCache.set(items, canonical)\n }\n return canonical\n}\n\nfunction canonicalValue(value: PlanValue): string {\n if (value.kind === 'class') {\n return quote(value.value)\n }\n if (value.kind === 'validator') {\n return `v.${value.name}`\n }\n let canonical = canonicalObjectCache.get(value)\n if (!canonical) {\n canonical = `{ ${value.entries\n .map(([key, items]) => `${propertyKey(key)}: ${canonicalArray(items)}`)\n .join(', ')} }`\n canonicalObjectCache.set(value, canonical)\n }\n return canonical\n}\n\nconst canonicalArrayCache = new WeakMap<PlanValue[], string>()\nconst canonicalObjectCache = new WeakMap<Extract<PlanValue, { kind: 'object' }>, string>()\n\nfunction pushStringRecordMap(lines: string[], property: string, map: Map<string, string[]>) {\n if (map.size === 0) {\n // Possible after pruning leaves no conflict edges between the kept groups.\n lines.push(`${INDENT}${INDENT}${property}: {},`)\n return\n }\n lines.push(`${INDENT}${INDENT}${property}: {`)\n for (const [key, values] of map) {\n lines.push(`${INDENT.repeat(3)}${propertyKey(key)}: ${serializeStringArray(values)},`)\n }\n lines.push(`${INDENT}${INDENT}},`)\n}\n\nfunction serializeStringArray(values: readonly string[]): string {\n return `[${values.map(quote).join(', ')}]`\n}\n\n/** Object literals treat __proto__ as a prototype setter even when quoted; computed syntax preserves the theme entry as an own property. */\nfunction propertyKey(key: string): string {\n if (key === '__proto__') {\n return `[${quote(key)}]`\n }\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : quote(key)\n}\n\nfunction quote(value: string): string {\n return `'${value.replaceAll('\\\\', '\\\\\\\\').replaceAll(\"'\", \"\\\\'\")}'`\n}\n","import { validators } from 'tailwind-merge'\nimport { type AnyConfig, type ClassGroup } from 'tailwind-merge/unstable-do-not-import'\n\nimport { type ConfigPlan, type PlanValue } from './plan.ts'\n\n/**\n * Turns a plan into a runtime config object, the in-memory equivalent of the emitted module.\n *\n * Exists so tests and programmatic consumers can use the generated behavior directly without writing the emitted source to disk and importing it. Because both this and the emitter read the same plan, the two outputs describe the same config by construction.\n */\nexport function materializeConfig(plan: ConfigPlan): AnyConfig {\n return {\n cacheSize: plan.cacheSize,\n ...(plan.prefix === null ? {} : { prefix: plan.prefix }),\n theme: {},\n classGroups: Object.fromEntries(\n [...plan.classGroups].map(([classGroupId, items]) => [\n classGroupId,\n items.map(materializeValue),\n ]),\n ),\n conflictingClassGroups: Object.fromEntries(plan.conflictingClassGroups),\n conflictingClassGroupModifiers: Object.fromEntries(plan.conflictingClassGroupModifiers),\n postfixLookupClassGroups: plan.postfixLookupClassGroups,\n orderSensitiveModifiers: plan.orderSensitiveModifiers,\n }\n}\n\nfunction materializeValue(value: PlanValue): ClassGroup<string>[number] {\n if (value.kind === 'class') {\n return value.value\n }\n if (value.kind === 'validator') {\n return validators[value.name]\n }\n return Object.fromEntries(\n value.entries.map(([key, items]) => [key, items.map(materializeValue)]),\n )\n}\n","import { getDefaultConfig, validators } from 'tailwind-merge'\nimport { type ClassGroup, type ThemeGetter } from 'tailwind-merge/unstable-do-not-import'\n\nimport { type EncodingMode, type ScaleEncoding, encodeScale } from './compress.ts'\nimport { type CustomUtilityPlan } from './custom-utilities.ts'\nimport { type ThemeSnapshot } from './snapshot.ts'\n\n/**\n * Serializable representation of one class definition within a class group.\n *\n * The plan is the single intermediate representation between the default-config skeleton and the two outputs (runtime config object and emitted source code). Keeping it fully serializable — validators are referenced by name, never by function — guarantees that materialized and emitted configs cannot drift apart.\n */\nexport type PlanValue =\n | { kind: 'class'; value: string }\n | { kind: 'validator'; name: ValidatorName }\n | { kind: 'object'; entries: [string, PlanValue[]][] }\n\nexport type ValidatorName = keyof typeof validators\n\nexport interface ConfigPlan {\n cacheSize: number\n prefix: string | null\n classGroups: Map<string, PlanValue[]>\n /** Resolved scales per theme key. Group arrays contain the items as contiguous runs (theme getters are spliced in place), so the emitter can reuse them as spreadable shared consts, named and documented per theme key. */\n scales: Map<string, ScalePlan>\n conflictingClassGroups: Map<string, string[]>\n conflictingClassGroupModifiers: Map<string, string[]>\n postfixLookupClassGroups: string[]\n orderSensitiveModifiers: string[]\n report: PlanReport\n}\n\nexport interface PlanReport {\n /** Which encoding mode the plan was built with — see `EncodingMode` for the tradeoff. */\n encoding: EncodingMode\n /** Chosen encoding strategy per theme scale, for CLI output and tests. */\n scaleStrategies: Record<string, string>\n /** Self-conflict groups created for utilities the project registers beyond the built-ins (`@utility` and `@plugin`), by group ID. */\n customUtilityGroups: string[]\n /** Static custom utilities whose compiled declarations exactly match one built-in group's signature — they joined that group instead of getting their own (class name → group ID). */\n aliasedUtilityClasses: Record<string, string>\n /** Inferred override relationships for custom utility groups: the utility coming later in a class list removes classes of the listed groups, because its unconditional element-level declarations fully cover theirs. */\n customUtilityConflicts: Record<string, string[]>\n /** Class groups dropped because the theme disables everything they could match, e.g. after a namespace reset. Their conflict map entries are dropped with them. */\n prunedClassGroups: string[]\n /** Full class names appended per class group by the vanilla-diff augmentation pass — classes from compat sub-namespaces (`--text-color-*`) and namespaces without a tailwind-merge theme key (`--z-index-*`). */\n augmentedClassGroups: Record<string, string[]>\n /** Name collisions resolved after a theme value name shadowed an existing class (e.g. `--color-bottom` vs `bg-bottom`). `keptGroupId` names the group the class stays in, or is null when the class now resolves through multiple utilities at once and was neutralized — removed from every group so it passes through unmerged. */\n resolvedCollisions: {\n className: string\n keptGroupId: string | null\n removedFromGroupIds: string[]\n }[]\n /** Theme-created classes no group could be determined for. Reported so gaps are visible instead of silently unmergeable. */\n unassignedClasses: { className: string; reason: string }[]\n /** Present when the plan was pruned to a project's used classes (see `prunePlan`). */\n pruning?: PruneReport\n}\n\n/** What pruning did to a plan, for CLI output, plugin logs, and tests. Counts only — the kept class names are visible in the emitted config itself. */\nexport interface PruneReport {\n /** Distinct class names handed to the pruner (raw scanner tokens included: anything that looked like a class name in the sources). */\n usedClassCount: number\n /** How many of them the full config classifies into a class group; the rest are non-Tailwind tokens, arbitrary properties, or class names the theme doesn't produce. */\n classifiedClassCount: number\n classGroupsBefore: number\n classGroupsAfter: number\n /** Class groups dropped because no used class belongs to them, in plan order. */\n removedClassGroups: string[]\n /** Class groups kept in full because a used class classified into them through a path the member-level walk could not attribute — should stay empty; non-empty means a mismatch between the walk and tailwind-merge's class map worth investigating. */\n unprunedClassGroups: string[]\n}\n\nexport interface ScalePlan {\n items: PlanValue[]\n /** Human explanation of the scale's provenance and encoding, emitted as a JSDoc comment on the shared const. */\n comment: string\n}\n\nexport interface BuildPlanOptions {\n snapshot: ThemeSnapshot\n cacheSize?: number\n /** How finite value sets are encoded — see `EncodingMode`. Defaults to 'compact'. */\n encoding?: EncodingMode\n}\n\n/**\n * Transforms the default config skeleton into a plan with all theme references resolved against the design-system snapshot.\n *\n * Walking `getDefaultConfig()` instead of maintaining a parallel structure means class group semantics, group ordering (which decides validator precedence in the class map), and conflict relationships automatically stay in sync with tailwind-merge.\n */\nexport function buildPlan({ snapshot, cacheSize, encoding = 'compact' }: BuildPlanOptions): ConfigPlan {\n const skeleton = getDefaultConfig()\n const scaleEncodings = new Map<string, ScaleEncoding>()\n\n function resolveScale(themeKey: string): ScaleEncoding {\n let scaleEncoding = scaleEncodings.get(themeKey)\n if (!scaleEncoding) {\n scaleEncoding = encodeThemeScale(themeKey, snapshot, encoding)\n scaleEncodings.set(themeKey, scaleEncoding)\n }\n return scaleEncoding\n }\n\n function planGroup(group: ClassGroup<string>): PlanValue[] {\n return dedupeValues(group.flatMap(planDefinition))\n }\n\n function planDefinition(definition: ClassGroup<string>[number]): PlanValue[] {\n if (typeof definition === 'string') {\n return [{ kind: 'class', value: definition }]\n }\n\n if (typeof definition === 'function') {\n if (isThemeGetter(definition)) {\n if (definition.themeKey === undefined) {\n // fromTheme sets themeKey on every getter it creates; absence means an unsupported tailwind-merge version (see the peerDependencies range).\n throw new Error(\n 'Theme getter without a themeKey property — the configurator requires a tailwind-merge version that exposes it',\n )\n }\n // Every group gets its own copy of the scale, nested family objects included: collision corrections later remove single claims from one group's copy (`xl` from the drop-shadow copy of the color scale while `text-xl` stays a color), which must never leak into the other groups or the shared scale const. The emitter recognizes scale runs structurally, so copies cost nothing in the output.\n return cloneValues(resolveScale(definition.themeKey).items)\n }\n\n const name = validatorNames.get(definition)\n if (!name) {\n // Would mean the default config uses a validator that is not exported publicly — a tailwind-merge change the configurator must be updated for.\n throw new Error('Unknown validator in default config, cannot emit a reference to it')\n }\n return [{ kind: 'validator', name }]\n }\n\n const entries = Object.entries(definition)\n .map(([key, value]): [string, PlanValue[]] => [key, planGroup(value)])\n .filter(([, items]) => items.length > 0)\n\n return entries.length === 0 ? [] : [{ kind: 'object', entries }]\n }\n\n const classGroups = new Map<string, PlanValue[]>()\n const prunedClassGroups: string[] = []\n\n for (const [classGroupId, group] of Object.entries(skeleton.classGroups)) {\n const items = planGroup(group)\n if (items.length === 0) {\n prunedClassGroups.push(classGroupId)\n } else {\n classGroups.set(classGroupId, items)\n }\n }\n\n for (const [classGroupId, classNames] of Object.entries(UTILITY_STATIC_CLASSES)) {\n const items = classGroups.get(classGroupId)\n if (items) {\n items.push(...classNames.map((value): PlanValue => ({ kind: 'class', value })))\n }\n }\n\n return {\n cacheSize: cacheSize ?? skeleton.cacheSize,\n prefix: snapshot.prefix,\n classGroups,\n scales: new Map(\n [...scaleEncodings].map(([themeKey, encoding]) => [\n themeKey,\n { items: encoding.items, comment: describeScale(themeKey, encoding.strategy) },\n ]),\n ),\n conflictingClassGroups: filterConflictMap(skeleton.conflictingClassGroups, classGroups),\n conflictingClassGroupModifiers: filterConflictMap(\n skeleton.conflictingClassGroupModifiers,\n classGroups,\n ),\n postfixLookupClassGroups: (skeleton.postfixLookupClassGroups ?? []).filter((classGroupId) =>\n classGroups.has(classGroupId),\n ),\n orderSensitiveModifiers: [...skeleton.orderSensitiveModifiers],\n report: {\n encoding,\n scaleStrategies: Object.fromEntries(\n [...scaleEncodings].map(([themeKey, scaleEncoding]) => [\n themeKey,\n scaleEncoding.strategy,\n ]),\n ),\n prunedClassGroups,\n customUtilityGroups: [],\n aliasedUtilityClasses: {},\n customUtilityConflicts: {},\n augmentedClassGroups: {},\n resolvedCollisions: [],\n unassignedClasses: [],\n },\n }\n}\n\n/**\n * Applies the custom-utility plan: self-conflict groups join `classGroups` like any other group, alias classes join their built-in group as literals (the trie gives named paths precedence, and joining wires up the group's full conflict behavior), and inferred override relationships land in `conflictingClassGroups` so a custom utility coming later removes the classes it fully covers.\n */\nexport function applyCustomUtilityPlan(\n plan: ConfigPlan,\n customUtilityPlan: CustomUtilityPlan,\n): void {\n for (const [groupId, items] of customUtilityPlan.groups) {\n plan.classGroups.set(groupId, items)\n plan.report.customUtilityGroups.push(groupId)\n }\n // A postfix can add independent declarations and select a different effect group (pair-2/3 vs pair-2). Pruning mirrors the runtime's complete-class lookup for these groups.\n plan.postfixLookupClassGroups.push(...customUtilityPlan.postfixLookupClassGroups)\n for (const root of customUtilityPlan.extendedBuiltInRoots) {\n plan.report.unassignedClasses.push({\n className: `${root}-*`,\n reason: 'custom utility extends a built-in root; only values the built-in matchers accept are classified',\n })\n }\n\n for (const [className, groupId] of customUtilityPlan.aliases) {\n const items = plan.classGroups.get(groupId)\n if (!items) {\n // The target group was pruned, which can only happen when the theme reset everything it matched — the alias still belongs there, so restore the group with just the literal.\n plan.classGroups.set(groupId, [{ kind: 'class', value: className }])\n } else {\n items.push({ kind: 'class', value: className })\n }\n plan.report.aliasedUtilityClasses[className] = groupId\n }\n\n for (const [groupId, coveredGroupIds] of customUtilityPlan.conflicts) {\n // Override targets pruned from the plan have no classes left to remove; dropping the edge keeps the emitted conflict map free of dangling group IDs.\n const existingTargets = coveredGroupIds.filter((targetId) => plan.classGroups.has(targetId))\n if (existingTargets.length === 0) {\n continue\n }\n const conflictTargets = plan.conflictingClassGroups.get(groupId)\n if (conflictTargets) {\n conflictTargets.push(...existingTargets)\n } else {\n plan.conflictingClassGroups.set(groupId, existingTargets)\n }\n plan.report.customUtilityConflicts[groupId] = existingTargets\n }\n}\n\n/**\n * Appends augmentation classes (full class names determined by the vanilla-diff pass) to their class groups and records them in the report. Appending literals is enough: the trie gives named paths precedence over validators, and joining an existing group wires up all its conflict relations automatically.\n */\nexport function applyAugmentations(\n plan: ConfigPlan,\n augmentations: {\n assignments: Map<string, string[]>\n collisions: {\n className: string\n claimingGroupId: string\n ownerGroupId: string\n resolution: 'restore' | 'neutralize'\n }[]\n unassigned: { className: string; reason: string }[]\n },\n): void {\n for (const [classGroupId, classNames] of augmentations.assignments) {\n const items = plan.classGroups.get(classGroupId)\n if (!items) {\n // The target group was pruned, which can only happen when the theme reset everything it matched — the augmented class still belongs there, so restore the group with just the literals.\n plan.classGroups.set(\n classGroupId,\n classNames.map((value): PlanValue => ({ kind: 'class', value })),\n )\n } else {\n items.push(...classNames.map((value): PlanValue => ({ kind: 'class', value })))\n }\n plan.report.augmentedClassGroups[classGroupId] = classNames\n }\n\n plan.report.unassignedClasses.push(...augmentations.unassigned)\n\n // Collisions are resolved by removing claims, which works on each group's own copy of the scale items (with `--color-xl`, removing `xl` under `drop-shadow` leaves `text-xl` a color). 'restore' removes the wrong group's claim so the owner's own machinery classifies the class again; 'neutralize' removes the claims of both groups, because a class compiling into multiple rules at once must not be merged away in either direction. A claim that is not a removable literal (a validator like `isNumber`, or a factored family's `{ x: [isNumber] }`) can still be outranked: tailwind-merge's class map always prefers an exact literal path over a validator, so 'restore' then appends the class to the owner group as a literal, and 'neutralize' gives it a conflict-free group of its own — either way the class ends up exactly where Tailwind's compiled output says it belongs.\n for (const { className, claimingGroupId, ownerGroupId, resolution } of augmentations.collisions) {\n const groupIdsToRemoveFrom =\n resolution === 'restore' ? [claimingGroupId] : [...new Set([claimingGroupId, ownerGroupId])]\n const removedFromGroupIds = groupIdsToRemoveFrom.filter((groupId) => {\n const items = plan.classGroups.get(groupId)\n return items !== undefined && removeClassClaim(items, className)\n })\n const fullyRemoved = removedFromGroupIds.length === groupIdsToRemoveFrom.length\n\n if (resolution === 'restore') {\n const ownerItems = plan.classGroups.get(ownerGroupId)\n if (!fullyRemoved && ownerItems !== undefined && !hasClassClaim(ownerItems, className)) {\n ownerItems.push({ kind: 'class', value: className })\n }\n plan.report.resolvedCollisions.push({\n className,\n keptGroupId: ownerGroupId,\n removedFromGroupIds,\n })\n } else {\n if (!fullyRemoved) {\n plan.classGroups.set(neutralizedGroupId(className), [{ kind: 'class', value: className }])\n }\n plan.report.resolvedCollisions.push({ className, keptGroupId: null, removedFromGroupIds })\n }\n }\n}\n\n/** Group ID for a neutralized class that keeps a validator-based claim somewhere: a group of its own, referenced by no conflict map, so the class behaves like a non-Tailwind class while still outranking the validator through its literal path. */\nfunction neutralizedGroupId(className: string): string {\n return `collision.${className}`\n}\n\n/** Whether `className` already resolves into these items through a literal — the check that keeps a restore from appending a duplicate literal to the owner group. Mirrors the walk in `removeClassClaim`. */\nfunction hasClassClaim(items: PlanValue[], className: string): boolean {\n return items.some((item) => {\n if (item.kind === 'class') {\n return item.value === className\n }\n if (item.kind === 'object') {\n return item.entries.some(\n ([key, entryItems]) =>\n className.startsWith(`${key}-`) &&\n hasClassClaim(entryItems, className.slice(key.length + 1)),\n )\n }\n return false\n })\n}\n\n/** Deep copy of plan values, so group arrays can be edited independently of each other and of the shared scale definitions. */\nfunction cloneValues(values: PlanValue[]): PlanValue[] {\n return values.map((value) =>\n value.kind === 'object'\n ? { kind: 'object', entries: value.entries.map(([key, items]) => [key, cloneValues(items)]) }\n : value,\n )\n}\n\n/**\n * Removes the item that makes `className` resolve into this group: a full-class literal, or a literal reached through object entries whose keys prefix the class name — recursively, because the family encoding nests (`background-alternative-200` may live at `{ background: [{ alternative: ['200'] }] }`). Returns false when the claim comes from something else (a validator), which the caller reports instead of guessing.\n */\nfunction removeClassClaim(items: PlanValue[], className: string): boolean {\n for (let index = 0; index < items.length; index++) {\n const item = items[index]!\n\n if (item.kind === 'class' && item.value === className) {\n items.splice(index, 1)\n return true\n }\n\n if (item.kind === 'object') {\n for (const [key, entryItems] of item.entries) {\n if (\n className.startsWith(`${key}-`) &&\n removeClassClaim(entryItems, className.slice(key.length + 1))\n ) {\n return true\n }\n }\n }\n }\n\n return false\n}\n\n/**\n * Colors that every color utility accepts as static keywords in addition to theme values. They are utility semantics rather than theme variables, so the design system's theme does not contain them. Today's default config matches them implicitly through the permissive `isAny` color scale.\n */\nconst COLOR_KEYWORDS = ['inherit', 'current', 'transparent']\n\n/**\n * Static utility classes that belong to specific class groups but are neither theme values nor skeleton literals — the default config catches them through permissive validators or its approximated theme scales, both of which the plan replaces with exact values. The shadow `*-initial` utilities reset the corresponding `--tw-*-shadow-color` custom property, the gradient `*-none` utilities reset gradient stops, and `perspective-none` is a static value the skeleton keeps in its theme approximation. All verified via `candidatesToCss` probing against tailwindcss 4.3; P2's probing infrastructure should derive or at least verify this list automatically.\n */\nconst UTILITY_STATIC_CLASSES: Record<string, string[]> = {\n 'shadow-color': ['shadow-initial'],\n 'inset-shadow-color': ['inset-shadow-initial'],\n 'text-shadow-color': ['text-shadow-initial'],\n 'gradient-from': ['from-none'],\n 'gradient-via': ['via-none'],\n 'gradient-to': ['to-none'],\n accent: ['accent-auto'],\n leading: ['leading-none'],\n perspective: ['perspective-none'],\n}\n\n/**\n * Encodes the scale for one theme key, applying per-key knowledge on top of the generic encoding.\n */\nfunction encodeThemeScale(\n themeKey: string,\n snapshot: ThemeSnapshot,\n encoding: EncodingMode,\n): ScaleEncoding {\n const scale = snapshot.scales.get(themeKey)\n const names = scale?.names ?? []\n\n if (themeKey === 'color') {\n const scaleEncoding = encodeScale(names, encoding)\n return {\n items: [\n ...COLOR_KEYWORDS.map((value): PlanValue => ({ kind: 'class', value })),\n ...scaleEncoding.items,\n ],\n strategy: scaleEncoding.strategy,\n }\n }\n\n if (themeKey === 'spacing') {\n // The static `px` value (1px) is utility semantics and exists regardless of the theme. The numeric scale (`p-13` via multiplication) only exists while the bare `--spacing` multiplier variable is set, so the number validator must not be emitted without it — and stays in exact mode too, because the multiplier genuinely makes every number compile.\n const scaleEncoding = encodeScale(names, encoding)\n const items: PlanValue[] = [{ kind: 'class', value: 'px' }]\n let strategy = scaleEncoding.strategy\n if (scale?.hasBareValue) {\n items.push({ kind: 'validator', name: 'isNumber' })\n strategy = names.length === 0 ? 'multiplier' : `multiplier+${scaleEncoding.strategy}`\n }\n items.push(...scaleEncoding.items)\n return { items, strategy }\n }\n\n return encodeScale(names, encoding)\n}\n\n/**\n * Explains where a scale's values come from and why they are encoded the way they are, so the generated file stays debuggable without readers having to know the compression policy. Derived from the encoding strategy instead of restating the values, which the code right below the comment already shows.\n */\nfunction describeScale(themeKey: string, strategy: string): string {\n const namespace = `\\`--${themeKey}-*\\``\n\n if (themeKey === 'spacing' && strategy.startsWith('multiplier')) {\n const base = `The bare \\`--spacing\\` multiplier is set, which makes every number a valid spacing value (e.g. p-13).`\n return strategy === 'multiplier' ? base : `Named ${namespace} theme values. ${base}`\n }\n\n const prefix =\n themeKey === 'color'\n ? `Color keywords plus the ${namespace} theme values`\n : `The ${namespace} theme values`\n\n if (strategy === 'families') {\n return `${prefix}, with families sharing numeric suffixes compressed into nested matchers.`\n }\n if (strategy.startsWith('validator:')) {\n return `${prefix}, all matching \\`${strategy.slice('validator:'.length)}\\`.`\n }\n if (strategy.startsWith('mixed:')) {\n return `${prefix}: enumerated outliers plus the \\`${strategy.slice('mixed:'.length)}\\` pattern covering the rest.`\n }\n return `${prefix}.`\n}\n\nconst validatorNames = new Map<unknown, ValidatorName>(\n Object.entries(validators).map(([name, validator]) => [validator, name as ValidatorName]),\n)\n\nfunction isThemeGetter(value: Function): value is ThemeGetter {\n return 'isThemeGetter' in value && value.isThemeGetter === true\n}\n\n/**\n * Removes duplicate literals and validator references while keeping the first occurrence, since substituting a theme scale can repeat values the skeleton already defines statically (e.g. `text-base` exists both as skeleton literal and as `--text-base` theme value).\n */\nfunction dedupeValues(values: PlanValue[]): PlanValue[] {\n const seen = new Set<string>()\n\n return values.filter((value) => {\n if (value.kind === 'object') {\n return true\n }\n const key = value.kind === 'class' ? `c:${value.value}` : `v:${value.name}`\n if (seen.has(key)) {\n return false\n }\n seen.add(key)\n return true\n })\n}\n\nexport function filterConflictMap(\n conflictMap: Partial<Record<string, readonly string[]>>,\n classGroups: Map<string, PlanValue[]>,\n): Map<string, string[]> {\n const filtered = new Map<string, string[]>()\n\n for (const [classGroupId, conflicts] of Object.entries(conflictMap)) {\n if (!classGroups.has(classGroupId) || !conflicts) {\n continue\n }\n const existingConflicts = conflicts.filter((conflictId) => classGroups.has(conflictId))\n if (existingConflicts.length > 0) {\n filtered.set(classGroupId, existingConflicts)\n }\n }\n\n return filtered\n}\n","import { validators } from 'tailwind-merge'\nimport { createClassGroupLookup } from 'tailwind-merge/unstable-do-not-import'\n\nimport { materializeConfig } from './materialize.ts'\nimport { type ConfigPlan, type PlanValue, filterConflictMap } from './plan.ts'\n\n/**\n * Shrinks a plan to the class names a project actually uses: groups and members survive only when needed by a used class's lookup, including intermediate base matchers for slash-modified classes — literals a used class names, nested prefix objects a used class descends into, and validators a used class's remaining tail satisfies.\n *\n * The pruned plan merges exactly like the full plan for every class list made of used classes, by construction: it is a subset of the full plan with tailwind-merge's lookup precedence intact. Classification of a used class records the lookups of tailwind-merge's own merge engine (prefix, variants, important marker, and postfix modifiers), so a class matched via a literal keeps that literal and a class matched via a validator keeps that validator, in the same group and at the same trie position; removing other members can never promote a previously losing candidate, because lookup tries deeper literal paths first and validators in definition order, and that order is preserved among the survivors. Members are only ever removed, never re-encoded, and validators are kept whenever any used tail satisfies them — over-keeping is always safe, under-keeping never is. Retained validators can also classify names outside the used set, so the result is not a strict allowlist. Only supplied candidates carry the equivalence guarantee; consumers with externally supplied, separately styled class names should keep the full config.\n *\n * Used classes are raw tokens as a scanner finds them (`hover:bg-red-500/50`, `tw:p-4!`, `-mt-2`), deduplicated here; anything that does not classify is ignored. Conflict maps are filtered to the kept groups, `scales` stay untouched (the emitter drops shared consts nothing references anymore), and the result records what happened in `report.pruning`. The input plan is not mutated.\n */\nexport function prunePlan(plan: ConfigPlan, usedClasses: Iterable<string>): ConfigPlan {\n const config = materializeConfig(plan)\n const lookupClass = createClassGroupLookup(config)\n\n /** Every successful lookup needed by a used class, including a base group that enables a subsequent postfix lookup. Names contain only the part the class map matched, with a leading minus removed. */\n const matchedNamesByGroup = new Map<string, Set<string>>()\n const seen = new Set<string>()\n let classifiedClassCount = 0\n\n for (const rawClassName of usedClasses) {\n const className = rawClassName.trim()\n if (className === '' || seen.has(className)) {\n continue\n }\n seen.add(className)\n\n const matches = lookupClass(className)\n if (matches.length > 0) {\n classifiedClassCount += 1\n }\n for (const match of matches) {\n const { classGroupId } = match\n let names = matchedNamesByGroup.get(classGroupId)\n if (!names) {\n names = new Set()\n matchedNamesByGroup.set(classGroupId, names)\n }\n names.add(lookupName(match.className))\n }\n }\n\n const classGroups = new Map<string, PlanValue[]>()\n const removedClassGroups: string[] = []\n const unprunedClassGroups: string[] = []\n\n for (const [classGroupId, items] of plan.classGroups) {\n const names = matchedNamesByGroup.get(classGroupId)\n if (!names) {\n removedClassGroups.push(classGroupId)\n continue\n }\n const prunedItems = pruneItems(items, names)\n if (prunedItems.length === 0) {\n // A used class resolved into this group, but the walk found nothing it reaches — keep the group whole rather than risk undermatching; the report makes the discrepancy visible.\n unprunedClassGroups.push(classGroupId)\n classGroups.set(classGroupId, items)\n } else {\n classGroups.set(classGroupId, prunedItems)\n }\n }\n\n return {\n ...plan,\n classGroups,\n conflictingClassGroups: filterConflictMap(\n Object.fromEntries(plan.conflictingClassGroups),\n classGroups,\n ),\n conflictingClassGroupModifiers: filterConflictMap(\n Object.fromEntries(plan.conflictingClassGroupModifiers),\n classGroups,\n ),\n postfixLookupClassGroups: plan.postfixLookupClassGroups.filter((classGroupId) =>\n classGroups.has(classGroupId),\n ),\n report: {\n ...plan.report,\n pruning: {\n usedClassCount: seen.size,\n classifiedClassCount,\n classGroupsBefore: plan.classGroups.size,\n classGroupsAfter: classGroups.size,\n removedClassGroups,\n unprunedClassGroups,\n },\n },\n }\n}\n\n/**\n * Keeps the items of one class-group level that some name in `names` reaches, walking nested prefix objects the way tailwind-merge's class map does: an object entry's key is a dash-separated prefix, so a name descends into it with the key stripped (`red-500` enters `{ red: […] }` as `500`), a name equal to the key enters as the empty string (the `''` literal marks \"the prefix alone is a class\"), and validators see the remaining tail at their level. Literal strings must match the remaining name exactly.\n */\nfunction pruneItems(items: PlanValue[], names: Set<string>): PlanValue[] {\n const kept: PlanValue[] = []\n\n for (const item of items) {\n if (item.kind === 'class') {\n if (names.has(item.value)) {\n kept.push(item)\n }\n } else if (item.kind === 'validator') {\n const validator = validators[item.name]\n for (const name of names) {\n if (validator(name)) {\n kept.push(item)\n break\n }\n }\n } else {\n const entries: [string, PlanValue[]][] = []\n for (const [key, entryItems] of item.entries) {\n const tails = new Set<string>()\n for (const name of names) {\n if (name === key) {\n tails.add('')\n } else if (name.startsWith(`${key}-`)) {\n tails.add(name.slice(key.length + 1))\n }\n }\n if (tails.size === 0) {\n continue\n }\n const prunedEntryItems = pruneItems(entryItems, tails)\n if (prunedEntryItems.length > 0) {\n entries.push([key, prunedEntryItems])\n }\n }\n if (entries.length > 0) {\n kept.push({ kind: 'object', entries })\n }\n }\n }\n\n return kept\n}\n\n/** The string the class map walks for a matched class: negative classes like `-mt-2` start their lookup after the empty first part, exactly as `getClassGroupId` skips it. */\nfunction lookupName(matchedClassName: string): string {\n const parts = matchedClassName.split('-')\n return parts[0] === '' && parts.length > 1 ? parts.slice(1).join('-') : matchedClassName\n}\n","import { type DesignSystemAccess } from './design-system.ts'\n\nexport interface ThemeSnapshot {\n /** Class name prefix configured via `@import 'tailwindcss' prefix(…)`, or `null` without one. */\n prefix: string | null\n /** Effective theme values per tailwind-merge theme key. */\n scales: Map<string, ScaleSnapshot>\n}\n\nexport interface ScaleSnapshot {\n /** Value names within the namespace, e.g. `red-500` for `--color-red-500`. Order follows theme definition order (defaults first, then user values). */\n names: string[]\n /** Whether the bare namespace variable exists, e.g. `--spacing` itself, which drives Tailwind's numeric spacing scale. */\n hasBareValue: boolean\n}\n\n/**\n * Captures the effective theme per namespace from a loaded design system.\n *\n * Reading the design system instead of parsing CSS text means defaults, `@import` chains, namespace resets (`--color-*: initial`), `@config`/`@plugin` contributions and value precedence are all Tailwind's responsibility — the snapshot only records the result. Values are intentionally not resolved: only which names exist matters for class classification.\n *\n * Variables outside the supported namespaces (e.g. `--z-index-*`) and in Tailwind's compat sub-namespaces (e.g. `--text-color-*`, which shares the `--text` prefix but feeds other utilities) are not captured here — the classes they create are picked up by the vanilla-diff augmentation pass instead, which classifies them empirically.\n */\nexport function snapshotTheme(\n designSystem: DesignSystemAccess,\n themeKeys: string[],\n): ThemeSnapshot {\n const prefix = designSystem.theme.prefix ?? null\n\n const scales = new Map<string, ScaleSnapshot>(\n themeKeys.map((themeKey) => [themeKey, { names: [], hasBareValue: false }]),\n )\n\n // Longest key first so `--text-shadow-2xs` lands in `text-shadow` and never in `text`.\n const keysByLength = [...themeKeys].sort((a, b) => b.length - a.length)\n\n for (const [variableName] of designSystem.theme.entries()) {\n if (!variableName.startsWith('--')) {\n continue\n }\n let path = variableName.slice(2)\n // With `@import 'tailwindcss' prefix(tw)` the theme stores every variable prefixed (`--tw-color-*`); namespace bucketing works on the logical name.\n if (prefix !== null) {\n if (!path.startsWith(`${prefix}-`)) {\n continue\n }\n path = path.slice(prefix.length + 1)\n }\n\n const themeKey = keysByLength.find((key) => path === key || path.startsWith(`${key}-`))\n if (\n !themeKey ||\n IGNORED_SUB_NAMESPACES[themeKey]?.some(\n (subNamespace) => path === subNamespace || path.startsWith(`${subNamespace}-`),\n )\n ) {\n continue\n }\n\n const scale = scales.get(themeKey)!\n if (path === themeKey) {\n scale.hasBareValue = true\n continue\n }\n\n const name = path.slice(themeKey.length + 1)\n // Compound keys like `--text-xl--line-height` configure sub-values of an existing name and don't produce class names of their own.\n if (!name.includes('--')) {\n scale.names.push(name)\n }\n }\n\n return { prefix, scales }\n}\n\n/**\n * Tailwind's compat sub-namespaces, keyed by the theme key whose prefix they share: `--text-color-brand` is not a `text-*` font size, `--font-size-huge` not a `font-*` family. Mirrors the map Tailwind's theme resolution excludes when it reads a namespace (`ignoredThemeKeyMap` in tailwindcss's theme.ts) in full; sub-namespaces that are theme keys of their own (`text-shadow`, `font-weight`, `inset-shadow`, `inset-ring`) are listed as well so the exclusion does not depend on key length. Prefix matching alone would enumerate these names as scale members, and a name Tailwind never turns into a class would then evict a real one.\n */\nconst IGNORED_SUB_NAMESPACES: Record<string, readonly string[]> = {\n font: ['font-weight', 'font-size'],\n inset: ['inset-shadow', 'inset-ring'],\n text: [\n 'text-color',\n 'text-decoration-color',\n 'text-decoration-thickness',\n 'text-indent',\n 'text-shadow',\n 'text-underline-offset',\n ],\n 'grid-column': ['grid-column-start', 'grid-column-end'],\n 'grid-row': ['grid-row-start', 'grid-row-end'],\n}\n","import { getDefaultConfig } from 'tailwind-merge'\nimport { type AnyConfig, createClassGroupUtils, createParseClassName } from 'tailwind-merge/unstable-do-not-import'\n\nimport { buildAugmentations } from './augment.ts'\nimport { type EncodingMode } from './compress.ts'\nimport { segment } from './css-statements.ts'\nimport { buildCustomUtilityPlan } from './custom-utilities.ts'\nimport {\n type DesignSystemAccess,\n type TailwindIntegration,\n declaredDeclarations,\n loadDesignSystems,\n} from './design-system.ts'\nimport { type EmitOptions, emitModule } from './emit.ts'\nimport { materializeConfig } from './materialize.ts'\nimport { type ConfigPlan, applyAugmentations, applyCustomUtilityPlan, buildPlan } from './plan.ts'\nimport { prunePlan } from './prune.ts'\nimport { snapshotTheme } from './snapshot.ts'\n\nexport interface GenerateOptions {\n /** Content of the project's Tailwind CSS entrypoint (the file containing `@import 'tailwindcss'` and `@theme` customizations). */\n css: string\n /** Directory used to resolve imports in the CSS, usually the directory containing the entrypoint. Tailwind resolves stylesheet and module imports from here; the compiler itself comes from the configurator's installed `@tailwindcss/node`. */\n base: string\n /** Optional bundler resolution and dependency hooks; omitted for ordinary filesystem/package resolution. */\n integration?: TailwindIntegration\n /** LRU cache size passed through to the generated config. Defaults to the default config's value. */\n cacheSize?: number\n /** How finite value sets (theme scales, custom-utility values) are encoded. 'compact' (default) picks the smallest matcher even when it accepts names beyond the theme — smallest bundle, but a nonexistent name like `rounded-xs` on a t-shirt scale can evict a real class. 'exact' enumerates finite names to avoid that overmatching, at a size cost; arbitrary-value types remain approximate. See `EncodingMode`. */\n encoding?: EncodingMode\n /** Comment lines placed below the generated-file notice at the top of the emitted module, e.g. provenance info like input path and content hash. May be a promise: it is awaited only when the module is emitted at the end of generation, so text that depends on work overlapping generation (like a source scan) needs no separate step. */\n banner?: string | PromiseLike<string>\n /** Output language of the emitted module — see `EmitOptions.format`. Defaults to TypeScript. */\n format?: 'ts' | 'js'\n /** Module specifier the emitted code imports tailwind-merge's API from — see `EmitOptions.importSource`. */\n importSource?: string\n /** Shrinks the generated config to the classes a project uses: class names as a source scanner finds them (variants, important markers, and postfix modifiers included — see `createSourceScanner`). Class groups and scale members no listed class reaches are dropped; every class list made of listed classes merges exactly as with the full config, while retained validators may also match unlisted classes. The result is reported in `plan.report.pruning`. The names may be a promise: pruning runs last, so a source scan can overlap with design-system loading and classification instead of preceding them; a promise resolving to `null` skips pruning and keeps the full config, for callers whose scan fails after generation has started. */\n prune?: { usedClasses: Iterable<string> | PromiseLike<Iterable<string> | null> }\n}\n\nexport interface GenerateResult {\n /** Source code of the generated module exporting `getConfig` and `twMerge`. */\n code: string\n /** The same config as a runtime object, so callers (and tests) can use the generated behavior without writing `code` to disk and importing it. */\n config: AnyConfig\n /** Intermediate representation, including the report on encoding strategies, pruned groups, and augmentations. */\n plan: ConfigPlan\n /** Prunes this generation to another set of used classes, skipping design-system loading and classification: the result is what `generate` would have returned for those classes with the same options. Meant for watchers that re-scan sources after an edit while the CSS graph is unchanged. */\n prune(usedClasses: Iterable<string>): GenerateResult\n}\n\n/**\n * Generates a project-specific tailwind-merge setup from a Tailwind CSS v4 entrypoint.\n *\n * The design system is loaded through Tailwind's own APIs with defaults merged, overrides applied, and resets executed. Keep the installed compiler aligned with the version that builds the project's CSS. The default tailwind-merge config acts as the structural skeleton — class group semantics and conflict relationships — while every theme reference in it is replaced with exact values from the design system.\n *\n * Classes the theme creates outside the standard namespaces (compat sub-namespaces like `--text-color-*`, or namespaces without a theme key like `--z-index-*`) are found by diffing against a vanilla design system of the same Tailwind installation and classified empirically by their compiled CSS declarations, so no namespace mapping needs to be hand-maintained anywhere.\n */\nexport async function generate(options: GenerateOptions): Promise<GenerateResult> {\n const designSystems = await loadDesignSystems({\n css: options.css,\n base: options.base,\n integration: options.integration,\n })\n return generateFromDesignSystems(designSystems, options)\n}\n\n/**\n * The classification and emission half of `generate`, on design systems the caller has already loaded. Not part of the public API — `generate` is the entry point and loads the systems itself. The test fixtures use the split to hand one loaded project to both generation and their own conformance sweeps, sharing its class list and compiled-declaration caches instead of loading and compiling the same theme twice, and to reuse one vanilla system across every fixture in a worker.\n */\nexport async function generateFromDesignSystems(\n { project, vanilla }: { project: DesignSystemAccess; vanilla: DesignSystemAccess },\n options: Omit<GenerateOptions, 'css' | 'base' | 'integration'>,\n): Promise<GenerateResult> {\n const themeKeys = Object.keys(getDefaultConfig().theme)\n const encoding = options.encoding ?? 'compact'\n\n const plan = buildPlan({\n snapshot: snapshotTheme(project, themeKeys),\n cacheSize: options.cacheSize,\n encoding,\n })\n\n // Both classifiers reuse the configurator's own output: the pre-augmentation project config decides which new classes are already covered, the vanilla config buckets sibling classes into the candidate groups for classification. They run without the prefix because class-list names are unprefixed — the prefix only applies to real candidates like `tw:bg-red-500`. The vanilla classifier always runs compact: real class names classify identically under both encodings, and compact skips the probing work.\n const vanillaPlan = buildPlan({ snapshot: snapshotTheme(vanilla, themeKeys) })\n const vanillaClassGroupUtils = createClassGroupUtils(materializeConfig(vanillaPlan))\n\n // Establish custom ownership before the diff passes run, including classes deliberately left unclassified, so property-only augmentation cannot undo effect-aware decisions.\n const customUtilities = buildCustomUtilityPlan({\n project,\n vanilla,\n vanillaClassGroupId: vanillaClassGroupUtils.getClassGroupId,\n encoding,\n })\n applyCustomUtilityPlan(plan, customUtilities)\n\n const projectClassGroupUtils = createClassGroupUtils(\n materializeConfig({ ...plan, prefix: null }),\n )\n\n // Top-level class-name prefixes per group, so augmentation can probe a value under a group's other spellings (the `start` group holds both `inset-s` and the deprecated `start`, but Tailwind's class list only ever suggests `inset-s-*`).\n const groupPrefixKeys = new Map<string, string[]>()\n for (const [groupId, items] of plan.classGroups) {\n const prefixes = items.flatMap((item) =>\n item.kind === 'object' ? item.entries.map(([key]) => key) : [],\n )\n if (prefixes.length > 0) {\n groupPrefixKeys.set(groupId, prefixes)\n }\n }\n\n applyAugmentations(\n plan,\n buildAugmentations({\n project,\n vanilla,\n projectClassGroupId: projectClassGroupUtils.getClassGroupId,\n vanillaClassGroupId: vanillaClassGroupUtils.getClassGroupId,\n groupPrefixKeys,\n customGroupIds: new Set(customUtilities.groups.keys()),\n preservedCustomClasses: customUtilities.preservedClasses,\n }),\n )\n plan.postfixLookupClassGroups = [\n ...new Set([\n ...plan.postfixLookupClassGroups,\n ...staticPostfixLookupGroups(project, plan),\n ]),\n ]\n\n // Inspect variants after utility classification: selector inspection populates Tailwind's parsed-variant cache, which it sorts again on every candidate compilation. Doing this earlier makes every utility probe pay for all inspected variants.\n plan.orderSensitiveModifiers = [\n ...new Set([\n ...plan.orderSensitiveModifiers,\n ...customOrderSensitiveModifiers(project, vanilla),\n ]),\n ]\n\n // Pruning runs last, on the finished plan: only then does classification see every member a used class could reach (custom utilities, augmented classes, collision corrections included).\n const usedClasses = options.prune ? await options.prune.usedClasses : null\n return assembleResult(plan, usedClasses, {\n banner: await options.banner,\n format: options.format,\n importSource: options.importSource,\n })\n}\n\n/** Everything after classification: prune to the used classes, if any, then emit and materialize. Kept apart so a result can be re-pruned for other classes without repeating the expensive part. */\nfunction assembleResult(\n plan: ConfigPlan,\n usedClasses: Iterable<string> | null,\n emitOptions: EmitOptions,\n): GenerateResult {\n const finalPlan = usedClasses ? prunePlan(plan, usedClasses) : plan\n return {\n code: emitModule(finalPlan, emitOptions),\n config: materializeConfig(finalPlan),\n plan: finalPlan,\n prune: (nextUsedClasses) => assembleResult(plan, nextUsedClasses, emitOptions),\n }\n}\n\n/** Added or redefined variants that style another target are ordering barriers, like the default before/after/child modifiers. Compile their suggested spellings so theme-only media changes and ordinary state variants keep commuting; selector lists are conservative because they can mix targets. */\nfunction customOrderSensitiveModifiers(\n project: DesignSystemAccess,\n vanilla: DesignSystemAccess,\n): string[] {\n const defaults = new Map(vanilla.getVariants().map((variant) => [variant.name, variant]))\n const modifiers = new Set<string>()\n for (const variant of project.getVariants()) {\n const original = defaults.get(variant.name)\n if (\n !original ||\n JSON.stringify(variant.selectors()) !== JSON.stringify(original.selectors())\n ) {\n modifiers.add(variant.name)\n }\n for (const value of variant.values) {\n if (\n !original ||\n !original.values.includes(value) ||\n JSON.stringify(variant.selectors({ value })) !==\n JSON.stringify(original.selectors({ value }))\n ) {\n modifiers.add(`${variant.name}${variant.hasDash ? '-' : ''}${value}`)\n }\n }\n }\n return [...modifiers].filter((modifier) =>\n declaredDeclarations(project, `${modifier}:block`)?.some(\n (entry) =>\n entry.context !== '' ||\n entry.scope.some((rule) => !rule.startsWith('@') && segment(rule, ',').length > 1),\n ),\n )\n}\n\n/** Static names can contain slashes too: badge/icon must reach its own group instead of inheriting badge's group. Use the final classifier after aliases and augmentation establish both owners, and the runtime parser for the exact postfix boundary. Pruning then retains both lookups. */\nfunction staticPostfixLookupGroups(project: DesignSystemAccess, plan: ConfigPlan): string[] {\n const classNames = project.utilities.keys('static').filter((name) => name.includes('/'))\n if (classNames.length === 0) {\n return []\n }\n // Registry names are unprefixed, including under a prefixed theme.\n const config = materializeConfig({ ...plan, prefix: null })\n const parseClassName = createParseClassName(config)\n const { getClassGroupId } = createClassGroupUtils(config)\n const groups = new Set<string>()\n for (const className of classNames) {\n const { baseClassName, maybePostfixModifierPosition } = parseClassName(className)\n if (!maybePostfixModifierPosition) {\n continue\n }\n const baseGroup = getClassGroupId(baseClassName.slice(0, maybePostfixModifierPosition))\n const fullGroup = getClassGroupId(baseClassName)\n if (baseGroup && fullGroup && baseGroup !== fullGroup) {\n groups.add(baseGroup)\n }\n }\n return [...groups]\n}\n","import { readFile } from 'node:fs/promises'\n\nimport { Features, compile } from '@tailwindcss/node'\nimport { type GlobEntry, type Scanner, type SourceEntry } from '@tailwindcss/oxide'\n\nimport { cssStatements, segment } from './css-statements.ts'\nimport { type TailwindIntegration } from './design-system.ts'\nimport { createModuleResolver, createStylesheetResolver } from './resolvers.ts'\n\nexport interface SourceScannerOptions {\n /** Content of the Tailwind CSS entrypoint. */\n css: string\n /** Directory the CSS resolves imports from, usually the entrypoint's directory — the same `base` as for `generate`. */\n base: string\n /** Directories Tailwind's automatic source detection starts from when the CSS sets no `source(…)`: the Vite root for `@tailwindcss/vite`, the working directory for the PostCSS plugin and the CLI. Several bases scan the union. */\n autoDetectBases: readonly string[]\n /** Use the same bundler resolution hooks as generation so imports, safelists, and dependencies agree. */\n integration?: TailwindIntegration\n}\n\nexport interface SourceScanner {\n /** Files of the CSS graph Tailwind read while compiling — `@import`ed stylesheets, `@config`/`@plugin` modules. The entrypoint itself is not included (the caller has it). */\n dependencies: ReadonlySet<string>\n /** The sources exactly as Tailwind's scanner receives them: the automatic-detection entries followed by every `@source` directive (negated ones included) and `@config` content path. */\n sources: readonly SourceEntry[]\n /** Whether the CSS uses Tailwind's utilities layer at all. Without it Tailwind scans nothing and no utility class renders, so the scan returns only the safelist. */\n scansUtilities: boolean\n /** Class names Tailwind generates regardless of what the sources contain — `@source inline(…)`, brace-expanded. */\n safelist: readonly string[]\n /** Runs the scan over the sources. Cheap to call again: the underlying scanner caches file state across calls, so re-scanning after edits costs milliseconds. */\n scan(): UsageScan\n}\n\nexport interface UsageScan {\n /** Distinct candidate tokens Tailwind's scanner extracts from the sources, plus the safelist, minus `@source not inline(…)` exclusions — every string that could render as a utility class. Raw tokens, not validated: words like `const` are in here too, and classification against the generated config sorts them out. */\n classes: string[]\n /** Files the scan read, for watching. */\n files: string[]\n /** Glob entries the scan covers, for watching files that don't exist yet. */\n globs: GlobEntry[]\n}\n\n/**\n * Finds the class names a project can render, the way Tailwind does: the same candidate extractor (`@tailwindcss/oxide`'s scanner), over the same sources (`source(…)`, automatic detection, every `@source`), plus the `@source inline(…)` safelist. Pruning uses these candidates to preserve the full generated config's merge behavior for the same source usage.\n *\n * The sources come from Tailwind's own `compile()` (its `root` and `sources` results), which is also what reports the CSS graph's dependencies, so one compile serves both. What `compile()` does not expose is the safelist: `@source inline(…)` candidates stay private to its `build()`, so they are parsed from the entrypoint and every CSS dependency here, with Tailwind's brace-expansion rules. Negated inline sources exclude candidates even when they occur in files, exactly like Tailwind, which refuses to generate them.\n *\n * `@tailwindcss/oxide` is loaded lazily because it is a native module: a setup without a binary for its platform should fail only when scanning is requested, not when the configurator is imported.\n */\nexport async function createSourceScanner(options: SourceScannerOptions): Promise<SourceScanner> {\n const dependencies = new Set<string>()\n const stylesheets = new Set<string>()\n const compiler = await compile(options.css, {\n base: options.base,\n customCssResolver: createStylesheetResolver(\n options.integration?.resolveCss,\n (file) => stylesheets.add(file),\n options.integration?.onDependency,\n ),\n customJsResolver: createModuleResolver(\n options.integration?.resolveJs,\n options.integration?.onDependency,\n ),\n onDependency: (dependencyPath) => {\n dependencies.add(dependencyPath)\n options.integration?.onDependency?.(dependencyPath)\n },\n })\n\n const sources = [...autoDetectSources(compiler.root, options.autoDetectBases), ...compiler.sources]\n const scansUtilities = (compiler.features & Features.Utilities) !== 0\n const { safelist, exclusions } = await collectInlineSources(options.css, stylesheets)\n const scanner = new (await loadScanner())({ sources })\n\n return {\n dependencies,\n sources,\n scansUtilities,\n safelist,\n scan() {\n const classes = new Set(scansUtilities ? scanner.scan() : [])\n for (const className of safelist) {\n classes.add(className)\n }\n for (const className of exclusions) {\n classes.delete(className)\n }\n return { classes: [...classes], files: scanner.files, globs: scanner.globs }\n },\n }\n}\n\n/** Mirrors how `@tailwindcss/vite`, `@tailwindcss/postcss`, and the CLI turn the compiler's `root` into scanner sources: `source(none)` disables automatic detection, no `source(…)` means \"everything under the base directory\", and an explicit `source(…)` is the one directory to detect in. */\nfunction autoDetectSources(\n root: 'none' | { base: string; pattern: string } | null,\n autoDetectBases: readonly string[],\n): SourceEntry[] {\n if (root === 'none') {\n return []\n }\n if (root === null) {\n return autoDetectBases.map((base) => ({ base, pattern: '**/*', negated: false }))\n }\n return [{ ...root, negated: false }]\n}\n\nasync function loadScanner(): Promise<typeof Scanner> {\n try {\n const oxide = await import('@tailwindcss/oxide')\n return oxide.Scanner\n } catch (error) {\n throw new Error(\n `Scanning sources needs @tailwindcss/oxide with a binary for this platform (${process.platform}-${process.arch}): ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Collects `@source inline(…)` safelist entries and `@source not inline(…)` exclusions from the entrypoint and the CSS files of its import graph. Tailwind's rules: the quoted argument is split into patterns at top-level whitespace, each pattern is brace-expanded, and the result is a plain candidate list — variants included (`{hover:,}underline`).\n */\nasync function collectInlineSources(\n css: string,\n stylesheets: ReadonlySet<string>,\n): Promise<{ safelist: string[]; exclusions: string[] }> {\n const safelist = new Set<string>()\n const exclusions = new Set<string>()\n\n const cssTexts = [css]\n for (const file of stylesheets) {\n const content = await readFile(file, 'utf8').catch(() => null)\n if (content !== null) {\n cssTexts.push(content)\n }\n }\n\n for (const text of cssTexts) {\n for (const statement of cssStatements(text)) {\n const match = INLINE_SOURCE_RE.exec(statement)\n if (!match) {\n continue\n }\n const target = match[1] ? exclusions : safelist\n for (const pattern of segment(match[3]!, ' ')) {\n if (pattern === '') {\n continue\n }\n for (const candidate of expandBraces(pattern)) {\n target.add(candidate)\n }\n }\n }\n }\n\n return { safelist: [...safelist], exclusions: [...exclusions] }\n}\n\n/** `@source inline(\"…\")` and `@source not inline('…')`, argument in either quote style. Tailwind requires the quotes, so unquoted forms are not a thing. */\nconst INLINE_SOURCE_RE = /^@source\\s+(not\\s+)?inline\\(\\s*([\"'])((?:\\\\.|(?!\\2)[^\\\\])*)\\2\\s*\\)$/\n\nconst NUMERICAL_RANGE_RE = /^(-?\\d+)\\.\\.(-?\\d+)(?:\\.\\.(-?\\d+))?$/\n\n/**\n * Brace expansion with Tailwind's semantics (`packages/tailwindcss/src/utils/brace-expansion.ts`): comma lists (`{hover:,focus:}`), numeric ranges with optional step and direction (`{100..900..100}`, `{5..0}`), nesting (`bg-red-{50,{100..900..100},950}`), and cartesian products across several groups. Unbalanced braces and zero steps throw like upstream; decimal ranges stay literal.\n */\nexport function expandBraces(pattern: string): string[] {\n const openIndex = pattern.indexOf('{')\n if (openIndex === -1) {\n return [pattern]\n }\n\n const prefix = pattern.slice(0, openIndex)\n const rest = pattern.slice(openIndex)\n\n let depth = 0\n let closeIndex = -1\n for (let index = 0; index < rest.length; index++) {\n const character = rest[index]\n if (character === '{') {\n depth += 1\n } else if (character === '}') {\n depth -= 1\n if (depth === 0) {\n closeIndex = index\n break\n }\n }\n }\n if (closeIndex === -1) {\n throw new Error(`The pattern \\`${pattern}\\` is not balanced.`)\n }\n\n const inside = rest.slice(1, closeIndex)\n const suffix = rest.slice(closeIndex + 1)\n const parts = (\n NUMERICAL_RANGE_RE.test(inside) ? expandSequence(inside) : segment(inside, ',')\n ).flatMap((part) => expandBraces(part))\n\n const expanded: string[] = []\n for (const suffixVariant of expandBraces(suffix)) {\n for (const part of parts) {\n expanded.push(prefix + part + suffixVariant)\n }\n }\n return expanded\n}\n\nfunction expandSequence(sequence: string): string[] {\n const match = NUMERICAL_RANGE_RE.exec(sequence)\n if (!match) {\n return [sequence]\n }\n const start = Number.parseInt(match[1]!, 10)\n const end = Number.parseInt(match[2]!, 10)\n let step = match[3] === undefined ? (start <= end ? 1 : -1) : Number.parseInt(match[3], 10)\n if (step === 0) {\n throw new Error('Step cannot be zero in sequence expansion.')\n }\n const increasing = start < end\n if (increasing && step < 0) {\n step = -step\n }\n if (!increasing && step > 0) {\n step = -step\n }\n\n const values: string[] = []\n for (let value = start; increasing ? value <= end : value >= end; value += step) {\n values.push(String(value))\n }\n return values\n}\n","import { readFile, readdir, realpath, stat } from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {\n type TailwindIntegration,\n createStylesheetResolver,\n cssStatements,\n} from '@tailwind-merge/configurator'\n\nexport interface DiscoveryOptions {\n /** The plugin's stylesheet resolution (aliases and the like), when its bundler has one. Omitted for ordinary filesystem and package resolution. */\n resolveCss?: TailwindIntegration['resolveCss']\n /** The plugin's package name, prefixed to the ambiguity error so users see which plugin is asking for the `css` option. */\n packageName?: string\n}\n\n/**\n * Finds the project's Tailwind CSS entrypoint by scanning `root` for CSS files with Tailwind root markers.\n *\n * The scan is eager and filesystem-based on purpose: bundler integrations of Tailwind discover roots lazily from the module graph, but a plugin's runtime module can be requested before any CSS has flowed through the pipeline, so the plugin must know the root up front.\n *\n * When several files carry markers, files transitively `@import`ed by another candidate are dropped — a root is the top of its own import graph (a multi-file theme's token and utility layers all contain `@theme`/`@utility` markers of their own). Follow import-only intermediates, including explicit paths outside the scan root, and visit each file once to bound shared dependencies and cycles. More than one root after that is a hard error asking for the plugin's `css` option; none found returns null and the caller falls back to default tailwind-merge behavior.\n */\nexport async function discoverCssRoot(\n root: string,\n { resolveCss, packageName }: DiscoveryOptions = {},\n): Promise<string | null> {\n // Graph identities use real paths: a symlinked project root and resolved imports can spell the same file differently. Keep scanned paths for import resolution, the selected entrypoint, and root-relative diagnostics.\n const candidates = new Map<string, string>()\n const statementsByFile = new Map<string, string[] | null>()\n\n for (const file of await collectCssFiles(root)) {\n const identity = await realpath(file).catch(() => file)\n const statements = await readStatements(file)\n statementsByFile.set(identity, statements)\n if (statements?.some((statement) => ROOT_MARKER_RE.test(statement))) {\n candidates.set(identity, file)\n }\n }\n\n if (candidates.size === 0) {\n return null\n }\n\n const importedByCandidate = new Set<string>()\n const resolveImport = createStylesheetResolver(resolveCss)\n const pending = [...candidates]\n const visited = new Set<string>()\n while (pending.length > 0) {\n const [identity, file] = pending.pop()!\n if (visited.has(identity)) {\n continue\n }\n visited.add(identity)\n // Import-only intermediates are not candidates, but can lead to one. Read explicit imports outside the initial scan too, and cache misses as well as successful reads.\n if (!statementsByFile.has(identity)) {\n statementsByFile.set(identity, await readStatements(file))\n }\n const statements = statementsByFile.get(identity)\n if (statements === null || statements === undefined) {\n continue\n }\n for (const statement of statements) {\n const match = CSS_IMPORT_RE.exec(statement)\n if (!match) {\n continue\n }\n // Use generation's resolver even after alias expansion: the result may still name a directory with a package style entry. Missing imports cannot add graph edges; generation owns their errors and recovery dependencies.\n const target = await resolveImport(match[1] as string, path.dirname(file)).catch(\n () => null,\n )\n if (target !== null) {\n const targetIdentity = await realpath(target).catch(() => target)\n importedByCandidate.add(targetIdentity)\n pending.push([targetIdentity, target])\n }\n }\n }\n\n const roots = [...candidates]\n .filter(([identity]) => !importedByCandidate.has(identity))\n .map(([, file]) => file)\n if (roots.length === 1) {\n return roots[0] as string\n }\n\n const listed = (roots.length > 1 ? roots : [...candidates.values()])\n .map((file) => ` - ${path.relative(root, file)}`)\n .join('\\n')\n const prefix = packageName ? `[${packageName}] ` : ''\n throw new Error(\n `${prefix}Found multiple Tailwind CSS roots and cannot decide which one configures tailwind-merge:\\n${listed}\\nSet the plugin's \\`css\\` option to the entrypoint that defines your theme.`,\n )\n}\n\n/** Matches active statements that can mark a Tailwind v4 root: the `tailwindcss` import (or one of its sub-imports) or Tailwind's own at-rules, `@source` included — an app entrypoint may add nothing but source directives on top of an imported shared theme, and the pruning scanner only sees the directives of the compiled root. Anchoring excludes directive-like text inside selectors and declaration values. */\nconst ROOT_MARKER_RE =\n /^@import\\s+(?:url\\(\\s*)?[\"']tailwindcss(?:\\/[^\"']*)?[\"']|^@(?:theme|config|plugin|tailwind|utility|custom-variant|source)(?:\\s|$)/\n\nconst CSS_IMPORT_RE = /^@import\\s+(?:url\\(\\s*)?[\"']([^\"']+)[\"']/\n\n/** Tokenize each stylesheet once so marker detection and import traversal share the same comment/string boundaries. Missing or unreadable files cannot contribute discovery candidates. */\nasync function readStatements(file: string): Promise<string[] | null> {\n const content = await readFile(file, 'utf-8').catch(() => null)\n return content === null ? null : [...cssStatements(content)]\n}\n\n/** Directories that never contain the project's own Tailwind entrypoint. Dot-directories (.git, .next, .svelte-kit, …) are skipped wholesale in the walk. */\nconst IGNORED_DIRECTORY_NAMES = new Set([\n 'node_modules',\n 'dist',\n 'build',\n 'out',\n 'coverage',\n 'public',\n])\n\nconst CSS_EXTENSIONS = new Set(['.css', '.pcss', '.postcss'])\n\n/** Limit the eager scan to plain-CSS filenames. Following explicit imports is separate and does not impose an extension requirement. Symlinks are followed (a shared theme package linked into the app is a common layout), with directories visited once by real path so linked cycles terminate. */\nasync function collectCssFiles(\n directory: string,\n visited: Set<string> = new Set(),\n): Promise<string[]> {\n const identity = await realpath(directory).catch(() => directory)\n if (visited.has(identity)) {\n return []\n }\n visited.add(identity)\n\n const entries = await readdir(directory, { withFileTypes: true }).catch(() => [])\n const files: string[] = []\n\n await Promise.all(\n entries.map(async (entry) => {\n const entryPath = path.join(directory, entry.name)\n // A Dirent describes the link itself, so a symlink is neither a file nor a directory until its target is checked; broken links are skipped.\n const target = entry.isSymbolicLink() ? await stat(entryPath).catch(() => null) : entry\n if (target?.isDirectory()) {\n if (entry.name.startsWith('.') || IGNORED_DIRECTORY_NAMES.has(entry.name)) {\n return\n }\n files.push(...(await collectCssFiles(entryPath, visited)))\n } else if (target?.isFile() && CSS_EXTENSIONS.has(path.extname(entry.name))) {\n files.push(entryPath)\n }\n }),\n )\n\n return files\n}\n","import { createHash } from 'node:crypto'\nimport { readFile, stat } from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {\n type EncodingMode,\n type GenerateResult,\n type PruneReport,\n type SourceScanner,\n type TailwindIntegration,\n type UsageScan,\n createSourceScanner,\n generate,\n} from '@tailwind-merge/configurator'\n\n/** A generated runtime module ready to serve in place of a plugin's runtime subpath. */\nexport interface GeneratedRuntimeModule {\n /** JavaScript source of the module: the configurator's emitted module (in its `format: 'js'` shape, since a plugin serves the code as-is without a transform of its own) plus the runtime appendix. */\n code: string\n /** sha-256 of `code` — the change gate: regenerations that produce identical output must not invalidate or reload anything. */\n hash: string\n /** The configurator's result behind `code`, retained so a usage change can re-prune the same classification instead of regenerating. */\n result: GenerateResult\n /** Absolute paths of every file the generation read: the entrypoint, `@import`ed stylesheets, and `@config`/`@plugin` modules. Watching these is what triggers regeneration. */\n dependencies: Set<string>\n /** Modification times of the dependencies as generation read them, so a later refresh can tell whether the CSS graph changed without re-reading it. */\n dependencyMtimes: Map<string, number | null>\n /** The entrypoint the module was generated from, kept for regeneration. */\n cssPath: string\n /** The specifier the module imports tailwind-merge's API from, kept because re-pruning re-assembles the module. */\n importSource: string\n /** Present when the module was pruned to the classes found in the project's sources. */\n pruning?: PruningState\n /** Set when pruning was requested but the sources could not be scanned — the module then holds the full config, and the caller decides how loudly to say so. */\n pruningError?: Error\n}\n\n/** What a pruned module was pruned with: the scanner for cheap re-scans, and the scan's fingerprint to tell real usage changes from noise. */\nexport interface PruningState {\n report: PruneReport\n scanner: SourceScanner\n /** Hash over the sorted class names the scan found — usage changes that matter to the config change this; edits to non-class content don't. */\n classesHash: string\n /** Files the scan read and glob entries it covers, for build-time watching. */\n files: string[]\n globs: { base: string; pattern: string }[]\n}\n\nexport interface GenerateRuntimeModuleOptions {\n cssPath: string\n /** The project directory, used to print the entrypoint's path in the module's banner. */\n root: string\n /** The plugin generating the module, named in its banner so readers of the served code can tell where it came from. */\n packageName: string\n /** Module specifier the generated module and its runtime appendix import tailwind-merge's API from. A virtual module has no filesystem location, so it needs a specifier resolvable from anywhere (the Vite plugin's own re-export subpath); a module served in place of a real file inside the plugin package can import `tailwind-merge` directly. */\n importSource: string\n cacheSize?: number\n encoding?: EncodingMode\n integration?: TailwindIntegration\n /** Prune the config to the classes found in the project's sources. `autoDetectBases` is where Tailwind's automatic source detection starts (the CSS's `source(…)`, when set, wins). Omit the option for the full config. */\n prune?: { autoDetectBases: string[] }\n}\n\n/**\n * Generates the runtime module from the project's Tailwind CSS entrypoint.\n *\n * Always supplies dependency hooks to the configurator's loaders, even without custom resolution. The same load that generates the config therefore discovers its dependencies; a separate compile for watching is unnecessary. Each dependency's modification time is taken when it is reported, as it is read: taken after generation, an edit landing mid-generation would be recorded as the baseline and a later refresh would keep the stale module.\n *\n * The source scan runs alongside generation rather than before it — its compile of the CSS graph and the source walk only have to finish before pruning, which runs last. A failing scan (no oxide binary for the platform, sources Tailwind can't resolve) never fails the generation: the module is generated with the full config and `pruningError` carries the reason — pruning is an optimization, and falling back preserves the full generated config's behavior.\n */\nexport async function generateRuntimeModule(\n options: GenerateRuntimeModuleOptions,\n): Promise<GeneratedRuntimeModule> {\n const dependencies = new Set<string>()\n const dependencyMtimes = new Map<string, Promise<number | null>>()\n const recordDependency = (file: string) => {\n dependencies.add(file)\n if (!dependencyMtimes.has(file)) {\n dependencyMtimes.set(file, readMtime(file))\n }\n }\n recordDependency(options.cssPath)\n const css = await readFile(options.cssPath, 'utf-8')\n const base = path.dirname(options.cssPath)\n const integration: TailwindIntegration = {\n ...options.integration,\n onDependency(file: string) {\n recordDependency(file)\n options.integration?.onDependency?.(file)\n },\n }\n\n let pruningError: Error | undefined\n const scanning: Promise<{ scanner: SourceScanner; scan: UsageScan } | null> = options.prune\n ? createSourceScanner({\n css,\n base,\n autoDetectBases: options.prune.autoDetectBases,\n integration,\n })\n .then((scanner) => ({ scanner, scan: scanner.scan() }))\n .catch((error: unknown) => {\n pruningError = error instanceof Error ? error : new Error(String(error))\n return null\n })\n : Promise.resolve(null)\n\n const sourceLine = `// Source: ${path.relative(options.root, options.cssPath) || options.cssPath} (served in-memory by ${options.packageName})`\n const result = await generate({\n css,\n base,\n integration,\n cacheSize: options.cacheSize,\n encoding: options.encoding,\n format: 'js',\n importSource: options.importSource,\n banner: scanning.then((scanned) =>\n [sourceLine, ...(scanned ? [PRUNED_LINE] : [])].join('\\n'),\n ),\n prune: options.prune\n ? { usedClasses: scanning.then((scanned) => scanned?.scan.classes ?? null) }\n : undefined,\n })\n const scanned = await scanning\n for (const file of scanned?.scanner.dependencies ?? []) {\n recordDependency(file)\n }\n\n return {\n ...assembleModule(result, options.importSource),\n dependencies,\n dependencyMtimes: new Map(\n await Promise.all(\n [...dependencyMtimes].map(async ([file, mtime]) => [file, await mtime] as const),\n ),\n ),\n cssPath: options.cssPath,\n importSource: options.importSource,\n pruning:\n scanned && result.plan.report.pruning\n ? pruningState(scanned.scanner, scanned.scan, result.plan.report.pruning)\n : undefined,\n pruningError,\n }\n}\n\n/**\n * Re-prunes a module for a fresh scan of the same, unchanged CSS graph — a plugin's reaction to a source edit that changed the used classes. Pruning and emission run on the retained classification; nothing is loaded or classified again, and the dependency graph and its modification times carry over.\n */\nexport function pruneRuntimeModule(\n generated: GeneratedRuntimeModule,\n pruning: PruningState,\n scan: UsageScan,\n): GeneratedRuntimeModule {\n const result = generated.result.prune(scan.classes)\n return {\n ...generated,\n ...assembleModule(result, generated.importSource),\n // A pruned result always carries the pruning report.\n pruning: pruningState(pruning.scanner, scan, result.plan.report.pruning!),\n }\n}\n\nfunction assembleModule(\n result: GenerateResult,\n importSource: string,\n): Pick<GeneratedRuntimeModule, 'code' | 'hash' | 'result'> {\n const code = result.code + runtimeAppendix(importSource)\n return { code, hash: createHash('sha256').update(code).digest('hex'), result }\n}\n\nfunction pruningState(scanner: SourceScanner, scan: UsageScan, report: PruneReport): PruningState {\n return {\n report,\n scanner,\n classesHash: hashClasses(scan.classes),\n files: scan.files,\n globs: scan.globs,\n }\n}\n\nconst PRUNED_LINE = \"// Pruned to the classes found in the project's sources\"\n\n/** Order-independent fingerprint of a scan's class names. */\nexport function hashClasses(classes: readonly string[]): string {\n return createHash('sha256')\n .update([...classes].sort().join('\\n'))\n .digest('hex')\n}\n\n/** Whether any dependency's modification time differs from the recorded one — deleted files count as changed. */\nexport async function dependenciesChanged(generated: GeneratedRuntimeModule): Promise<boolean> {\n const current = await readMtimes(generated.dependencies)\n for (const [file, mtime] of generated.dependencyMtimes) {\n if (current.get(file) !== mtime) {\n return true\n }\n }\n return false\n}\n\nasync function readMtimes(files: Iterable<string>): Promise<Map<string, number | null>> {\n const mtimes = new Map<string, number | null>()\n await Promise.all(\n [...files].map(async (file) => {\n mtimes.set(file, await readMtime(file))\n }),\n )\n return mtimes\n}\n\n/** A missing file reads as null, which differs from any real modification time. */\nfunction readMtime(file: string): Promise<number | null> {\n return stat(file).then(\n (stats) => stats.mtimeMs,\n () => null,\n )\n}\n\n/**\n * Appended to the configurator's emitted module (which exports `getConfig` and `twMerge` and already imports `createTailwindMerge`) so the served module's export surface mirrors each plugin's runtime fallback. Plain JavaScript on purpose — types live in the plugin's runtime file, which is what TypeScript resolves for the subpath.\n */\nfunction runtimeAppendix(importSource: string): string {\n return `\nexport { createTailwindMerge, mergeConfigs, twJoin, validators } from '${importSource}'\nimport { mergeConfigs as mergeConfigsForExtend } from '${importSource}'\n\n// Like tailwind-merge's extendTailwindMerge, but extending this project's generated config instead of the default one.\nexport const extendTailwindMerge = (configExtension, ...createConfig) =>\n typeof configExtension === 'function'\n ? createTailwindMerge(getConfig, configExtension, ...createConfig)\n : createTailwindMerge(() => mergeConfigsForExtend(getConfig(), configExtension), ...createConfig)\n`\n}\n\n/**\n * Served for the runtime subpath when generation has never succeeded (the CSS is broken from the start, or a `@plugin` package is missing): the same default-config surface as a plugin's runtime fallback file. Once a generation has succeeded, later failures keep serving the last good module instead.\n */\nexport function fallbackModuleCode(importSource: string): string {\n return `\nexport { createTailwindMerge, extendTailwindMerge, getDefaultConfig as getConfig, mergeConfigs, twJoin, twMerge, validators } from '${importSource}'\n`\n}\n","import { type UsageScan } from '@tailwind-merge/configurator'\nimport { clearRequireCache } from '@tailwindcss/node/require-cache'\n\nimport {\n type GeneratedRuntimeModule,\n type GenerateRuntimeModuleOptions,\n type PruningState,\n dependenciesChanged,\n generateRuntimeModule,\n hashClasses,\n pruneRuntimeModule,\n} from './generation.ts'\n\nexport interface GenerationSessionOptions extends Omit<GenerateRuntimeModuleOptions, 'cssPath'> {\n /** Resolves to the discovered (or configured) CSS entrypoint, null when the project has none; rejects on ambiguity. */\n cssRoot: Promise<string | null>\n onGenerated: (generated: GeneratedRuntimeModule) => void\n /** A dev server logs the error and retains the last good module; builds throw to reject the attempt. Discovery errors always propagate. */\n onError: (error: unknown, current: GeneratedRuntimeModule | null) => void\n}\n\nexport type GenerationSession = ReturnType<typeof createGenerationSession>\n\n/** Owns generation for one resolved plugin configuration. Failed attempts retain their dependency discoveries alongside the last good graph; only a success replaces serving state and dependencies. Dev updates, watch builds, and bundler loader re-runs all go through this lifecycle. */\nexport function createGenerationSession(options: GenerationSessionOptions) {\n const { cssRoot, onGenerated, onError, ...generationOptions } = options\n let current: GeneratedRuntimeModule | null = null\n let dependencies = new Set<string>()\n let generation = run()\n\n return {\n get current() {\n return current\n },\n get dependencies(): ReadonlySet<string> {\n return dependencies\n },\n get generation() {\n return generation\n },\n\n /** Schedule after the previous attempt, including a rejection. */\n regenerate() {\n generation = generation.catch(() => null).then(() => run())\n return generation\n },\n\n /** Source-only changes re-prune the current module for the caller's fresh scan — no loading, no classification — behind any running attempt, like a regeneration. Without a pruned module there is nothing to re-prune. */\n reprune(scan: UsageScan) {\n generation = generation\n .catch(() => null)\n .then(() => {\n if (current?.pruning) {\n reprune(current, current.pruning, scan)\n }\n return current\n })\n return generation\n },\n\n /** Reuses an unchanged success but always retries a failure, even before the first successful generation. A module holding the full config because its source scan failed is retried too, so pruning returns (and the warning repeats) once the cause is gone rather than after the next CSS edit. */\n refresh() {\n generation = generation\n .catch(() => null)\n .then(async (previous) => {\n if (\n !previous ||\n previous.pruningError ||\n (await dependenciesChanged(previous))\n ) {\n return run()\n }\n if (previous.pruning) {\n const scan = previous.pruning.scanner.scan()\n if (hashClasses(scan.classes) !== previous.pruning.classesHash) {\n reprune(previous, previous.pruning, scan)\n }\n }\n return current\n })\n return generation\n },\n\n /** Programmatic restarts may reuse the plugin object. Drain its old attempt before clearing cached modules and replacing this session. */\n async dispose() {\n await generation.catch(() => {})\n clearRequireCache([...dependencies])\n },\n }\n\n async function run(): Promise<GeneratedRuntimeModule | null> {\n const cssPath = await cssRoot\n if (cssPath === null) {\n return null\n }\n try {\n // Tailwind refreshes ESM itself; CommonJS modules and parents holding their exports need invalidation before either scanning or design-system loading.\n clearRequireCache([...dependencies])\n trackDependency(cssPath)\n const generated = await generateRuntimeModule({\n ...generationOptions,\n cssPath,\n integration: { ...generationOptions.integration, onDependency: trackDependency },\n })\n current = generated\n dependencies = new Set(generated.dependencies)\n onGenerated(generated)\n } catch (error) {\n onError(error, current)\n }\n return current\n }\n\n function reprune(generated: GeneratedRuntimeModule, pruning: PruningState, scan: UsageScan) {\n current = pruneRuntimeModule(generated, pruning, scan)\n onGenerated(current)\n }\n\n /** Observe files, missing targets, and recovery directories before an attempt can fail. The caller registers its watcher immediately or drains the accumulated set when the watcher starts. */\n function trackDependency(file: string) {\n if (!dependencies.has(file)) {\n dependencies.add(file)\n generationOptions.integration?.onDependency?.(file)\n }\n }\n}\n","import { statSync } from 'node:fs'\nimport path from 'node:path'\n\nimport {\n type GeneratedRuntimeModule,\n type GenerationSession,\n createGenerationSession,\n discoverCssRoot,\n fallbackModuleCode,\n} from '@tailwind-merge/plugin-core'\n\nimport { type LoaderOptions } from './options'\n\n/** The slice of the webpack loader API this loader uses. Turbopack's loader runner provides the same members (verified against Next.js 16.3, where `addMissingDependency` is accepted but not acted on — the recovery directories the plugin core reports cover that case as context dependencies). */\nexport interface LoaderContext {\n /** The Next.js project directory. */\n rootContext: string\n resourcePath: string\n getOptions(): LoaderOptions\n addDependency(file: string): void\n addContextDependency(directory: string): void\n addMissingDependency(file: string): void\n}\n\n/**\n * Replaces the content of this package's runtime module with the module generated from the project's Tailwind CSS. Registered by `withTailwindMerge` (src/index.ts) with both Turbopack and webpack; runs once per compilation environment (server components, server rendering, browser), which the per-process project state below turns into one generation.\n *\n * Every run registers the CSS configuration graph — entrypoint, imported stylesheets, `@config`/`@plugin` modules, and the directories a missing import would appear in — as dependencies, so the bundler re-runs the loader when any of them changes and `refresh()` decides whether that change regenerates the module. A regeneration with identical output changes nothing downstream: both bundlers hash module content. With pruning active (builds, or dev with `prune.dev`), the scanned source directories are context dependencies too, so a class-usage change re-prunes the retained classification, and Turbopack's persistent cache cannot serve a module pruned for other sources.\n *\n * Failure policy mirrors the Vite plugin's: a build fails on a configuration-generation failure (the loader rejects, which fails the compilation), while the dev server logs the error and keeps serving the last good module — or the default fallback before the first success. A project without a Tailwind root warns once and serves the default fallback as well. A failed source scan is not a generation failure: the module holds the full config and the warning says so.\n */\nexport default async function tailwindMergeLoader(this: LoaderContext): Promise<string> {\n const options = this.getOptions()\n const project = projectState(this.rootContext, options)\n const generated = await project.next()\n registerDependencies(this, project, generated)\n // Without a Tailwind root (or before the first successful generation) the served module is the same default-config surface the file on disk provides, minus the file's marker comment, which would otherwise survive minification in the app bundle.\n return generated?.code ?? fallbackModuleCode(IMPORT_SOURCE)\n}\n\ninterface ProjectState {\n root: string\n session: GenerationSession\n /** The resolved entrypoint once discovery has finished: null when the project has none, undefined while unknown. */\n cssRoot: string | null | undefined\n /** Coalesces the compilation environments' concurrent runs into one generation or refresh. */\n inFlight: Promise<GeneratedRuntimeModule | null> | undefined\n started: boolean\n next(): Promise<GeneratedRuntimeModule | null>\n}\n\n/** One state per project and option set for the life of the loader process — Next.js runs webpack loaders in its own process and Turbopack loaders in a pool process it keeps alive across compilations, so the session's retained classification and dependency graph survive from one loader run to the next. */\nconst projects = new Map<string, ProjectState>()\n\nfunction projectState(root: string, options: LoaderOptions): ProjectState {\n const key = `${root}\\0${JSON.stringify(options)}`\n let state = projects.get(key)\n if (state) {\n return state\n }\n\n const cssRoot: Promise<string | null> =\n options.css !== undefined\n ? Promise.resolve(path.resolve(root, options.css))\n : discoverCssRoot(root, { packageName: PACKAGE_NAME }).then((found) => {\n if (found === null) {\n console.warn(\n `[${PACKAGE_NAME}] No Tailwind CSS root found — serving default tailwind-merge behavior. Set the \\`css\\` option to your Tailwind entrypoint if it uses another extension or is outside the scanned directories.`,\n )\n }\n return found\n })\n\n const session = createGenerationSession({\n cssRoot,\n root,\n packageName: PACKAGE_NAME,\n importSource: IMPORT_SOURCE,\n cacheSize: options.cacheSize,\n encoding: options.encoding,\n // Tailwind's PostCSS plugin, which Next.js runs, starts automatic source detection in the working directory — the project directory in any ordinary `next dev`/`next build`.\n prune: options.prune ? { autoDetectBases: [root] } : undefined,\n onGenerated: (generated) => reportPruning(generated, options),\n onError(error, current) {\n if (options.mode === 'build') {\n throw error\n }\n console.error(\n `[${PACKAGE_NAME}] Generating the tailwind-merge config failed${current ? ' — keeping the previous one' : ''}: ${error instanceof Error ? error.message : String(error)}`,\n )\n },\n })\n state = {\n root,\n session,\n cssRoot: undefined,\n inFlight: undefined,\n started: false,\n next() {\n if (!this.inFlight) {\n // The first run is the session's eager generation; every later loader run is a refresh, which reuses the module unless the CSS graph or the used classes changed. A rejection (a build's failure policy) propagates to every waiting run.\n const attempt = this.started ? this.session.refresh() : this.session.generation\n this.started = true\n this.inFlight = attempt.finally(() => {\n this.inFlight = undefined\n })\n }\n return this.inFlight\n },\n }\n void cssRoot.then(\n (found) => {\n state!.cssRoot = found\n },\n () => {},\n )\n projects.set(key, state)\n return state\n}\n\n/**\n * Hands the session's dependency graph to the bundler: files as file dependencies, directories (the recovery directories reported for missing imports, and a missing explicit entrypoint's nearest existing parent) as context dependencies, and nonexistent paths as missing dependencies for webpack, which acts on them. With pruning, the scanned source bases join as context dependencies.\n */\nfunction registerDependencies(\n context: LoaderContext,\n project: ProjectState,\n generated: GeneratedRuntimeModule | null,\n) {\n const dependencies = new Set(project.session.dependencies)\n if (project.cssRoot) {\n dependencies.add(project.cssRoot)\n }\n for (const dependency of dependencies) {\n const stats = statSync(dependency, { throwIfNoEntry: false })\n if (!stats) {\n context.addMissingDependency(dependency)\n if (dependency === project.cssRoot) {\n context.addContextDependency(nearestExistingDirectory(dependency))\n }\n } else if (stats.isDirectory()) {\n context.addContextDependency(dependency)\n } else {\n context.addDependency(dependency)\n }\n }\n for (const source of generated?.pruning?.scanner.sources ?? []) {\n if (!source.negated) {\n context.addContextDependency(source.base)\n }\n }\n}\n\nfunction nearestExistingDirectory(file: string): string {\n let directory = path.dirname(file)\n while (!statSync(directory, { throwIfNoEntry: false })?.isDirectory()) {\n const parent = path.dirname(directory)\n if (parent === directory) {\n break\n }\n directory = parent\n }\n return directory\n}\n\n/** One line per generation about pruning, so the behavior and its effect are visible where someone debugging a production-only merge difference would look; a failed scan is always reported, since the module then silently holds the full config. */\nfunction reportPruning(generated: GeneratedRuntimeModule, options: LoaderOptions) {\n if (generated.pruningError) {\n console.warn(\n `[${PACKAGE_NAME}] Could not scan your sources, serving the full tailwind-merge config instead: ${generated.pruningError.message}`,\n )\n } else if (generated.pruning && options.log) {\n const { classGroupsAfter, classGroupsBefore, classifiedClassCount } =\n generated.pruning.report\n console.log(\n `[${PACKAGE_NAME}] Pruned the tailwind-merge config to ${classGroupsAfter} of ${classGroupsBefore} class groups from the ${classifiedClassCount} classes found in your sources`,\n )\n }\n}\n\nconst PACKAGE_NAME = '@tailwind-merge/next'\n\n/** The generated module replaces a real file inside this package, so it can import tailwind-merge the ordinary way: resolution starts in the package's own directory, where its dependency is installed under any package manager. */\nconst IMPORT_SOURCE = 'tailwind-merge'\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,UAAiB,cAAc,KAAgC;CAC3D,IAAI,YAAY;CAChB,IAAI,QAAQ;CACZ,IAAI,aAAa;CACjB,KAAK,IAAI,QAAQ,GAAG,QAAQ,IAAI,QAAQ,SAAS;EAC7C,MAAM,YAAY,IAAI;EACtB,IAAI,cAAc,MAAM;GACpB,aAAa,IAAI,MAAM,OAAO,QAAQ,CAAC;GACvC,SAAS;GACT;EACJ;EACA,IAAI,OAAO;GACP,aAAa;GACb,IAAI,cAAc,OACd,QAAQ;GAEZ;EACJ;EACA,IAAI,cAAc,OAAO,IAAI,QAAQ,OAAO,KAAK;GAC7C,MAAM,MAAM,IAAI,QAAQ,MAAM,QAAQ,CAAC;GACvC,QAAQ,QAAQ,KAAK,IAAI,SAAS,MAAM;GACxC,aAAa;GACb;EACJ;EACA,IAAI,cAAc,QAAO,cAAc,KACnC,QAAQ;OACL,IAAI,cAAc,KACrB,cAAc;OACX,IAAI,cAAc,KACrB,cAAc;OACX,IACH,eAAe,MACd,cAAc,OAAO,cAAc,OAAO,cAAc,MAC3D;GACE,IAAI,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