trakk-js
Version:
Automatic Documentation Generation - Real-Time Code Execution Flow - Testing / Debugging - Onboarding - for Front-End Applications
1 lines • 8.08 kB
JavaScript
function _0x52a2(){const _0x11117d=['stack','3khqVAy','message','map','split','send','1034577NzNTJA','20Gsiwzz','3572544pDHgfG','1594394gvFeNv','slice','utf-8','join','status','extname','yQKmD','length','<span\x20class=\x22trakkjs-ln\x22>','546208fpzcnR','</title>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<link\x20rel=\x22preconnect\x22\x20href=\x22https://fonts.googleapis.com\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<link\x20rel=\x22preconnect\x22\x20href=\x22https://fonts.gstatic.com\x22\x20crossorigin=\x22true\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<link\x20href=\x22https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap\x22\x20rel=\x22stylesheet\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<link\x20rel=\x22stylesheet\x22\x20href=\x22https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/atom-one-dark.min.css\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<style>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20font-family:\x20\x27Open\x20Sans\x27,\x20Arial,\x20sans-serif;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20margin:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20background-color:\x20#2d2d2df5;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20padding:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20margin:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20box-sizing:\x20border-box;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20>\x20*\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20padding:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20margin:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20box-sizing:\x20border-box;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20position:\x20relative;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20float:\x20left;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20width:\x20100%;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20height:\x20auto;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20border:\x2020px\x20solid\x20transparent;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20>\x20h3\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20color:\x20white;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20border:\x2020px\x20solid\x20transparent;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20text-align:\x20center;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20font-size:\x2040px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20font-weight:\x20100;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20>\x20h3\x20span:nth-child(1),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20>\x20h3\x20span:nth-child(2)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20color:\x20red;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20>\x20p\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20text-align:\x20center;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20color:\x20white;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20font-size:\x2024px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20color:\x20#808080;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20>\x20p\x20span\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20background:\x20#4b4b4b;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20padding:\x2011px\x2018px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20border-radius:\x2020px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20color:\x20white;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20body\x20code\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20color:\x20white;\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20pre\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20padding:\x2020px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20background-color:\x20#1e1e1e;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20border-radius:\x2025px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20overflow-x:\x20auto;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20font-size:\x2014px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20line-height:\x201.5;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20/*\x20Style\x20for\x20line\x20numbers\x20*/\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.trakkjs-ln\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20color:\x20#484848;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20</style>\x0a\x20\x20\x20\x20\x20\x20</head>\x0a\x20\x20\x20\x20\x20\x20<body>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<h3>Tra<span>k</span>k<span>.</span>js</h3>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<p>You\x20are\x20viewing\x20 <span>','196pUCvLK','86845ucdJgL','551739LJnwfT','5724208NUGIaB'];_0x52a2=function(){return _0x11117d;};return _0x52a2();}(function(_0x10aedc,_0x1ccdc7){const _0x2539a3=_0x74b9,_0x41fd6c=_0x10aedc();while(!![]){try{const _0x40d352=parseInt(_0x2539a3(0x70))/0x1+parseInt(_0x2539a3(0x7b))/0x2*(-parseInt(_0x2539a3(0x73))/0x3)+parseInt(_0x2539a3(0x86))/0x4*(-parseInt(_0x2539a3(0x6f))/0x5)+parseInt(_0x2539a3(0x7a))/0x6+parseInt(_0x2539a3(0x71))/0x7+-parseInt(_0x2539a3(0x84))/0x8+parseInt(_0x2539a3(0x78))/0x9*(parseInt(_0x2539a3(0x79))/0xa);if(_0x40d352===_0x1ccdc7)break;else _0x41fd6c['push'](_0x41fd6c['shift']());}catch(_0x339567){_0x41fd6c['push'](_0x41fd6c['shift']());}}}(_0x52a2,0x74c33));import _0x25ac82 from'fs';import _0x3c7eed from'path';import _0x42a413 from'highlight.js';import _0x24829b from'./rer.js';function _0x74b9(_0x5881fd,_0x5c2961){const _0x52a252=_0x52a2();return _0x74b9=function(_0x74b9b8,_0x31f704){_0x74b9b8=_0x74b9b8-0x6f;let _0x116590=_0x52a252[_0x74b9b8];return _0x116590;},_0x74b9(_0x5881fd,_0x5c2961);}export default async function (req,res){const _0x3b3723=_0x74b9,MRKByz={'yQKmD':function(x,y){return x+y;}},filePath=req['query']['path'];try{const fileContent=_0x25ac82['readFileSync'](filePath,_0x3b3723(0x7d)),fileLines=fileContent['split']('\x0a'),ext=_0x3c7eed[_0x3b3723(0x80)](filePath)[_0x3b3723(0x7c)](0x1),highlightedCode=_0x42a413['highlight'](fileContent,{'language':ext})['value'],highlightedLines=highlightedCode[_0x3b3723(0x76)]('\x0a'),maxLineNumberLength=String(fileLines[_0x3b3723(0x82)])[_0x3b3723(0x82)],numberedLines=highlightedLines[_0x3b3723(0x75)]((line,index)=>{const _0x2f95e3=_0x3b3723,lineNumber=MRKByz[_0x2f95e3(0x81)](index,0x1),paddedLineNumber=('L'+lineNumber)['padStart'](MRKByz['yQKmD'](maxLineNumberLength,0x1),'\x20');return _0x2f95e3(0x83)+paddedLineNumber+'</span>\x20'+line;}),numberedContent=numberedLines[_0x3b3723(0x7e)]('\x0a'),htmlTemplate='\x0a\x20\x20\x20\x20\x20\x20<!DOCTYPE\x20html>\x0a\x20\x20\x20\x20\x20\x20<html\x20lang=\x22en\x22>\x0a\x20\x20\x20\x20\x20\x20<head>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<meta\x20charset=\x22UTF-8\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<meta\x20name=\x22viewport\x22\x20content=\x22width=device-width,\x20initial-scale=1.0\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<title>Trakk.js\x20Viewing\x20'+filePath+_0x3b3723(0x85)+filePath+'</span></p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<pre><code>'+numberedContent+'</code></pre>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20</body>\x0a\x20\x20\x20\x20\x20\x20</html>\x0a\x20\x20\x20\x20';res[_0x3b3723(0x77)](htmlTemplate);}catch(error){await _0x24829b({'error':JSON['stringify']({'name':error?.['name'],'message':error?.[_0x3b3723(0x74)],'stack':error?.[_0x3b3723(0x72)]},null,0x2),'file':'/trakk-js/utils/vc.js','context':'local-view-code-route'}),res[_0x3b3723(0x7f)](0x1f4)[_0x3b3723(0x77)]('File\x20{\x20'+filePath+'\x20}\x20not\x20found.');}}