diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e21767..cd6f4dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [2.0.2](https://github.com/poppinss/youch/compare/v2.0.0...v2.0.2) (2017-01-27) + + +### Bug Fixes + +* **package:** fix path to main file ([5ad3b4a](https://github.com/poppinss/youch/commit/5ad3b4a)) + + + ## [2.0.1](https://github.com/poppinss/youch/compare/v2.0.0...v2.0.1) (2017-01-26) diff --git a/README.md b/README.md index db031de..cb56a32 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@

- - + +

diff --git a/examples/index.js b/examples/index.js index f657276..7a3a4e3 100644 --- a/examples/index.js +++ b/examples/index.js @@ -17,7 +17,6 @@ function foo () { } http.createServer((req, res) => { - let youch = null try { foo () diff --git a/package.json b/package.json index e4b4919..a6c8d1c 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,8 @@ { "name": "youch", - "version": "2.0.1", + "version": "2.0.2", "description": "HTML Pretty error stack viewer", - "main": "index.js", - "bin": { - "youch": "src/Youch/index.js" - }, + "main": "src/Youch/index.js", "directories": { "example": "examples" }, @@ -24,7 +21,7 @@ }, "dependencies": { "mustache": "^2.3.0", - "stackman": "^1.2.7" + "stack-trace": "0.0.9" }, "repository": { "type": "git", diff --git a/src/Youch/index.js b/src/Youch/index.js index 146637b..b8db29c 100644 --- a/src/Youch/index.js +++ b/src/Youch/index.js @@ -11,23 +11,47 @@ const Mustache = require('mustache') const path = require('path') +const stackTrace = require('stack-trace') const fs = require('fs') const VIEW_PATH = '../resources/error.mustache' +const startingSlashRegex = new RegExp(`^${path.sep}`) const viewTemplate = fs.readFileSync(path.join(__dirname, VIEW_PATH), 'utf-8') class Youch { constructor (error, request) { - const options = { - context: 5 - } - + this.codeContext = 5 this._filterHeaders = ['cookie', 'connection'] - this.stackman = require('stackman')(options) this.error = error this.request = request } + /** + * Returns the source code for a given file. It unable to + * read file it resolves the promise with a null. + * + * @param {Object} frame + * @return {Promise} + */ + _getFrameSource (frame) { + return new Promise((resolve, reject) => { + fs.readFile(frame.getFileName(), 'utf-8', (error, contents) => { + if (error) { + resolve(null) + } + + const lines = contents.split(/\r?\n/) + const lineNumber = frame.getLineNumber() + + resolve({ + pre: lines.slice(Math.max(0, lineNumber - (this.codeContext + 1)), lineNumber - 1), + line: lines[lineNumber - 1], + post: lines.slice(lineNumber, lineNumber + this.codeContext) + }) + }) + }) + } + /** * Parses the error stack and returns serialized * frames out of it. @@ -35,10 +59,17 @@ class Youch { * @return {Object} */ _parseError () { - return new Promise((resolve) => { - this.stackman(this.error, (stack) => { - resolve(stack) - }) + return new Promise((resolve, reject) => { + const stack = stackTrace.parse(this.error) + Promise.all(stack.map((frame) => { + if (this._isNode(frame)) { + return Promise.resolve(frame) + } + return this._getFrameSource(frame).then((context) => { + frame.context = context + return frame + }) + })).then(resolve).catch(reject) }) } @@ -77,7 +108,7 @@ class Youch { classes.push('active') } - if (!frame.isApp()) { + if (!this._isApp(frame)) { classes.push('native-frame') } @@ -104,15 +135,47 @@ class Youch { * @return {Object} */ _serializeFrame (frame) { + const relativeFileName = frame.getFileName().indexOf(process.cwd()) > -1 ? + frame.getFileName().replace(process.cwd(), '').replace(startingSlashRegex, '') : + frame.getFileName() + return { - file: frame.getRelativeFileName(), - method: frame.getFunctionNameSanitized(), + file: relativeFileName, + method: frame.getFunctionName(), line: frame.getLineNumber(), column: frame.getColumnNumber(), context: this._getContext(frame) } } + /** + * Returns whether frame belongs to nodejs + * or not. + * + * @return {Boolean} [description] + */ + _isNode (frame) { + if (frame.isNative()) { + return true + } + + const filename = frame.getFileName() || '' + return !path.isAbsolute(filename) && filename[0] !== '.' + } + + /** + * Returns whether code belongs to the app + * or not. + * + * @return {Boolean} [description] + */ + _isApp (frame) { + if (this._isNode(frame)) { + return false + } + return !~(frame.getFileName() || '').indexOf('node_modules' + path.sep) + } + /** * Serializes stack to Mustache friendly object to * be used within the view. Optionally can pass @@ -129,7 +192,7 @@ class Youch { message: this.error.message, name: this.error.name, status: this.error.status, - frames: stack.frames.map(callback) + frames: stack instanceof Array === true ? stack.filter((frame) => frame.getFileName()).map(callback) : [] } } diff --git a/src/resources/error.mustache b/src/resources/error.mustache index 8b93190..36f2b4c 100644 --- a/src/resources/error.mustache +++ b/src/resources/error.mustache @@ -288,6 +288,120 @@ } + + @@ -491,34 +624,41 @@
-
+ -
- {{#frames}} - {{index}} -
-
- {{ file }}:{{ line }}:{{ column }} -
-
- {{ method }} -
-
{{ context.pre }} +
+
+ + +
+ +
+ {{#frames}} + {{index}} +
+
+ {{ file }}:{{ line }}:{{ column }} +
+
+ {{ method }} +
+
{{ context.pre }} {{ context.line }} {{ context.post }} +
-
- {{/frames}} + {{/frames}} +
@@ -584,6 +724,25 @@ Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async| diff --git a/src/resources/prism.css b/src/resources/prism.css deleted file mode 100644 index 4a57544..0000000 --- a/src/resources/prism.css +++ /dev/null @@ -1,283 +0,0 @@ -/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript&plugins=line-highlight+line-numbers+toolbar+show-language */ -/** - * prism.js default theme for JavaScript, CSS and HTML - * Based on dabblet (http://dabblet.com) - * @author Lea Verou - */ - -code[class*="language-"], -pre[class*="language-"] { - color: black; - background: none; - text-shadow: 0 1px white; - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, -code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { - text-shadow: none; - background: #b3d4fc; -} - -pre[class*="language-"]::selection, pre[class*="language-"] ::selection, -code[class*="language-"]::selection, code[class*="language-"] ::selection { - text-shadow: none; - background: #b3d4fc; -} - -@media print { - code[class*="language-"], - pre[class*="language-"] { - text-shadow: none; - } -} - -/* Code blocks */ -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -:not(pre) > code[class*="language-"], -pre[class*="language-"] { - background: #f5f2f0; -} - -/* Inline code */ -:not(pre) > code[class*="language-"] { - padding: .1em; - border-radius: .3em; - white-space: normal; -} - -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: slategray; -} - -.token.punctuation { - color: #999; -} - -.namespace { - opacity: .7; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number, -.token.constant, -.token.symbol, -.token.deleted { - color: #905; -} - -.token.selector, -.token.attr-name, -.token.string, -.token.char, -.token.builtin, -.token.inserted { - color: #690; -} - -.token.operator, -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string { - color: #a67f59; - background: hsla(0, 0%, 100%, .5); -} - -.token.atrule, -.token.attr-value, -.token.keyword { - color: #07a; -} - -.token.function { - color: #DD4A68; -} - -.token.regex, -.token.important, -.token.variable { - color: #e90; -} - -.token.important, -.token.bold { - font-weight: bold; -} -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} - -pre[data-line] { - position: relative; - padding: 1em 0 1em 3em; -} - -.line-highlight { - position: absolute; - left: 0; - right: 0; - padding: inherit 0; - margin-top: 1em; /* Same as .prism’s padding-top */ - - background: hsla(24, 20%, 50%,.08); - background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0)); - - pointer-events: none; - - line-height: inherit; - white-space: pre; -} - - .line-highlight:before, - .line-highlight[data-end]:after { - content: attr(data-start); - position: absolute; - top: .4em; - left: .6em; - min-width: 1em; - padding: 0 .5em; - background-color: hsla(24, 20%, 50%,.4); - color: hsl(24, 20%, 95%); - font: bold 65%/1.5 sans-serif; - text-align: center; - vertical-align: .3em; - border-radius: 999px; - text-shadow: none; - box-shadow: 0 1px white; - } - - .line-highlight[data-end]:after { - content: attr(data-end); - top: auto; - bottom: .4em; - } - -pre.line-numbers { - position: relative; - padding-left: 3.8em; - counter-reset: linenumber; -} - -pre.line-numbers > code { - position: relative; -} - -.line-numbers .line-numbers-rows { - position: absolute; - pointer-events: none; - top: 0; - font-size: 100%; - left: -3.8em; - width: 3em; /* works for line-numbers below 1000 lines */ - letter-spacing: -1px; - border-right: 1px solid #999; - - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -} - - .line-numbers-rows > span { - pointer-events: none; - display: block; - counter-increment: linenumber; - } - - .line-numbers-rows > span:before { - content: counter(linenumber); - color: #999; - display: block; - padding-right: 0.8em; - text-align: right; - } -pre.code-toolbar { - position: relative; -} - -pre.code-toolbar > .toolbar { - position: absolute; - top: .3em; - right: .2em; - transition: opacity 0.3s ease-in-out; - opacity: 0; -} - -pre.code-toolbar:hover > .toolbar { - opacity: 1; -} - -pre.code-toolbar > .toolbar .toolbar-item { - display: inline-block; -} - -pre.code-toolbar > .toolbar a { - cursor: pointer; -} - -pre.code-toolbar > .toolbar button { - background: none; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - padding: 0; - -webkit-user-select: none; /* for button */ - -moz-user-select: none; - -ms-user-select: none; -} - -pre.code-toolbar > .toolbar a, -pre.code-toolbar > .toolbar button, -pre.code-toolbar > .toolbar span { - color: #bbb; - font-size: .8em; - padding: 0 .5em; - background: #f5f2f0; - background: rgba(224, 224, 224, 0.2); - box-shadow: 0 2px 0 0 rgba(0,0,0,0.2); - border-radius: .5em; -} - -pre.code-toolbar > .toolbar a:hover, -pre.code-toolbar > .toolbar a:focus, -pre.code-toolbar > .toolbar button:hover, -pre.code-toolbar > .toolbar button:focus, -pre.code-toolbar > .toolbar span:hover, -pre.code-toolbar > .toolbar span:focus { - color: inherit; - text-decoration: none; -} - diff --git a/src/resources/prism.js b/src/resources/prism.js deleted file mode 100644 index 800d441..0000000 --- a/src/resources/prism.js +++ /dev/null @@ -1,9 +0,0 @@ -var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(v instanceof a)){u.lastIndex=0;var b=u.exec(v),k=1;if(!b&&h&&m!=r.length-1){if(u.lastIndex=y,b=u.exec(e),!b)break;for(var w=b.index+(c?b[1].length:0),_=b.index+b[0].length,A=m,P=y,j=r.length;j>A&&_>P;++A)P+=r[A].length,w>=P&&(++m,y=P);if(r[m]instanceof a||r[A-1].greedy)continue;k=A-m,v=e.slice(y,P),b.index-=y}if(b){c&&(f=b[1].length);var w=b.index+f,b=b[0].slice(f),_=w+b.length,x=v.slice(0,w),O=v.slice(_),S=[m,k];x&&S.push(x);var N=new a(l,g?n.tokenize(b,g):b,d,b,h);S.push(N),O&&S.push(O),Array.prototype.splice.apply(r,S)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o=Object.keys(i.attributes).map(function(e){return e+'="'+(i.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+""},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); -Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup; -Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); -Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; -Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript; -!function(){function e(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function t(e,t){return t=" "+t+" ",(" "+e.className+" ").replace(/[\n\t]/g," ").indexOf(t)>-1}function n(e,n,i){for(var o,a=n.replace(/\s+/g,"").split(","),l=+e.getAttribute("data-line-offset")||0,d=r()?parseInt:parseFloat,c=d(getComputedStyle(e).lineHeight),s=0;o=a[s++];){o=o.split("-");var u=+o[0],m=+o[1]||u,h=document.createElement("div");h.textContent=Array(m-u+2).join(" \n"),h.setAttribute("aria-hidden","true"),h.className=(i||"")+" line-highlight",t(e,"line-numbers")||(h.setAttribute("data-start",u),m>u&&h.setAttribute("data-end",m)),h.style.top=(u-l-1)*c+"px",t(e,"line-numbers")?e.appendChild(h):(e.querySelector("code")||e).appendChild(h)}}function i(){var t=location.hash.slice(1);e(".temporary.line-highlight").forEach(function(e){e.parentNode.removeChild(e)});var i=(t.match(/\.([\d,-]+)$/)||[,""])[1];if(i&&!document.getElementById(t)){var r=t.slice(0,t.lastIndexOf(".")),o=document.getElementById(r);o&&(o.hasAttribute("data-line")||o.setAttribute("data-line",""),n(o,i,"temporary "),document.querySelector(".temporary.line-highlight").scrollIntoView())}}if("undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector){var r=function(){var e;return function(){if("undefined"==typeof e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding=0,t.style.border=0,t.innerHTML=" 
 ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}}(),o=0;Prism.hooks.add("complete",function(t){var r=t.element.parentNode,a=r&&r.getAttribute("data-line");r&&a&&/pre/i.test(r.nodeName)&&(clearTimeout(o),e(".line-highlight",r).forEach(function(e){e.parentNode.removeChild(e)}),n(r,a),o=setTimeout(i,1))}),window.addEventListener&&window.addEventListener("hashchange",i)}}(); -!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,s=/\s*\bline-numbers\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(s.test(t.className)||s.test(e.element.className))&&!e.element.querySelector(".line-numbers-rows")){s.test(e.element.className)&&(e.element.className=e.element.className.replace(s,"")),s.test(t.className)||(t.className+=" line-numbers");var n,a=e.code.match(/\n(?!$)/g),l=a?a.length+1:1,r=new Array(l+1);r=r.join(""),n=document.createElement("span"),n.setAttribute("aria-hidden","true"),n.className="line-numbers-rows",n.innerHTML=r,t.hasAttribute("data-start")&&(t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)),e.element.appendChild(n)}}})}(); -!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var t=[],e={},n=function(){};Prism.plugins.toolbar={};var a=Prism.plugins.toolbar.registerButton=function(n,a){var o;o="function"==typeof a?a:function(t){var e;return"function"==typeof a.onClick?(e=document.createElement("button"),e.type="button",e.addEventListener("click",function(){a.onClick.call(this,t)})):"string"==typeof a.url?(e=document.createElement("a"),e.href=a.url):e=document.createElement("span"),e.textContent=a.text,e},t.push(e[n]=o)},o=Prism.plugins.toolbar.hook=function(a){var o=a.element.parentNode;if(o&&/pre/i.test(o.nodeName)&&!o.classList.contains("code-toolbar")){o.classList.add("code-toolbar");var r=document.createElement("div");r.classList.add("toolbar"),document.body.hasAttribute("data-toolbar-order")&&(t=document.body.getAttribute("data-toolbar-order").split(",").map(function(t){return e[t]||n})),t.forEach(function(t){var e=t(a);if(e){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(e),r.appendChild(n)}}),o.appendChild(r)}};a("label",function(t){var e=t.element.parentNode;if(e&&/pre/i.test(e.nodeName)&&e.hasAttribute("data-label")){var n,a,o=e.getAttribute("data-label");try{a=document.querySelector("template#"+o)}catch(r){}return a?n=a.content:(e.hasAttribute("data-url")?(n=document.createElement("a"),n.href=e.getAttribute("data-url")):n=document.createElement("span"),n.textContent=o),n}}),Prism.hooks.add("complete",o)}}(); -!function(){if("undefined"!=typeof self&&self.Prism&&self.document){if(!Prism.plugins.toolbar)return console.warn("Show Languages plugin loaded before Toolbar plugin."),void 0;var e={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",asciidoc:"AsciiDoc",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",graphql:"GraphQL",http:"HTTP",inform7:"Inform 7",json:"JSON",latex:"LaTeX",livescript:"LiveScript",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",parigp:"PARI/GP",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",xojo:"Xojo (REALbasic)",yaml:"YAML"};Prism.plugins.toolbar.registerButton("show-language",function(t){var a=t.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s=a.getAttribute("data-language")||e[t.language]||t.language.substring(0,1).toUpperCase()+t.language.substring(1),r=document.createElement("span");return r.textContent=s,r}})}}(); diff --git a/src/resources/style.css b/src/resources/style.css deleted file mode 100644 index 5a38118..0000000 --- a/src/resources/style.css +++ /dev/null @@ -1,149 +0,0 @@ -html, body { - height: 100%; - width: 100%; -} - -body { - font-family: 'Source Sans Pro', sans-serif; - font-size: 16px; - line-height: 24px; - color: #444; -} - -* { - padding: 0; - margin: 0; -} - -.error-page { - display: flex; - flex-direction: column; - width: 100%; - height: 100%; -} - -.error-stack { - background: #edecea; - height: 600px; - padding: 100px 80px; - box-sizing: border-box; -} - -.error-status { - color: #afafaf; - font-size: 150px; - position: absolute; - opacity: 0.2; - right: 80px; - top: 80px; - font-weight: 600; - margin-bottom: 10px; -} - -.error-message { - font-weight: 300; - font-size: 40px; -} - -.error-title { - border-bottom: 1px solid #d0cfcf; - padding-bottom: 40px; - margin-bottom: 20px; -} - -.error-frames { - display: flex; - flex-direction: row-reverse; -} - -.frame-preview { - background: #fff; - width: 50%; - box-shadow: 0px 0px 9px #d3d3d3; - height: 100%; - box-sizing: border-box; - overflow: auto; -} - -.frame-list { - margin-right: 40px; - flex: 1; - height: 334px; - padding: 40px 0; -} - -.request-details { - padding: 50px 80px; -} - -.request-title { - text-transform: uppercase; - font-size: 18px; - letter-spacing: 1px; - padding: 0 5px 5px 5px; - margin-bottom: 15px; -} - -.request-details table { - width: 100%; - border-collapse: collapse; -} - -.request-details table td { - padding: 6px 5px; - font-size: 16px; - letter-spacing: 0.4px; - color: #455275; - border-bottom: 1px solid #e8e8e8; -} - -.request-details table td.title { - color: #999; - width: 40%; - font-size: 14px; - font-weight: 600; - text-transform: uppercase; -} - -code[class*="language-"], pre[class*="language-"] { - background: transparent; - font-size: 13px; - line-height: 1.8; -} - -.line-numbers .line-numbers-rows { - border: none; -} - -.frame-row { - display: flex; - justify-content: space-between; - padding: 6px 34px 6px 10px; - position: relative; -} - -.frame-row:after { - content: ""; - background: orange; - position: absolute; - top: 50%; - right: 10px; - transform: translateY(-50%); - height: 12px; - width: 12px; - border-radius: 24px; -} - -.frame-row.active { - background: #fff; -} - -.frame-row-filepath { - color: #455275; - font-weight: 600; - margin-right: 15px; -} - -.frame-row-code { - color: #999; -}