import * as fsExtra from "fs-extra" ; import * as path from "path" ; import { PluginRegistration , RuntimeAdapter } from "@codotype/core" ; import { MODULES_ROOT } from "../constants" ; param generatorModulePath param parentRuntimeAdapter param activePlugin export function getComposeWithModulePath ( generatorModulePath , parentRuntimeAdapter , activePlugin ) { if ( generatorModulePath . startsWith ( "./" ) || generatorModulePath . startsWith ( "../" ) ) { let baseModulePath = path . dirname ( parentRuntimeAdapter . props . generatorResolvedPath ) ; const stats = fsExtra . statSync ( parentRuntimeAdapter . props . generatorResolvedPath ) ; if ( stats . isDirectory ( ) ) { baseModulePath = parentRuntimeAdapter . props . generatorResolvedPath ; } return path . join ( baseModulePath , generatorModulePath ) ; } if ( generatorModulePath . startsWith ( "/" ) ) { return path . join ( generatorModulePath ) ; } return path . join ( activePlugin . pluginDynamicImportPath , MODULES_ROOT , generatorModulePath ) ; }