import * as L from "lodash"; const files = ` 109 CLI/CLIClass.ts 67 CLI/index.ts 3 index.ts 45 Models/DisplayMap.ts 1 Models/Environment.ts 6 Models/index.ts 5 Models/Options.ts 22 Models/ParserTree.ts 93 Models/Spec.ts 35 Models/Types.ts 36 plugins/apollo/index.spec.ts 59 plugins/apollo/index.ts 35 plugins/react-query/index.spec.ts 56 plugins/react-query/index.ts 26 plugins/stuccoSubscriptions/index.spec.ts 56 plugins/stuccoSubscriptions/index.ts 51 plugins/typed-document-node/index.spec.ts 42 plugins/typed-document-node/index.ts 1 __tests__/TestUtils.ts 37 __tests__/TreeToJSONSchema/TreeToJSONSchema.spec.ts 17 __tests__/TreeToTS/Chain.spec.ts 22 __tests__/TreeToTS/EsModule.spec.ts 16 __tests__/TreeToTS/Extend.spec.ts 104 __tests__/TreeToTS/Field.spec.ts 71 __tests__/TreeToTS/Interface.spec.ts 17 __tests__/TreeToTS/Selectors.spec.ts 24 __tests__/TreeToTS/Thunder.spec.ts 54 __tests__/TreeToTS/TypeDefinitions.spec.ts 38 TranslateGraphQL/index.ts 122 TreeToJSONSchema/index.ts 8 TreeToTS/functions/buildQuery.ts 13 TreeToTS/functions/fullChainConstruct.ts 11 TreeToTS/functions/fullSubscriptionConstruct.ts 16 TreeToTS/functions/index.ts 29 TreeToTS/functions/inspectVariables.ts 52 TreeToTS/functions/isArrayFunction.ts 3 TreeToTS/functions/models.ts 8 TreeToTS/functions/objectToTree.ts 8 TreeToTS/functions/queryConstruct.ts 8 TreeToTS/functions/resolveKV.ts 19 TreeToTS/functions/resolverFor.ts 26 TreeToTS/functions/ScalarResolver.ts 34 TreeToTS/functions/seekForAliases.ts 38 TreeToTS/functions/traverseToSeekArrays.ts 70 TreeToTS/functions/TypesPropsResolver.ts 7 TreeToTS/functions/variable.ts 5 TreeToTS/functions/ZeusSelect.ts 142 TreeToTS/index.ts 116 TreeToTS/templates/resolveValueTypes.ts 89 TreeToTS/templates/returnedModelTypes.ts 43 TreeToTS/templates/returnedPropTypes.ts 36 TreeToTS/templates/returnedReturns.ts 114 TreeToTS/templates/returnedTypes.ts 1 TreeToTS/templates/truthy.ts 39 TreeToTS/templates/typescript/browser/apiSubscription.ts 47 TreeToTS/templates/typescript/browser/fetchFunction.ts 1 TreeToTS/templates/typescript/browser/fetchImport.ts 1 TreeToTS/templates/typescript/browser/websocketsImport.ts 11 TreeToTS/templates/typescript/error.ts 38 TreeToTS/templates/typescript/functions.ts 7 TreeToTS/templates/typescript/indexImports.ts 4 TreeToTS/templates/typescript/index.ts 40 TreeToTS/templates/typescript/node/apiSubscription.ts 56 TreeToTS/templates/typescript/node/fetchFunction.ts 1 TreeToTS/templates/typescript/node/fetchImport.ts 1 TreeToTS/templates/typescript/node/websocketsImport.ts 83 TreeToTS/templates/typescript/operations.ts 95 TreeToTS/templates/typescript/types.ts 64 Utils/index.ts `; const sizePathPairs = files .split("\n") .filter((line) => line.trim().length > 0) .map((line) => line.trim().split(" ") as [string, string]) .map(([size, path]) => ({ size: Number(size), path })); export type Tree = { name: string; path: string; value: number; children: Tree[]; }; const groupList = ( pairs: Array<{ size: number; path: string }>, parentPath: string[] = [""] ): Tree[] => { const groups = L.groupBy(pairs, ({ path }) => path.split("/")[0]); return L.map(groups, (g, k) => ({ name: k, path: parentPath.concat([k]).join("/"), value: g.length === 1 ? g[0].size : 0, // value: L.sumBy(g, "size"), children: g.length > 1 ? groupList( g.map((child) => ({ path: child.path.substring(child.path.indexOf("/") + 1), size: child.size, })), parentPath.concat([k]) ) : [], })); }; const subtrees = groupList(sizePathPairs); export const tree: Tree = { name: "/", path: "/", value: L.sumBy(subtrees, "size"), children: subtrees, };