aboutsummaryrefslogtreecommitdiff
path: root/node_modules/typedoc/dist/lib/application.js.map
blob: 96b937bd8f8fbeb4859e106de3250d8a1f6d6bc2 (plain)
1
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/lib/application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAQA,2BAA6B;AAC7B,uBAAyB;AACzB,uCAAyC;AACzC,uCAAgD;AAEhD,2CAA4C;AAC5C,8CAA2C;AAC3C,wCAAiD;AACjD,uCAA2F;AAE3F,+CAA2F;AAC3F,+CAAkF;AAClF,2DAA0D;AAiB1D,IAAa,WAAW;IAAS,+BAA+D;IAoD5F,qBAAY,OAAgB;QAA5B,YACI,kBAAM,IAAI,CAAC,SASd;QAPG,KAAI,CAAC,MAAM,GAAM,IAAI,qBAAa,EAAE,CAAC;QACrC,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,YAAY,CAAC,WAAW,EAAE,iBAAS,CAAC,CAAC;QAC3D,KAAI,CAAC,QAAQ,GAAI,KAAI,CAAC,YAAY,CAAC,UAAU,EAAE,mBAAQ,CAAC,CAAC;QACzD,KAAI,CAAC,OAAO,GAAK,KAAI,CAAC,YAAY,CAAC,SAAS,EAAE,kBAAU,CAAC,CAAC;QAC1D,KAAI,CAAC,OAAO,GAAK,KAAI,CAAC,YAAY,CAAC,SAAS,EAAE,eAAO,CAAC,CAAC;QAEvD,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;;IAC5B,CAAC;IAOS,+BAAS,GAAnB,UAAoB,OAAgB;QAChC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,uBAAe,CAAC,QAAQ,CAAC,CAAC;QAErD,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;QAC/B,EAAE,CAAC,CAAC,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,sBAAc,CAAO,MAAM,CAAC,CAAC;QACnD,CAAC;QA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,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,4DAA4D;QAClE,IAAI,EAAE,2BAAa,CAAC,MAAM;KAC7B,CAAC;4CACc;AAxCP,WAAW;IADvB,qBAAS,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;GACpC,WAAW,CAsPvB;AAtPY,kCAAW","sourcesContent":["/**\n * The TypeDoc main module and namespace.\n *\n * The [[Application]] class holds the core logic of the cli application. All code related\n * to resolving reflections is stored in [[TypeDoc.Factories]], the actual data models can be found\n * in [[TypeDoc.Models]] and the final rendering is defined in [[TypeDoc.Output]].\n */\n\nimport * as Path from 'path';\nimport * as FS from 'fs';\nimport * as typescript from 'typescript';\nimport {Minimatch, IMinimatch} from 'minimatch';\n\nimport {Converter} from './converter/index';\nimport {Renderer} from './output/renderer';\nimport {ProjectReflection} from './models/index';\nimport {Logger, ConsoleLogger, CallbackLogger, PluginHost, writeFile} from './utils/index';\n\nimport {AbstractComponent, ChildableComponent, Component, Option} from './utils/component';\nimport {Options, OptionsReadMode, OptionsReadResult} from './utils/options/index';\nimport {ParameterType} from './utils/options/declaration';\n\n/**\n * The default TypeDoc main application class.\n *\n * This class holds the two main components of TypeDoc, the [[Dispatcher]] and\n * the [[Renderer]]. When running TypeDoc, first the [[Dispatcher]] is invoked which\n * generates a [[ProjectReflection]] from the passed in source files. The\n * [[ProjectReflection]] is a hierarchical model representation of the TypeScript\n * project. Afterwards the model is passed to the [[Renderer]] which uses an instance\n * of [[BaseTheme]] to generate the final documentation.\n *\n * Both the [[Dispatcher]] and the [[Renderer]] are subclasses of the [[EventDispatcher]]\n * and emit a series of events while processing the project. Subscribe to these Events\n * to control the application flow or alter the output.\n */\n@Component({name: 'application', internal: true})\nexport class Application extends ChildableComponent<Application, AbstractComponent<Application>> {\n    options: Options;\n\n    /**\n     * The converter used to create the declaration reflections.\n     */\n    converter: Converter;\n\n    /**\n     * The renderer used to generate the documentation output.\n     */\n    renderer: Renderer;\n\n    /**\n     * The logger that should be used to output messages.\n     */\n    logger: Logger;\n\n    plugins: PluginHost;\n\n    @Option({\n        name: 'logger',\n        help: 'Specify the logger that should be used, \\'none\\' or \\'console\\'',\n        defaultValue: 'console',\n        type: ParameterType.Mixed\n    })\n    loggerType: string|Function;\n\n    @Option({\n        name: 'ignoreCompilerErrors',\n        help: 'Should TypeDoc generate documentation pages even after the compiler has returned errors?',\n        type: ParameterType.Boolean\n    })\n    ignoreCompilerErrors: boolean;\n\n    @Option({\n        name: 'exclude',\n        help: 'Define a pattern for excluded files when specifying paths.',\n        type: ParameterType.String\n    })\n    exclude: string;\n\n    /**\n     * The version number of TypeDoc.\n     */\n    static VERSION = '{{ VERSION }}';\n\n    /**\n     * Create a new TypeDoc application instance.\n     *\n     * @param options An object containing the options that should be used.\n     */\n    constructor(options?: Object) {\n        super(null);\n\n        this.logger    = new ConsoleLogger();\n        this.converter = this.addComponent('converter', Converter);\n        this.renderer  = this.addComponent('renderer', Renderer);\n        this.plugins   = this.addComponent('plugins', PluginHost);\n        this.options   = this.addComponent('options', Options);\n\n        this.bootstrap(options);\n    }\n\n    /**\n     * Initialize TypeDoc with the given options object.\n     *\n     * @param options  The desired options to set.\n     */\n    protected bootstrap(options?: Object): OptionsReadResult {\n        this.options.read(options, OptionsReadMode.Prefetch);\n\n        const logger = this.loggerType;\n        if (typeof logger === 'function') {\n            this.logger = new CallbackLogger(<any> logger);\n        } else if (logger === 'none') {\n            this.logger = new Logger();\n        }\n\n        this.plugins.load();\n        return this.options.read(options, OptionsReadMode.Fetch);\n    }\n\n    /**\n     * Return the application / root component instance.\n     */\n    get application(): Application {\n        return this;\n    }\n\n    get isCLI(): boolean {\n        return false;\n    }\n\n    /**\n     * Return the path to the TypeScript compiler.\n     */\n    public getTypeScriptPath(): string {\n        return Path.dirname(require.resolve('typescript'));\n    }\n\n    public getTypeScriptVersion(): string {\n        const tsPath = this.getTypeScriptPath();\n        const json = JSON.parse(FS.readFileSync(Path.join(tsPath, '..', 'package.json'), 'utf8'));\n        return json.version;\n    }\n\n    /**\n     * Run the converter for the given set of files and return the generated reflections.\n     *\n     * @param src  A list of source that should be compiled and converted.\n     * @returns An instance of ProjectReflection on success, NULL otherwise.\n     */\n    public convert(src: string[]): ProjectReflection {\n        this.logger.writeln('Using TypeScript %s from %s', this.getTypeScriptVersion(), this.getTypeScriptPath());\n\n        const result = this.converter.convert(src);\n        if (result.errors && result.errors.length) {\n            this.logger.diagnostics(result.errors);\n            if (this.ignoreCompilerErrors) {\n                this.logger.resetErrors();\n                return result.project;\n            } else {\n                return null;\n            }\n        } else {\n            return result.project;\n        }\n    }\n\n    /**\n     * @param src  A list of source files whose documentation should be generated.\n     */\n    public generateDocs(src: string[], out: string): boolean;\n\n    /**\n     * @param project  The project the documentation should be generated for.\n     */\n    public generateDocs(project: ProjectReflection, out: string): boolean;\n\n    /**\n     * Run the documentation generator for the given set of files.\n     *\n     * @param out  The path the documentation should be written to.\n     * @returns TRUE if the documentation could be generated successfully, otherwise FALSE.\n     */\n    public generateDocs(input: any, out: string): boolean {\n        const project = input instanceof ProjectReflection ? input : this.convert(input);\n        if (!project) {\n            return false;\n        }\n\n        out = Path.resolve(out);\n        this.renderer.render(project, out);\n        if (this.logger.hasErrors()) {\n            this.logger.error('Documentation could not be generated due to the errors above.');\n        } else {\n            this.logger.success('Documentation generated at %s', out);\n        }\n\n        return true;\n    }\n\n    /**\n     * @param src  A list of source that should be compiled and converted.\n     */\n    public generateJson(src: string[], out: string): boolean;\n\n    /**\n     * @param project  The project that should be converted.\n     */\n    public generateJson(project: ProjectReflection, out: string): boolean;\n\n    /**\n     * Run the converter for the given set of files and write the reflections to a json file.\n     *\n     * @param out  The path and file name of the target file.\n     * @returns TRUE if the json file could be written successfully, otherwise FALSE.\n     */\n    public generateJson(input: any, out: string): boolean {\n        const project = input instanceof ProjectReflection ? input : this.convert(input);\n        if (!project) {\n            return false;\n        }\n\n        out = Path.resolve(out);\n        writeFile(out, JSON.stringify(project.toObject(), null, '\\t'), false);\n        this.logger.success('JSON written to %s', out);\n\n        return true;\n    }\n\n    /**\n     * Expand a list of input files.\n     *\n     * Searches for directories in the input files list and replaces them with a\n     * listing of all TypeScript files within them. One may use the ```--exclude``` option\n     * to filter out files with a pattern.\n     *\n     * @param inputFiles  The list of files that should be expanded.\n     * @returns  The list of input files with expanded directories.\n     */\n    public expandInputFiles(inputFiles?: string[]): string[] {\n        let exclude: IMinimatch, files: string[] = [];\n        if (this.exclude) {\n            exclude = new Minimatch(this.exclude);\n        }\n\n        function add(dirname: string) {\n            FS.readdirSync(dirname).forEach((file) => {\n                const realpath = Path.join(dirname, file);\n                if (FS.statSync(realpath).isDirectory()) {\n                    add(realpath);\n                } else if (/\\.tsx?$/.test(realpath)) {\n                    if (exclude && exclude.match(realpath.replace(/\\\\/g, '/'))) {\n                        return;\n                    }\n\n                    files.push(realpath);\n                }\n            });\n        }\n\n        inputFiles.forEach((file) => {\n            file = Path.resolve(file);\n            if (FS.statSync(file).isDirectory()) {\n                add(file);\n            } else if (!exclude || !exclude.match(file)) {\n                files.push(file);\n            }\n        });\n\n        return files;\n    }\n\n    /**\n     * Print the version number.\n     */\n    public toString() {\n        return [\n            '',\n            'TypeDoc ' + Application.VERSION,\n            'Using TypeScript ' + this.getTypeScriptVersion() + ' from ' + this.getTypeScriptPath(),\n            ''\n        ].join(typescript.sys.newLine);\n    }\n}\n"]}