import { join, dirname } from 'node:path'; import tsUtils from '@strapi/typescript-utils'; /** * Detect whether generated files should use TypeScript or JavaScript templates. * * For plugin generation, the check is scoped to the plugin server directory derived * from the generator output path. For everything else, it checks the `dir` option * passed to `generate()` (via `getDestBasePath()`). */ const getGeneratorLanguage = ({ plugin, filePath }, plop)=>{ if (plugin) { const resolvedFilePath = filePath.replace('{{ plugin }}', plugin); const pluginServerDir = join(plop.getDestBasePath(), resolvedFilePath, '..'); return tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js'; } return tsUtils.isUsingTypeScriptSync(dirname(plop.getDestBasePath())) ? 'ts' : 'js'; }; export { getGeneratorLanguage as default }; //# sourceMappingURL=get-generator-language.mjs.map