(files: RegistryFile[])
| 122 | } |
| 123 | |
| 124 | function fixFilePaths(files: RegistryFile[]) { |
| 125 | if (!files) { |
| 126 | return []; |
| 127 | } |
| 128 | |
| 129 | // Resolve all paths relative to the first file's directory. |
| 130 | const firstFilePath = files[0]?.path; |
| 131 | if (!firstFilePath) { |
| 132 | return []; |
| 133 | } |
| 134 | const firstFilePathDir = path.dirname(firstFilePath); |
| 135 | |
| 136 | return files.map((file) => { |
| 137 | return { |
| 138 | ...file, |
| 139 | path: path.relative(firstFilePathDir, file.path), |
| 140 | target: getFileTarget(file), |
| 141 | }; |
| 142 | }); |
| 143 | } |
| 144 | |
| 145 | export function fixImport(content: string) { |
| 146 | const regex = /@\/(.+?)\/((?:.*?\/)?(?:components|ui|hooks|lib))\/([\w-]+)/g; |
no test coverage detected