forked from limedocs/limedocs-wiki-converter
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathfinder.js.map
1 lines (1 loc) · 3.4 KB
/
finder.js.map
1
{"version":3,"sources":["../src/finder.js"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;AAEZ,IAAI,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;IACzB,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IACtB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IACxB,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IACtB,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAC5B,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;;;;;;IAK3B,MAAM;WAAN,MAAM;0BAAN,MAAM;;;eAAN,MAAM;;;;;;;;;WAQgB,6BAAC,QAAQ,EAAE;;AAEnC,aAAO,IAAI,OAAO,CAAC,UAAS,OAAO,EAAE,MAAM,EAAE;;AAE3C,YAAI,OAAO,GAAG,EAAE;YACZ,OAAO,GAAG,EAAE;YACZ,OAAO,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;;AAE7C,WAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;AACrE,cAAI,CAAC,GAAG,EAAE;AACR,mBAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAA;AAC3B,gBAAI,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAClC,mBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAA;WACpD;AACD,cAAI,EAAE,CAAA;SACP,EACD,UAAU,GAAG,EAAE,KAAK,EAAE;AACpB,cAAI,GAAG,EAAE;AACP,mBAAO,MAAM,CAAC,GAAG,CAAC,CAAA;WACnB;AACD,gBAAM,CAAC,KAAK,CACV,IAAI,CAAC,MAAM,CACT,8DAA8D,EAC9D,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAC3B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAC5B,CACF,CAAA;AACD,iBAAO,CAAC,EAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,CAAC,CAAA;SAC5C,CAAC,CAAA;OACL,CAAC,CAAA;KACH;;;;;;;;;WAOmB,uBAAC,KAAK,EAAE,WAAW,EAAE;AACvC,UAAI,IAAI,GAAG,IAAI,CAAA;AACf,WAAK,CAAC,IAAI,CAAC,UAAA,CAAC,EAAI;AACd,YAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;AACjC,YAAI;AACF,iBAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,IAAI,GAAG,CAAC,CAAA,AAAC,CAAC;SAC/C,CAAC,OAAM,CAAC,EAAE;AACT,iBAAO,KAAK,CAAA;SACb;OACF,EAAE,IAAI,CAAC,CAAA;AACR,aAAO,IAAI,CAAA;KACZ;;;SAxDG,MAAM;;;AA2DZ,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA","file":"finder.js","sourcesContent":["\"use strict\"\n\nvar dir = require('node-dir')\n , path = require('path')\n , fs = require('fs-extra')\n , util = require('util')\n , logger = require('./logger')\n , Promise = require(\"bluebird\")\n\n/**\n * Finder class\n */\nclass Finder {\n\n /**\n * Search for md files\n *\n * @param {string} wikiPath Path to wiki directory\n * @returns {Promise}\n */\n static searchMarkdownFiles(wikiPath) {\n\n return new Promise(function(resolve, reject) {\n\n var mdFiles = {},\n aliases = {},\n dirOpts = { match: /.md/, exclude: /^_/ }\n\n dir.readFiles(wikiPath, dirOpts, function (err, content, filename, next) {\n if (!err) {\n mdFiles[filename] = content\n var base = path.basename(filename)\n aliases[base.substr(0, base.length - 3)] = filename\n }\n next()\n },\n function (err, files) {\n if (err) {\n return reject(err)\n }\n logger.debug(\n util.format(\n 'Found %d markdown files and %d links pointing to them in TOC',\n Object.keys(mdFiles).length,\n Object.keys(aliases).length\n )\n )\n resolve({files: mdFiles, aliases: aliases})\n })\n })\n }\n\n /**\n * Search for a file among multiple directories, ordered by priority\n *\n * @returns {string|null}\n */\n static searchForFile(files, search_path) {\n var file = null\n files.some(f => {\n var p = path.join(search_path, f)\n try {\n return (fs.statSync(p).isFile() && (file = p))\n } catch(e) {\n return false\n }\n }, this)\n return file\n }\n}\n\nmodule.exports = Finder\n"]}