jsdoc-tests
Version:
A JSDoc test tool for documentation-driven quality
3 lines (2 loc) • 872 B
JavaScript
import{resolve as r,basename as e,extname as t}from"path";import{readFileSync as n,writeFileSync as i}from"fs";import{parse as o}from"@babel/parser";var u=["js","javascript","ts","typescript"],p=function(p,a){return void 0===a&&(a=process.cwd()),new Promise(function(f,s){var c=r(a,p),l=e(c).replace(new RegExp(t(c)+"$"),""),m=n(c,"utf8"),v=o(m,{sourceType:"module",plugins:["jsx","typescript"]}).comments,d=[],h=0,g=require("markdown-it")({highlight:function(e,n){if(u.includes(n)){var o=r(a,[l,h,"snap"].join(".")+t(c));i(o,e,"utf8");var p=require(o),f=null;"function"==typeof p?f=p:"function"==typeof p.default&&(f=p.default),f&&d.push(f()),h+=1}}});v.forEach(function(r){var e=r.value;if(/^\*\n/.test(e)){var t=e.replace(/\n\s*\*/g,"\n");g.render(t)}}),Promise.all(d).then(function(){return f()},s)})};export{p as jsdocTests};
//# sourceMappingURL=index.module.js.map