(files: string[])
| 34 | } |
| 35 | |
| 36 | export async function findPluginClasses(files: string[]): Promise<string[]> { |
| 37 | const classList: string[] = []; |
| 38 | |
| 39 | for (const file of files) { |
| 40 | const fileData = readFileSync(file, 'utf-8'); |
| 41 | const swiftPluginRegex = RegExp(/@objc\(([A-Za-z0-9_-]+)\)/); |
| 42 | const objcPluginRegex = RegExp(/CAP_PLUGIN\(([A-Za-z0-9_-]+)/); |
| 43 | |
| 44 | const swiftMatches = swiftPluginRegex.exec(fileData); |
| 45 | if (swiftMatches?.[1] && !classList.includes(swiftMatches[1])) { |
| 46 | classList.push(swiftMatches[1]); |
| 47 | } |
| 48 | |
| 49 | const objcMatches = objcPluginRegex.exec(fileData); |
| 50 | if (objcMatches?.[1] && !classList.includes(objcMatches[1])) { |
| 51 | classList.push(objcMatches[1]); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | return classList; |
| 56 | } |
| 57 | |
| 58 | export async function writePluginJSON(config: Config, classList: string[]): Promise<void> { |
| 59 | const capJSONFile = resolve(config.ios.nativeTargetDirAbs, 'capacitor.config.json'); |
no outgoing calls
no test coverage detected