UNPKG

@ts-intl/dependency

Version:

I18n keys dependency analysis

27 lines (26 loc) 945 B
export const offsprings = (id, graph, visit = {}) => { const res = []; (graph[id] || []).forEach((dep) => { if (visit[dep]) return; visit[dep] = true; res.push(dep); res.push(...offsprings(dep, graph, visit)); }); return res; }; export const mergeMadgeConfig = (config) => { const tsConfig = typeof config.tsConfig === 'object' ? JSON.parse(JSON.stringify(config.tsConfig)) : {}; tsConfig.compilerOptions = Object.assign(Object.assign({}, tsConfig.compilerOptions), { moduleResolution: 'Node', esModuleInterop: true, baseUrl: config.baseDir }); return Object.assign(Object.assign({ fileExtensions: ['.ts', '.tsx'], detectiveOptions: { noTypeDefinitions: true, ts: { skipTypeImports: true, // mixedImports: true, }, } }, config), { // high priority tsConfig }); };