( modulePath: ((className: string, tagName: string) => string) | undefined, component: Component, outdir: string, packageJson: any, )
| 10 | } |
| 11 | |
| 12 | export function getModulePath( |
| 13 | modulePath: ((className: string, tagName: string) => string) | undefined, |
| 14 | component: Component, |
| 15 | outdir: string, |
| 16 | packageJson: any, |
| 17 | ) { |
| 18 | if (modulePath instanceof Function) { |
| 19 | return modulePath(component.name, component.tagName!); |
| 20 | } |
| 21 | |
| 22 | if (!packageJson.module) { |
| 23 | throw new Error( |
| 24 | "You must define a module path in order to generate React wrappers.", |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | const directories = outdir?.split("/"); |
| 29 | return path.join(directories.map(() => "../").join(""), packageJson.module); |
| 30 | } |
| 31 | |
| 32 | export const createEventName = (event: any) => `on${toPascalCase(event.name)}`; |
| 33 |
no outgoing calls
no test coverage detected