UNPKG

4.04 kBSource Map (JSON)View Raw
1{"version":3,"file":"directory.js","sourceRoot":"","sources":["../../../../src/lib/models/sources/directory.ts"],"names":[],"mappings":";;AAWA,MAAa,eAAe;IAuCxB,YAAY,IAAa,EAAE,MAAwB;QA9BnD,gBAAW,GAAsC,EAAE,CAAC;QAOpD,UAAK,GAAiB,EAAE,CAAC;QAwBrB,IAAI,IAAI,IAAI,MAAM,EAAE;YAChB,IAAI,CAAC,IAAI,GAAM,IAAI,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;YACnE,IAAI,CAAC,MAAM,GAAI,MAAM,CAAC;SACzB;IACL,CAAC;IAQD,QAAQ,CAAC,SAAiB,EAAE;QACxB,IAAI,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;QAE7B,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,WAAW,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;gBACvC,SAAS;aACZ;YACD,GAAG,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACxB,GAAG,IAAI,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACf,CAAC;IAQD,iBAAiB;QACb,MAAM,WAAW,GAAiB,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACxB,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QAGH,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ;AArFD,0CAqFC","sourcesContent":["import { Reflection } from '../reflections/abstract';\nimport { ReflectionGroup } from '../ReflectionGroup';\nimport { SourceFile } from './file';\n\n/**\n * Exposes information about a directory containing source files.\n *\n * One my access the root directory of a project through the [[ProjectReflection.directory]]\n * property. Traverse through directories by utilizing the [[SourceDirectory.parent]] or\n * [[SourceDirectory.directories]] properties.\n */\nexport class SourceDirectory {\n /**\n * The parent directory or undefined if this is a root directory.\n */\n parent?: SourceDirectory;\n\n /**\n * A list of all subdirectories.\n */\n directories: {[name: string]: SourceDirectory} = {};\n\n groups?: ReflectionGroup[];\n\n /**\n * A list of all files in this directory.\n */\n files: SourceFile[] = [];\n\n /**\n * The name of this directory.\n */\n name?: string;\n\n /**\n * The relative path from the root directory to this directory.\n */\n dirName?: string;\n\n /**\n * The url of the page displaying the directory contents.\n */\n url?: string;\n\n /**\n * Create a new SourceDirectory instance.\n *\n * @param name The new of directory.\n * @param parent The parent directory instance.\n */\n constructor(name?: string, parent?: SourceDirectory) {\n if (name && parent) {\n this.name = name;\n this.dirName = (parent.dirName ? parent.dirName + '/' : '') + name;\n this.parent = parent;\n }\n }\n\n /**\n * Return a string describing this directory and its contents.\n *\n * @param indent Used internally for indention.\n * @returns A string representing this directory and all of its children.\n */\n toString(indent: string = '') {\n let res = indent + this.name;\n\n for (let key in this.directories) {\n if (!this.directories.hasOwnProperty(key)) {\n continue;\n }\n res += '\\n' + this.directories[key].toString(indent + ' ');\n }\n\n this.files.forEach((file) => {\n res += '\\n' + indent + ' ' + file.fileName;\n });\n\n return res;\n }\n\n /**\n * Return a list of all reflections exposed by the files within this directory.\n *\n * @returns An aggregated list of all [[DeclarationReflection]] defined in the\n * files of this directory.\n */\n getAllReflections(): Reflection[] {\n const reflections: Reflection[] = [];\n this.files.forEach((file) => {\n reflections.push.apply(reflections, file.reflections);\n });\n\n // reflections.sort(Factories.GroupHandler.sortCallback);\n return reflections;\n }\n}\n"]}
\No newline at end of file