( component: z.infer<typeof registryIndexSchema>[number], config: Config )
| 169 | }) |
| 170 | |
| 171 | async function diffComponent( |
| 172 | component: z.infer<typeof registryIndexSchema>[number], |
| 173 | config: Config |
| 174 | ) { |
| 175 | const payload = await fetchTree(config.style, [component]) |
| 176 | const baseColor = await getRegistryBaseColor(config.tailwind.baseColor) |
| 177 | const supportedFontMarkers = getSupportedFontMarkers(payload) |
| 178 | |
| 179 | if (!payload) { |
| 180 | return [] |
| 181 | } |
| 182 | |
| 183 | const changes = [] |
| 184 | |
| 185 | for (const item of payload) { |
| 186 | const targetDir = await getItemTargetPath(config, item) |
| 187 | |
| 188 | if (!targetDir) { |
| 189 | continue |
| 190 | } |
| 191 | |
| 192 | for (const file of item.files ?? []) { |
| 193 | const filePath = path.resolve( |
| 194 | targetDir, |
| 195 | typeof file === "string" ? file : file.path |
| 196 | ) |
| 197 | |
| 198 | if (!existsSync(filePath)) { |
| 199 | continue |
| 200 | } |
| 201 | |
| 202 | const fileContent = await fs.readFile(filePath, "utf8") |
| 203 | |
| 204 | if (typeof file === "string" || !file.content) { |
| 205 | continue |
| 206 | } |
| 207 | |
| 208 | const registryContent = await transform( |
| 209 | { |
| 210 | filename: file.path, |
| 211 | raw: file.content, |
| 212 | config, |
| 213 | baseColor, |
| 214 | supportedFontMarkers, |
| 215 | }, |
| 216 | [ |
| 217 | transformImport, |
| 218 | transformRsc, |
| 219 | transformCssVars, |
| 220 | transformTwPrefixes, |
| 221 | transformIcons, |
| 222 | transformMenu, |
| 223 | transformRtl, |
| 224 | transformFont, |
| 225 | transformCleanup, |
| 226 | ] |
| 227 | ) |
| 228 |
no test coverage detected