stryker-html-reporter
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -5,67 +5,48 @@ { | ||
{ | ||
"name": "Run unit tests", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/node_modules/grunt-cli/bin/grunt", | ||
"stopOnEntry": false, | ||
"args": [ | ||
"mochaTest:unit" | ||
], | ||
"cwd": "${workspaceRoot}/.", | ||
"runtimeExecutable": null, | ||
"name": "Run ui tests", | ||
"runtimeExecutable": "npm", | ||
"windows": { | ||
"runtimeExecutable": "npm.cmd" | ||
}, | ||
"runtimeArgs": [ | ||
"--nolazy" | ||
"run-script", | ||
"uiTest" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"externalConsole": false, | ||
"sourceMaps": true, | ||
"outDir": "${workspaceRoot}" | ||
"port": 5858 | ||
}, | ||
{ | ||
"name": "Run integration tests", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/node_modules/grunt-cli/bin/grunt", | ||
// "preLaunchTask": "build", | ||
"stopOnEntry": false, | ||
"name": "Run unit tests", | ||
"program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"mochaTest:integration" | ||
"-u", | ||
"tdd", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceRoot}/test/helpers/**/*.js", | ||
"${workspaceRoot}/test/unit/**/*.js" | ||
], | ||
"cwd": "${workspaceRoot}/.", | ||
"runtimeExecutable": null, | ||
"runtimeArgs": [ | ||
"--nolazy" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"externalConsole": false, | ||
"sourceMaps": true, | ||
"outDir": "${workspaceRoot}" | ||
"internalConsoleOptions": "openOnSessionStart" | ||
}, | ||
{ | ||
"name": "Run ui tests", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor", | ||
// "preLaunchTask": "build", | ||
"stopOnEntry": false, | ||
"name": "Run integration tests", | ||
"program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"protractor.conf.js", "--nolazy" | ||
"-u", | ||
"tdd", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceRoot}/test/helpers/**/*.js", | ||
"${workspaceRoot}/test/integration/**/*.js" | ||
], | ||
"cwd": "${workspaceRoot}/.", | ||
"runtimeExecutable": null, | ||
"runtimeArgs": [ | ||
"--nolazy" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"externalConsole": false, | ||
"sourceMaps": true, | ||
"outDir": "${workspaceRoot}" | ||
}, | ||
"internalConsoleOptions": "openOnSessionStart" | ||
} | ||
] | ||
} |
{ | ||
"typescript.tsdk": "${workspaceRoot}/../../node_modules/typescript/lib", | ||
"files": { | ||
@@ -3,0 +4,0 @@ "exclude": { |
{ | ||
"name": "stryker-html-reporter", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "An html reporter for the JavaScript mutation testing framework Stryker", | ||
"main": "index.js", | ||
"main": "src/index.js", | ||
"typings": "src/index.d.ts", | ||
"scripts": { | ||
"test": "grunt test", | ||
"preversion": "npm test" | ||
"clean": "rimraf \"+(test|src)/!(resources)/**/*+(.d.ts|.js|.map)\" coverage", | ||
"build": "tsc -p . && node tasks/clientResources.js && browserify src/resources/stryker.js -o resources/stryker.js", | ||
"postbuild": "tslint -p tsconfig.json", | ||
"start": "tsc -w -p .", | ||
"test": "nyc --check-coverage --lines 95 --functions 95 --branches 95 mocha \"test/helpers/*.js\" \"test/unit/*.js\" \"test/integration/*.js\"" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/stryker-mutator/stryker-html-reporter.git" | ||
"url": "https://github.com/stryker-mutator/stryker.git" | ||
}, | ||
@@ -25,6 +29,7 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/stryker-mutator/stryker-html-reporter/issues" | ||
"url": "https://github.com/stryker-mutator/stryker/issues" | ||
}, | ||
"homepage": "https://github.com/stryker-mutator/stryker-html-reporter#readme", | ||
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/stryker-html-reporter#readme", | ||
"dependencies": { | ||
"file-url": "^2.0.0", | ||
"handlebars": "^4.0.5", | ||
@@ -40,43 +45,8 @@ "lodash": "^4.13.1", | ||
"devDependencies": { | ||
"@types/chai": "^3.4.32", | ||
"@types/chai-as-promised": "0.0.29", | ||
"@types/es6-promise": "0.0.31", | ||
"@types/handlebars": "^4.0.30", | ||
"@types/lodash": "^4.14.34", | ||
"@types/log4js": "0.0.31", | ||
"@types/mkdirp": "^0.3.28", | ||
"@types/mocha": "^2.2.31", | ||
"@types/mz": "0.0.30", | ||
"@types/node": "^6.0.38", | ||
"@types/protractor": "^1.5.20", | ||
"@types/selenium-webdriver": "2.44.*", | ||
"@types/sinon": "^1.16.29", | ||
"@types/sinon-chai": "^2.7.26", | ||
"@types/file-url": "^1.0.28", | ||
"@types/handlebars": "^4.0.32", | ||
"@types/selenium-webdriver": "^3.0.3", | ||
"bootstrap": "3.3.7", | ||
"chai": "^3.5.0", | ||
"chai-as-promised": "^6.0.0", | ||
"grunt": "^1.0.1", | ||
"grunt-browserify": "^5.0.0", | ||
"grunt-bump": "^0.8.0", | ||
"grunt-cli": "^1.2.0", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
"grunt-conventional-changelog": "^6.1.0", | ||
"grunt-mocha-istanbul": "^5.0.1", | ||
"grunt-mocha-test": "^0.13.2", | ||
"grunt-npm": "0.0.2", | ||
"grunt-protractor-runner": "^4.0.0", | ||
"grunt-ts": "^6.0.0-beta.3", | ||
"grunt-tslint": "^3.2.1", | ||
"highlight.js": "^9.4.0", | ||
"istanbul": "^0.4.5", | ||
"load-grunt-tasks": "^3.5.2", | ||
"mocha": "^3.1.0", | ||
"protractor": "^4.0.11", | ||
"sinon": "^1.17.6", | ||
"sinon-chai": "^2.8.0", | ||
"stryker-api": "^0.4.0", | ||
"tslint": "^3.15.1", | ||
"typescript": "^2.0.10" | ||
"stryker-api": "^0.4.1" | ||
}, | ||
@@ -83,0 +53,0 @@ "contributors": [ |
@@ -0,1 +1,4 @@ | ||
const spawn = require('child_process').spawn; | ||
const os = require('os'); | ||
var config = { | ||
@@ -18,7 +21,10 @@ directConnect: true, | ||
if (process.env.TRAVIS) { | ||
// Use the travis selenium server spawned in the container, only firefox is working atm | ||
config.capabilities = { | ||
browserName: 'firefox' | ||
}; | ||
config.seleniumAddress = 'http://localhost:4444/wd/hub'; | ||
config.directConnect = false; | ||
} | ||
exports.config = config; |
@@ -1,2 +0,2 @@ | ||
[![Build Status](https://travis-ci.org/stryker-mutator/stryker-html-reporter.svg?branch=master)](https://travis-ci.org/stryker-mutator/stryker-html-reporter) | ||
[![Build Status](https://travis-ci.org/stryker-mutator/stryker.svg?branch=master)](https://travis-ci.org/stryker-mutator/stryker) | ||
[![NPM](https://img.shields.io/npm/dm/stryker-html-reporter.svg)](https://www.npmjs.com/package/stryker-html-reporter) | ||
@@ -6,3 +6,3 @@ [![Node version](https://img.shields.io/node/v/stryker-html-reporter.svg)](https://img.shields.io/node/v/stryker-html-reporter.svg) | ||
#Stryker HTML Reporter | ||
# Stryker HTML Reporter | ||
@@ -9,0 +9,0 @@ An HTML Reporter for the JavaScript mutation testing framework [Stryker](https://stryker-mutator.github.io) |
@@ -10,4 +10,4 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// Find the global object for export to both the browser and web workers. | ||
var globalObject = typeof window == 'object' && window || | ||
typeof self == 'object' && self; | ||
var globalObject = typeof window === 'object' && window || | ||
typeof self === 'object' && self; | ||
@@ -32,7 +32,31 @@ // Setup highlight.js for different environments. First is Node.js or | ||
}(function(hljs) { | ||
// Convenience variables for build-in objects | ||
var ArrayProto = [], | ||
objectKeys = Object.keys; | ||
// Global internal variables used within the highlight.js library. | ||
var languages = {}, | ||
aliases = {}; | ||
// Regular expressions used throughout the highlight.js library. | ||
var noHighlightRe = /^(no-?highlight|plain|text)$/i, | ||
languagePrefixRe = /\blang(?:uage)?-([\w-]+)\b/i, | ||
fixMarkupRe = /((^(<[^>]+>|\t|)+|(?:\n)))/gm; | ||
var spanEndTag = '</span>'; | ||
// Global options used when within external APIs. This is modified when | ||
// calling the `hljs.configure` function. | ||
var options = { | ||
classPrefix: 'hljs-', | ||
tabReplace: null, | ||
useBR: false, | ||
languages: undefined | ||
}; | ||
/* Utility functions */ | ||
function escape(value) { | ||
return value.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>'); | ||
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); | ||
} | ||
@@ -46,12 +70,12 @@ | ||
var match = re && re.exec(lexeme); | ||
return match && match.index == 0; | ||
return match && match.index === 0; | ||
} | ||
function isNotHighlighted(language) { | ||
return (/^(no-?highlight|plain|text)$/i).test(language); | ||
return noHighlightRe.test(language); | ||
} | ||
function blockLanguage(block) { | ||
var i, match, length, | ||
classes = block.className + ' '; | ||
var i, match, length, _class; | ||
var classes = block.className + ' '; | ||
@@ -61,3 +85,3 @@ classes += block.parentNode ? block.parentNode.className : ''; | ||
// language-* takes precedence over non-prefixed class names. | ||
match = (/\blang(?:uage)?-([\w-]+)\b/i).exec(classes); | ||
match = languagePrefixRe.exec(classes); | ||
if (match) { | ||
@@ -68,5 +92,8 @@ return getLanguage(match[1]) ? match[1] : 'no-highlight'; | ||
classes = classes.split(/\s+/); | ||
for (i = 0, length = classes.length; i < length; i++) { | ||
if (getLanguage(classes[i]) || isNotHighlighted(classes[i])) { | ||
return classes[i]; | ||
_class = classes[i] | ||
if (isNotHighlighted(_class) || getLanguage(_class)) { | ||
return _class; | ||
} | ||
@@ -76,9 +103,13 @@ } | ||
function inherit(parent, obj) { | ||
var result = {}, key; | ||
function inherit(parent) { // inherit(parent, override_obj, override_obj, ...) | ||
var key; | ||
var result = {}; | ||
var objects = Array.prototype.slice.call(arguments, 1); | ||
for (key in parent) | ||
result[key] = parent[key]; | ||
if (obj) | ||
objects.forEach(function(obj) { | ||
for (key in obj) | ||
result[key] = obj[key]; | ||
}); | ||
return result; | ||
@@ -93,5 +124,5 @@ } | ||
for (var child = node.firstChild; child; child = child.nextSibling) { | ||
if (child.nodeType == 3) | ||
if (child.nodeType === 3) | ||
offset += child.nodeValue.length; | ||
else if (child.nodeType == 1) { | ||
else if (child.nodeType === 1) { | ||
result.push({ | ||
@@ -129,3 +160,3 @@ event: 'start', | ||
} | ||
if (original[0].offset != highlighted[0].offset) { | ||
if (original[0].offset !== highlighted[0].offset) { | ||
return (original[0].offset < highlighted[0].offset) ? original : highlighted; | ||
@@ -149,8 +180,8 @@ } | ||
*/ | ||
return highlighted[0].event == 'start' ? original : highlighted; | ||
return highlighted[0].event === 'start' ? original : highlighted; | ||
} | ||
function open(node) { | ||
function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"';} | ||
result += '<' + tag(node) + Array.prototype.map.call(node.attributes, attr_str).join('') + '>'; | ||
function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value).replace('"', '"') + '"';} | ||
result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>'; | ||
} | ||
@@ -163,3 +194,3 @@ | ||
function render(event) { | ||
(event.event == 'start' ? open : close)(event.node); | ||
(event.event === 'start' ? open : close)(event.node); | ||
} | ||
@@ -169,5 +200,5 @@ | ||
var stream = selectStream(); | ||
result += escape(value.substr(processed, stream[0].offset - processed)); | ||
result += escape(value.substring(processed, stream[0].offset)); | ||
processed = stream[0].offset; | ||
if (stream == original) { | ||
if (stream === original) { | ||
/* | ||
@@ -183,6 +214,6 @@ On any opening or closing tag of the original markup we first close | ||
stream = selectStream(); | ||
} while (stream == original && stream.length && stream[0].offset == processed); | ||
} while (stream === original && stream.length && stream[0].offset === processed); | ||
nodeStack.reverse().forEach(open); | ||
} else { | ||
if (stream[0].event == 'start') { | ||
if (stream[0].event === 'start') { | ||
nodeStack.push(stream[0].node); | ||
@@ -200,2 +231,11 @@ } else { | ||
function expand_mode(mode) { | ||
if (mode.variants && !mode.cached_variants) { | ||
mode.cached_variants = mode.variants.map(function(variant) { | ||
return inherit(mode, {variants: null}, variant); | ||
}); | ||
} | ||
return mode.cached_variants || (mode.endsWithParent && [inherit(mode)]) || [mode]; | ||
} | ||
function compileLanguage(language) { | ||
@@ -233,6 +273,6 @@ | ||
if (typeof mode.keywords == 'string') { // string | ||
if (typeof mode.keywords === 'string') { // string | ||
flatten('keyword', mode.keywords); | ||
} else { | ||
Object.keys(mode.keywords).forEach(function (className) { | ||
objectKeys(mode.keywords).forEach(function (className) { | ||
flatten(className, mode.keywords[className]); | ||
@@ -262,3 +302,3 @@ }); | ||
mode.illegalRe = langRe(mode.illegal); | ||
if (mode.relevance === undefined) | ||
if (mode.relevance == null) | ||
mode.relevance = 1; | ||
@@ -268,11 +308,5 @@ if (!mode.contains) { | ||
} | ||
var expanded_contains = []; | ||
mode.contains.forEach(function(c) { | ||
if (c.variants) { | ||
c.variants.forEach(function(v) {expanded_contains.push(inherit(c, v));}); | ||
} else { | ||
expanded_contains.push(c == 'self' ? mode : c); | ||
} | ||
}); | ||
mode.contains = expanded_contains; | ||
mode.contains = Array.prototype.concat.apply([], mode.contains.map(function(c) { | ||
return expand_mode(c === 'self' ? mode : c) | ||
})); | ||
mode.contains.forEach(function(c) {compileMode(c, mode);}); | ||
@@ -309,3 +343,5 @@ | ||
function subMode(lexeme, mode) { | ||
for (var i = 0; i < mode.contains.length; i++) { | ||
var i, length; | ||
for (i = 0, length = mode.contains.length; i < length; i++) { | ||
if (testRe(mode.contains[i].beginRe, lexeme)) { | ||
@@ -341,3 +377,3 @@ return mode.contains[i]; | ||
openSpan = '<span class="' + classPrefix, | ||
closeSpan = leaveOpen ? '' : '</span>'; | ||
closeSpan = leaveOpen ? '' : spanEndTag | ||
@@ -350,11 +386,15 @@ openSpan += classname + '">'; | ||
function processKeywords() { | ||
var keyword_match, last_index, match, result; | ||
if (!top.keywords) | ||
return escape(mode_buffer); | ||
var result = ''; | ||
var last_index = 0; | ||
result = ''; | ||
last_index = 0; | ||
top.lexemesRe.lastIndex = 0; | ||
var match = top.lexemesRe.exec(mode_buffer); | ||
match = top.lexemesRe.exec(mode_buffer); | ||
while (match) { | ||
result += escape(mode_buffer.substr(last_index, match.index - last_index)); | ||
var keyword_match = keywordMatch(top, match); | ||
result += escape(mode_buffer.substring(last_index, match.index)); | ||
keyword_match = keywordMatch(top, match); | ||
if (keyword_match) { | ||
@@ -373,3 +413,3 @@ relevance += keyword_match[1]; | ||
function processSubLanguage() { | ||
var explicit = typeof top.subLanguage == 'string'; | ||
var explicit = typeof top.subLanguage === 'string'; | ||
if (explicit && !languages[top.subLanguage]) { | ||
@@ -397,7 +437,7 @@ return escape(mode_buffer); | ||
function processBuffer() { | ||
result += (top.subLanguage !== undefined ? processSubLanguage() : processKeywords()); | ||
result += (top.subLanguage != null ? processSubLanguage() : processKeywords()); | ||
mode_buffer = ''; | ||
} | ||
function startNewMode(mode, lexeme) { | ||
function startNewMode(mode) { | ||
result += mode.className? buildSpan(mode.className, '', true): ''; | ||
@@ -411,3 +451,3 @@ top = Object.create(mode, {parent: {value: top}}); | ||
if (lexeme === undefined) { | ||
if (lexeme == null) { | ||
processBuffer(); | ||
@@ -450,3 +490,3 @@ return 0; | ||
if (top.className) { | ||
result += '</span>'; | ||
result += spanEndTag; | ||
} | ||
@@ -457,3 +497,3 @@ if (!top.skip) { | ||
top = top.parent; | ||
} while (top != end_mode.parent); | ||
} while (top !== end_mode.parent); | ||
if (end_mode.starts) { | ||
@@ -486,3 +526,3 @@ startNewMode(end_mode.starts, ''); | ||
var result = '', current; | ||
for(current = top; current != language; current = current.parent) { | ||
for(current = top; current !== language; current = current.parent) { | ||
if (current.className) { | ||
@@ -501,3 +541,3 @@ result = buildSpan(current.className, '', true) + result; | ||
break; | ||
count = processLexeme(value.substr(index, match.index - index), match[0]); | ||
count = processLexeme(value.substring(index, match.index), match[0]); | ||
index = match.index + count; | ||
@@ -508,3 +548,3 @@ } | ||
if (current.className) { | ||
result += '</span>'; | ||
result += spanEndTag; | ||
} | ||
@@ -519,3 +559,3 @@ } | ||
} catch (e) { | ||
if (e.message.indexOf('Illegal') != -1) { | ||
if (e.message && e.message.indexOf('Illegal') !== -1) { | ||
return { | ||
@@ -543,3 +583,3 @@ relevance: 0, | ||
function highlightAuto(text, languageSubset) { | ||
languageSubset = languageSubset || options.languages || Object.keys(languages); | ||
languageSubset = languageSubset || options.languages || objectKeys(languages); | ||
var result = { | ||
@@ -575,11 +615,12 @@ relevance: 0, | ||
function fixMarkup(value) { | ||
if (options.tabReplace) { | ||
value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1 /*..., offset, s*/) { | ||
return p1.replace(/\t/g, options.tabReplace); | ||
return !(options.tabReplace || options.useBR) | ||
? value | ||
: value.replace(fixMarkupRe, function(match, p1) { | ||
if (options.useBR && match === '\n') { | ||
return '<br>'; | ||
} else if (options.tabReplace) { | ||
return p1.replace(/\t/g, options.tabReplace); | ||
} | ||
return ''; | ||
}); | ||
} | ||
if (options.useBR) { | ||
value = value.replace(/\n/g, '<br>'); | ||
} | ||
return value; | ||
} | ||
@@ -607,7 +648,8 @@ | ||
function highlightBlock(block) { | ||
var node, originalStream, result, resultNode, text; | ||
var language = blockLanguage(block); | ||
if (isNotHighlighted(language)) | ||
return; | ||
var node; | ||
if (options.useBR) { | ||
@@ -619,8 +661,8 @@ node = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | ||
} | ||
var text = node.textContent; | ||
var result = language ? highlight(language, text, true) : highlightAuto(text); | ||
text = node.textContent; | ||
result = language ? highlight(language, text, true) : highlightAuto(text); | ||
var originalStream = nodeStream(node); | ||
originalStream = nodeStream(node); | ||
if (originalStream.length) { | ||
var resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | ||
resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | ||
resultNode.innerHTML = result.value; | ||
@@ -645,9 +687,2 @@ result.value = mergeStreams(originalStream, nodeStream(resultNode), text); | ||
var options = { | ||
classPrefix: 'hljs-', | ||
tabReplace: null, | ||
useBR: false, | ||
languages: undefined | ||
}; | ||
/* | ||
@@ -669,3 +704,3 @@ Updates highlight.js global options with values passed in the form of an object. | ||
var blocks = document.querySelectorAll('pre code'); | ||
Array.prototype.forEach.call(blocks, highlightBlock); | ||
ArrayProto.forEach.call(blocks, highlightBlock); | ||
} | ||
@@ -681,5 +716,2 @@ | ||
var languages = {}; | ||
var aliases = {}; | ||
function registerLanguage(name, language) { | ||
@@ -693,3 +725,3 @@ var lang = languages[name] = language(hljs); | ||
function listLanguages() { | ||
return Object.keys(languages); | ||
return objectKeys(languages); | ||
} | ||
@@ -741,3 +773,3 @@ | ||
hljs.PHRASAL_WORDS_MODE = { | ||
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/ | ||
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ | ||
}; | ||
@@ -756,3 +788,3 @@ hljs.COMMENT = function (begin, end, inherits) { | ||
className: 'doctag', | ||
begin: "(?:TODO|FIXME|NOTE|BUG|XXX):", | ||
begin: '(?:TODO|FIXME|NOTE|BUG|XXX):', | ||
relevance: 0 | ||
@@ -827,24 +859,62 @@ }); | ||
module.exports = function(hljs) { | ||
var IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; | ||
var KEYWORDS = { | ||
keyword: | ||
'in of if for while finally var new function do return void else break catch ' + | ||
'instanceof with throw case default try this switch continue typeof delete ' + | ||
'let yield const export super debugger as async await static ' + | ||
// ECMAScript 6 modules import | ||
'import from as' | ||
, | ||
literal: | ||
'true false null undefined NaN Infinity', | ||
built_in: | ||
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' + | ||
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' + | ||
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' + | ||
'TypeError URIError Number Math Date String RegExp Array Float32Array ' + | ||
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' + | ||
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' + | ||
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' + | ||
'Promise' | ||
}; | ||
var EXPRESSIONS; | ||
var NUMBER = { | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0[bB][01]+)' }, | ||
{ begin: '\\b(0[oO][0-7]+)' }, | ||
{ begin: hljs.C_NUMBER_RE } | ||
], | ||
relevance: 0 | ||
}; | ||
var SUBST = { | ||
className: 'subst', | ||
begin: '\\$\\{', end: '\\}', | ||
keywords: KEYWORDS, | ||
contains: [] // defined later | ||
}; | ||
var TEMPLATE_STRING = { | ||
className: 'string', | ||
begin: '`', end: '`', | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE, | ||
SUBST | ||
] | ||
}; | ||
SUBST.contains = [ | ||
hljs.APOS_STRING_MODE, | ||
hljs.QUOTE_STRING_MODE, | ||
TEMPLATE_STRING, | ||
NUMBER, | ||
hljs.REGEXP_MODE | ||
] | ||
var PARAMS_CONTAINS = SUBST.contains.concat([ | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
hljs.C_LINE_COMMENT_MODE | ||
]); | ||
return { | ||
aliases: ['js', 'jsx'], | ||
keywords: { | ||
keyword: | ||
'in of if for while finally var new function do return void else break catch ' + | ||
'instanceof with throw case default try this switch continue typeof delete ' + | ||
'let yield const export super debugger as async await static ' + | ||
// ECMAScript 6 modules import | ||
'import from as' | ||
, | ||
literal: | ||
'true false null undefined NaN Infinity', | ||
built_in: | ||
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' + | ||
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' + | ||
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' + | ||
'TypeError URIError Number Math Date String RegExp Array Float32Array ' + | ||
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' + | ||
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' + | ||
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' + | ||
'Promise' | ||
}, | ||
keywords: KEYWORDS, | ||
contains: [ | ||
@@ -862,24 +932,16 @@ { | ||
hljs.QUOTE_STRING_MODE, | ||
{ // template string | ||
className: 'string', | ||
begin: '`', end: '`', | ||
TEMPLATE_STRING, | ||
hljs.C_LINE_COMMENT_MODE, | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
NUMBER, | ||
{ // object attr container | ||
begin: /[{,]\s*/, relevance: 0, | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE, | ||
{ | ||
className: 'subst', | ||
begin: '\\$\\{', end: '\\}' | ||
begin: IDENT_RE + '\\s*:', returnBegin: true, | ||
relevance: 0, | ||
contains: [{className: 'attr', begin: IDENT_RE, relevance: 0}] | ||
} | ||
] | ||
}, | ||
hljs.C_LINE_COMMENT_MODE, | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
{ | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0[bB][01]+)' }, | ||
{ begin: '\\b(0[oO][0-7]+)' }, | ||
{ begin: hljs.C_NUMBER_RE } | ||
], | ||
relevance: 0 | ||
}, | ||
{ // "value" container | ||
@@ -892,2 +954,26 @@ begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*', | ||
hljs.REGEXP_MODE, | ||
{ | ||
className: 'function', | ||
begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>', returnBegin: true, | ||
end: '\\s*=>', | ||
contains: [ | ||
{ | ||
className: 'params', | ||
variants: [ | ||
{ | ||
begin: IDENT_RE | ||
}, | ||
{ | ||
begin: /\(\s*\)/, | ||
}, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
excludeBegin: true, excludeEnd: true, | ||
keywords: KEYWORDS, | ||
contains: PARAMS_CONTAINS | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ // E4X / JSX | ||
@@ -898,3 +984,9 @@ begin: /</, end: /(\/\w+|\w+\/)>/, | ||
{begin: /<\w+\s*\/>/, skip: true}, | ||
{begin: /<\w+/, end: /(\/\w+|\w+\/)>/, skip: true, contains: ['self']} | ||
{ | ||
begin: /<\w+/, end: /(\/\w+|\w+\/)>/, skip: true, | ||
contains: [ | ||
{begin: /<\w+\s*\/>/, skip: true}, | ||
'self' | ||
] | ||
} | ||
] | ||
@@ -909,3 +1001,3 @@ } | ||
contains: [ | ||
hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][0-9A-Za-z$_]*/}), | ||
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}), | ||
{ | ||
@@ -916,6 +1008,3 @@ className: 'params', | ||
excludeEnd: true, | ||
contains: [ | ||
hljs.C_LINE_COMMENT_MODE, | ||
hljs.C_BLOCK_COMMENT_MODE | ||
] | ||
contains: PARAMS_CONTAINS | ||
} | ||
@@ -922,0 +1011,0 @@ ], |
@@ -10,4 +10,4 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// Find the global object for export to both the browser and web workers. | ||
var globalObject = typeof window == 'object' && window || | ||
typeof self == 'object' && self; | ||
var globalObject = typeof window === 'object' && window || | ||
typeof self === 'object' && self; | ||
@@ -32,7 +32,31 @@ // Setup highlight.js for different environments. First is Node.js or | ||
}(function(hljs) { | ||
// Convenience variables for build-in objects | ||
var ArrayProto = [], | ||
objectKeys = Object.keys; | ||
// Global internal variables used within the highlight.js library. | ||
var languages = {}, | ||
aliases = {}; | ||
// Regular expressions used throughout the highlight.js library. | ||
var noHighlightRe = /^(no-?highlight|plain|text)$/i, | ||
languagePrefixRe = /\blang(?:uage)?-([\w-]+)\b/i, | ||
fixMarkupRe = /((^(<[^>]+>|\t|)+|(?:\n)))/gm; | ||
var spanEndTag = '</span>'; | ||
// Global options used when within external APIs. This is modified when | ||
// calling the `hljs.configure` function. | ||
var options = { | ||
classPrefix: 'hljs-', | ||
tabReplace: null, | ||
useBR: false, | ||
languages: undefined | ||
}; | ||
/* Utility functions */ | ||
function escape(value) { | ||
return value.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>'); | ||
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); | ||
} | ||
@@ -46,12 +70,12 @@ | ||
var match = re && re.exec(lexeme); | ||
return match && match.index == 0; | ||
return match && match.index === 0; | ||
} | ||
function isNotHighlighted(language) { | ||
return (/^(no-?highlight|plain|text)$/i).test(language); | ||
return noHighlightRe.test(language); | ||
} | ||
function blockLanguage(block) { | ||
var i, match, length, | ||
classes = block.className + ' '; | ||
var i, match, length, _class; | ||
var classes = block.className + ' '; | ||
@@ -61,3 +85,3 @@ classes += block.parentNode ? block.parentNode.className : ''; | ||
// language-* takes precedence over non-prefixed class names. | ||
match = (/\blang(?:uage)?-([\w-]+)\b/i).exec(classes); | ||
match = languagePrefixRe.exec(classes); | ||
if (match) { | ||
@@ -68,5 +92,8 @@ return getLanguage(match[1]) ? match[1] : 'no-highlight'; | ||
classes = classes.split(/\s+/); | ||
for (i = 0, length = classes.length; i < length; i++) { | ||
if (getLanguage(classes[i]) || isNotHighlighted(classes[i])) { | ||
return classes[i]; | ||
_class = classes[i] | ||
if (isNotHighlighted(_class) || getLanguage(_class)) { | ||
return _class; | ||
} | ||
@@ -76,9 +103,13 @@ } | ||
function inherit(parent, obj) { | ||
var result = {}, key; | ||
function inherit(parent) { // inherit(parent, override_obj, override_obj, ...) | ||
var key; | ||
var result = {}; | ||
var objects = Array.prototype.slice.call(arguments, 1); | ||
for (key in parent) | ||
result[key] = parent[key]; | ||
if (obj) | ||
objects.forEach(function(obj) { | ||
for (key in obj) | ||
result[key] = obj[key]; | ||
}); | ||
return result; | ||
@@ -93,5 +124,5 @@ } | ||
for (var child = node.firstChild; child; child = child.nextSibling) { | ||
if (child.nodeType == 3) | ||
if (child.nodeType === 3) | ||
offset += child.nodeValue.length; | ||
else if (child.nodeType == 1) { | ||
else if (child.nodeType === 1) { | ||
result.push({ | ||
@@ -129,3 +160,3 @@ event: 'start', | ||
} | ||
if (original[0].offset != highlighted[0].offset) { | ||
if (original[0].offset !== highlighted[0].offset) { | ||
return (original[0].offset < highlighted[0].offset) ? original : highlighted; | ||
@@ -149,8 +180,8 @@ } | ||
*/ | ||
return highlighted[0].event == 'start' ? original : highlighted; | ||
return highlighted[0].event === 'start' ? original : highlighted; | ||
} | ||
function open(node) { | ||
function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"';} | ||
result += '<' + tag(node) + Array.prototype.map.call(node.attributes, attr_str).join('') + '>'; | ||
function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value).replace('"', '"') + '"';} | ||
result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>'; | ||
} | ||
@@ -163,3 +194,3 @@ | ||
function render(event) { | ||
(event.event == 'start' ? open : close)(event.node); | ||
(event.event === 'start' ? open : close)(event.node); | ||
} | ||
@@ -169,5 +200,5 @@ | ||
var stream = selectStream(); | ||
result += escape(value.substr(processed, stream[0].offset - processed)); | ||
result += escape(value.substring(processed, stream[0].offset)); | ||
processed = stream[0].offset; | ||
if (stream == original) { | ||
if (stream === original) { | ||
/* | ||
@@ -183,6 +214,6 @@ On any opening or closing tag of the original markup we first close | ||
stream = selectStream(); | ||
} while (stream == original && stream.length && stream[0].offset == processed); | ||
} while (stream === original && stream.length && stream[0].offset === processed); | ||
nodeStack.reverse().forEach(open); | ||
} else { | ||
if (stream[0].event == 'start') { | ||
if (stream[0].event === 'start') { | ||
nodeStack.push(stream[0].node); | ||
@@ -200,2 +231,11 @@ } else { | ||
function expand_mode(mode) { | ||
if (mode.variants && !mode.cached_variants) { | ||
mode.cached_variants = mode.variants.map(function(variant) { | ||
return inherit(mode, {variants: null}, variant); | ||
}); | ||
} | ||
return mode.cached_variants || (mode.endsWithParent && [inherit(mode)]) || [mode]; | ||
} | ||
function compileLanguage(language) { | ||
@@ -233,6 +273,6 @@ | ||
if (typeof mode.keywords == 'string') { // string | ||
if (typeof mode.keywords === 'string') { // string | ||
flatten('keyword', mode.keywords); | ||
} else { | ||
Object.keys(mode.keywords).forEach(function (className) { | ||
objectKeys(mode.keywords).forEach(function (className) { | ||
flatten(className, mode.keywords[className]); | ||
@@ -262,3 +302,3 @@ }); | ||
mode.illegalRe = langRe(mode.illegal); | ||
if (mode.relevance === undefined) | ||
if (mode.relevance == null) | ||
mode.relevance = 1; | ||
@@ -268,11 +308,5 @@ if (!mode.contains) { | ||
} | ||
var expanded_contains = []; | ||
mode.contains.forEach(function(c) { | ||
if (c.variants) { | ||
c.variants.forEach(function(v) {expanded_contains.push(inherit(c, v));}); | ||
} else { | ||
expanded_contains.push(c == 'self' ? mode : c); | ||
} | ||
}); | ||
mode.contains = expanded_contains; | ||
mode.contains = Array.prototype.concat.apply([], mode.contains.map(function(c) { | ||
return expand_mode(c === 'self' ? mode : c) | ||
})); | ||
mode.contains.forEach(function(c) {compileMode(c, mode);}); | ||
@@ -309,3 +343,5 @@ | ||
function subMode(lexeme, mode) { | ||
for (var i = 0; i < mode.contains.length; i++) { | ||
var i, length; | ||
for (i = 0, length = mode.contains.length; i < length; i++) { | ||
if (testRe(mode.contains[i].beginRe, lexeme)) { | ||
@@ -341,3 +377,3 @@ return mode.contains[i]; | ||
openSpan = '<span class="' + classPrefix, | ||
closeSpan = leaveOpen ? '' : '</span>'; | ||
closeSpan = leaveOpen ? '' : spanEndTag | ||
@@ -350,11 +386,15 @@ openSpan += classname + '">'; | ||
function processKeywords() { | ||
var keyword_match, last_index, match, result; | ||
if (!top.keywords) | ||
return escape(mode_buffer); | ||
var result = ''; | ||
var last_index = 0; | ||
result = ''; | ||
last_index = 0; | ||
top.lexemesRe.lastIndex = 0; | ||
var match = top.lexemesRe.exec(mode_buffer); | ||
match = top.lexemesRe.exec(mode_buffer); | ||
while (match) { | ||
result += escape(mode_buffer.substr(last_index, match.index - last_index)); | ||
var keyword_match = keywordMatch(top, match); | ||
result += escape(mode_buffer.substring(last_index, match.index)); | ||
keyword_match = keywordMatch(top, match); | ||
if (keyword_match) { | ||
@@ -373,3 +413,3 @@ relevance += keyword_match[1]; | ||
function processSubLanguage() { | ||
var explicit = typeof top.subLanguage == 'string'; | ||
var explicit = typeof top.subLanguage === 'string'; | ||
if (explicit && !languages[top.subLanguage]) { | ||
@@ -397,7 +437,7 @@ return escape(mode_buffer); | ||
function processBuffer() { | ||
result += (top.subLanguage !== undefined ? processSubLanguage() : processKeywords()); | ||
result += (top.subLanguage != null ? processSubLanguage() : processKeywords()); | ||
mode_buffer = ''; | ||
} | ||
function startNewMode(mode, lexeme) { | ||
function startNewMode(mode) { | ||
result += mode.className? buildSpan(mode.className, '', true): ''; | ||
@@ -411,3 +451,3 @@ top = Object.create(mode, {parent: {value: top}}); | ||
if (lexeme === undefined) { | ||
if (lexeme == null) { | ||
processBuffer(); | ||
@@ -450,3 +490,3 @@ return 0; | ||
if (top.className) { | ||
result += '</span>'; | ||
result += spanEndTag; | ||
} | ||
@@ -457,3 +497,3 @@ if (!top.skip) { | ||
top = top.parent; | ||
} while (top != end_mode.parent); | ||
} while (top !== end_mode.parent); | ||
if (end_mode.starts) { | ||
@@ -486,3 +526,3 @@ startNewMode(end_mode.starts, ''); | ||
var result = '', current; | ||
for(current = top; current != language; current = current.parent) { | ||
for(current = top; current !== language; current = current.parent) { | ||
if (current.className) { | ||
@@ -501,3 +541,3 @@ result = buildSpan(current.className, '', true) + result; | ||
break; | ||
count = processLexeme(value.substr(index, match.index - index), match[0]); | ||
count = processLexeme(value.substring(index, match.index), match[0]); | ||
index = match.index + count; | ||
@@ -508,3 +548,3 @@ } | ||
if (current.className) { | ||
result += '</span>'; | ||
result += spanEndTag; | ||
} | ||
@@ -519,3 +559,3 @@ } | ||
} catch (e) { | ||
if (e.message.indexOf('Illegal') != -1) { | ||
if (e.message && e.message.indexOf('Illegal') !== -1) { | ||
return { | ||
@@ -543,3 +583,3 @@ relevance: 0, | ||
function highlightAuto(text, languageSubset) { | ||
languageSubset = languageSubset || options.languages || Object.keys(languages); | ||
languageSubset = languageSubset || options.languages || objectKeys(languages); | ||
var result = { | ||
@@ -575,11 +615,12 @@ relevance: 0, | ||
function fixMarkup(value) { | ||
if (options.tabReplace) { | ||
value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1 /*..., offset, s*/) { | ||
return p1.replace(/\t/g, options.tabReplace); | ||
return !(options.tabReplace || options.useBR) | ||
? value | ||
: value.replace(fixMarkupRe, function(match, p1) { | ||
if (options.useBR && match === '\n') { | ||
return '<br>'; | ||
} else if (options.tabReplace) { | ||
return p1.replace(/\t/g, options.tabReplace); | ||
} | ||
return ''; | ||
}); | ||
} | ||
if (options.useBR) { | ||
value = value.replace(/\n/g, '<br>'); | ||
} | ||
return value; | ||
} | ||
@@ -607,7 +648,8 @@ | ||
function highlightBlock(block) { | ||
var node, originalStream, result, resultNode, text; | ||
var language = blockLanguage(block); | ||
if (isNotHighlighted(language)) | ||
return; | ||
var node; | ||
if (options.useBR) { | ||
@@ -619,8 +661,8 @@ node = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | ||
} | ||
var text = node.textContent; | ||
var result = language ? highlight(language, text, true) : highlightAuto(text); | ||
text = node.textContent; | ||
result = language ? highlight(language, text, true) : highlightAuto(text); | ||
var originalStream = nodeStream(node); | ||
originalStream = nodeStream(node); | ||
if (originalStream.length) { | ||
var resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | ||
resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | ||
resultNode.innerHTML = result.value; | ||
@@ -645,9 +687,2 @@ result.value = mergeStreams(originalStream, nodeStream(resultNode), text); | ||
var options = { | ||
classPrefix: 'hljs-', | ||
tabReplace: null, | ||
useBR: false, | ||
languages: undefined | ||
}; | ||
/* | ||
@@ -669,3 +704,3 @@ Updates highlight.js global options with values passed in the form of an object. | ||
var blocks = document.querySelectorAll('pre code'); | ||
Array.prototype.forEach.call(blocks, highlightBlock); | ||
ArrayProto.forEach.call(blocks, highlightBlock); | ||
} | ||
@@ -681,5 +716,2 @@ | ||
var languages = {}; | ||
var aliases = {}; | ||
function registerLanguage(name, language) { | ||
@@ -693,3 +725,3 @@ var lang = languages[name] = language(hljs); | ||
function listLanguages() { | ||
return Object.keys(languages); | ||
return objectKeys(languages); | ||
} | ||
@@ -741,3 +773,3 @@ | ||
hljs.PHRASAL_WORDS_MODE = { | ||
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/ | ||
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ | ||
}; | ||
@@ -756,3 +788,3 @@ hljs.COMMENT = function (begin, end, inherits) { | ||
className: 'doctag', | ||
begin: "(?:TODO|FIXME|NOTE|BUG|XXX):", | ||
begin: '(?:TODO|FIXME|NOTE|BUG|XXX):', | ||
relevance: 0 | ||
@@ -827,24 +859,62 @@ }); | ||
module.exports = function(hljs) { | ||
var IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; | ||
var KEYWORDS = { | ||
keyword: | ||
'in of if for while finally var new function do return void else break catch ' + | ||
'instanceof with throw case default try this switch continue typeof delete ' + | ||
'let yield const export super debugger as async await static ' + | ||
// ECMAScript 6 modules import | ||
'import from as' | ||
, | ||
literal: | ||
'true false null undefined NaN Infinity', | ||
built_in: | ||
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' + | ||
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' + | ||
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' + | ||
'TypeError URIError Number Math Date String RegExp Array Float32Array ' + | ||
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' + | ||
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' + | ||
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' + | ||
'Promise' | ||
}; | ||
var EXPRESSIONS; | ||
var NUMBER = { | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0[bB][01]+)' }, | ||
{ begin: '\\b(0[oO][0-7]+)' }, | ||
{ begin: hljs.C_NUMBER_RE } | ||
], | ||
relevance: 0 | ||
}; | ||
var SUBST = { | ||
className: 'subst', | ||
begin: '\\$\\{', end: '\\}', | ||
keywords: KEYWORDS, | ||
contains: [] // defined later | ||
}; | ||
var TEMPLATE_STRING = { | ||
className: 'string', | ||
begin: '`', end: '`', | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE, | ||
SUBST | ||
] | ||
}; | ||
SUBST.contains = [ | ||
hljs.APOS_STRING_MODE, | ||
hljs.QUOTE_STRING_MODE, | ||
TEMPLATE_STRING, | ||
NUMBER, | ||
hljs.REGEXP_MODE | ||
] | ||
var PARAMS_CONTAINS = SUBST.contains.concat([ | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
hljs.C_LINE_COMMENT_MODE | ||
]); | ||
return { | ||
aliases: ['js', 'jsx'], | ||
keywords: { | ||
keyword: | ||
'in of if for while finally var new function do return void else break catch ' + | ||
'instanceof with throw case default try this switch continue typeof delete ' + | ||
'let yield const export super debugger as async await static ' + | ||
// ECMAScript 6 modules import | ||
'import from as' | ||
, | ||
literal: | ||
'true false null undefined NaN Infinity', | ||
built_in: | ||
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' + | ||
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' + | ||
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' + | ||
'TypeError URIError Number Math Date String RegExp Array Float32Array ' + | ||
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' + | ||
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' + | ||
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' + | ||
'Promise' | ||
}, | ||
keywords: KEYWORDS, | ||
contains: [ | ||
@@ -862,24 +932,16 @@ { | ||
hljs.QUOTE_STRING_MODE, | ||
{ // template string | ||
className: 'string', | ||
begin: '`', end: '`', | ||
TEMPLATE_STRING, | ||
hljs.C_LINE_COMMENT_MODE, | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
NUMBER, | ||
{ // object attr container | ||
begin: /[{,]\s*/, relevance: 0, | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE, | ||
{ | ||
className: 'subst', | ||
begin: '\\$\\{', end: '\\}' | ||
begin: IDENT_RE + '\\s*:', returnBegin: true, | ||
relevance: 0, | ||
contains: [{className: 'attr', begin: IDENT_RE, relevance: 0}] | ||
} | ||
] | ||
}, | ||
hljs.C_LINE_COMMENT_MODE, | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
{ | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0[bB][01]+)' }, | ||
{ begin: '\\b(0[oO][0-7]+)' }, | ||
{ begin: hljs.C_NUMBER_RE } | ||
], | ||
relevance: 0 | ||
}, | ||
{ // "value" container | ||
@@ -892,2 +954,26 @@ begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*', | ||
hljs.REGEXP_MODE, | ||
{ | ||
className: 'function', | ||
begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>', returnBegin: true, | ||
end: '\\s*=>', | ||
contains: [ | ||
{ | ||
className: 'params', | ||
variants: [ | ||
{ | ||
begin: IDENT_RE | ||
}, | ||
{ | ||
begin: /\(\s*\)/, | ||
}, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
excludeBegin: true, excludeEnd: true, | ||
keywords: KEYWORDS, | ||
contains: PARAMS_CONTAINS | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ // E4X / JSX | ||
@@ -898,3 +984,9 @@ begin: /</, end: /(\/\w+|\w+\/)>/, | ||
{begin: /<\w+\s*\/>/, skip: true}, | ||
{begin: /<\w+/, end: /(\/\w+|\w+\/)>/, skip: true, contains: ['self']} | ||
{ | ||
begin: /<\w+/, end: /(\/\w+|\w+\/)>/, skip: true, | ||
contains: [ | ||
{begin: /<\w+\s*\/>/, skip: true}, | ||
'self' | ||
] | ||
} | ||
] | ||
@@ -909,3 +1001,3 @@ } | ||
contains: [ | ||
hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][0-9A-Za-z$_]*/}), | ||
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}), | ||
{ | ||
@@ -916,6 +1008,3 @@ className: 'params', | ||
excludeEnd: true, | ||
contains: [ | ||
hljs.C_LINE_COMMENT_MODE, | ||
hljs.C_BLOCK_COMMENT_MODE | ||
] | ||
contains: PARAMS_CONTAINS | ||
} | ||
@@ -922,0 +1011,0 @@ ], |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -22,7 +23,5 @@ * Represents a handlebars result context | ||
} | ||
; | ||
return HandlebarsModel; | ||
}()); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = HandlebarsModel; | ||
//# sourceMappingURL=HandlebarsModel.js.map |
"use strict"; | ||
var SourceFileTreeNode_1 = require('./SourceFileTreeNode'); | ||
var path = require('path'); | ||
var log4js = require('log4js'); | ||
var util = require('./util'); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var SourceFileTreeNode_1 = require("./SourceFileTreeNode"); | ||
var path = require("path"); | ||
var log4js = require("log4js"); | ||
var util = require("./util"); | ||
var fileUrl = require("file-url"); | ||
var log = log4js.getLogger('HtmlReporter'); | ||
@@ -32,7 +34,7 @@ var DEFAULT_BASE_FOLDER = 'reports/mutation/html'; | ||
var resourcesDir = path.join(__dirname, '..', 'resources'); | ||
return util.copyFolder(resourcesDir, this.baseFolder); | ||
return util.copyFolder(resourcesDir, this.baseDir); | ||
}; | ||
HtmlReporter.prototype.writeStrykerResources = function () { | ||
var resourcesDir = path.join(__dirname, 'resources', 'stryker'); | ||
return util.copyFolder(resourcesDir, this.baseFolder); | ||
return util.copyFolder(resourcesDir, this.baseDir); | ||
}; | ||
@@ -44,17 +46,18 @@ HtmlReporter.prototype.writeCommonResources = function () { | ||
this.rootNode.calculateModel(''); | ||
this.rootNode.writeReportNodeRecursive(this.baseFolder); | ||
this.rootNode.writeReportNodeRecursive(this.baseDir); | ||
log.info("Your report can be found at: " + fileUrl(path.resolve(this.baseDir, 'index.html'))); | ||
}; | ||
Object.defineProperty(HtmlReporter.prototype, "baseFolder", { | ||
Object.defineProperty(HtmlReporter.prototype, "baseDir", { | ||
get: function () { | ||
if (!this._baseFolder) { | ||
if (!this._baseDir) { | ||
if (this.options['htmlReporter'] && this.options['htmlReporter']['baseDir']) { | ||
this._baseFolder = this.options['htmlReporter']['baseDir']; | ||
log.debug("Using configured output folder " + this._baseFolder); | ||
this._baseDir = this.options['htmlReporter']['baseDir']; | ||
log.debug("Using configured output folder " + this._baseDir); | ||
} | ||
else { | ||
log.debug("No base folder configuration found (using configuration: htmlReporter: { baseDir: 'output/folder' }), using default " + DEFAULT_BASE_FOLDER); | ||
this._baseFolder = DEFAULT_BASE_FOLDER; | ||
this._baseDir = DEFAULT_BASE_FOLDER; | ||
} | ||
} | ||
return this._baseFolder; | ||
return this._baseDir; | ||
}, | ||
@@ -66,3 +69,3 @@ enumerable: true, | ||
var _this = this; | ||
return util.deleteDir(this.baseFolder).then(function () { return util.mkdirRecursive(_this.baseFolder); }); | ||
return util.deleteDir(this.baseDir).then(function () { return util.mkdirRecursive(_this.baseDir); }); | ||
}; | ||
@@ -74,4 +77,3 @@ HtmlReporter.prototype.wrapUp = function () { | ||
}()); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = HtmlReporter; | ||
//# sourceMappingURL=HtmlReporter.js.map |
@@ -0,0 +0,0 @@ 'use strict'; |
"use strict"; | ||
var report_1 = require('stryker-api/report'); | ||
var HandlebarsModel_1 = require('./HandlebarsModel'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var util = require('./util'); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var report_1 = require("stryker-api/report"); | ||
var HandlebarsModel_1 = require("./HandlebarsModel"); | ||
var path = require("path"); | ||
var fs = require("fs"); | ||
var util = require("./util"); | ||
var SourceFileTreeLeaf = (function () { | ||
@@ -41,7 +42,5 @@ function SourceFileTreeLeaf(file, results) { | ||
}; | ||
; | ||
return SourceFileTreeLeaf; | ||
}()); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = SourceFileTreeLeaf; | ||
//# sourceMappingURL=SourceFileTreeLeaf.js.map |
"use strict"; | ||
var report_1 = require('stryker-api/report'); | ||
var log4js = require('log4js'); | ||
var path = require('path'); | ||
var util = require('./util'); | ||
var fs = require('fs'); | ||
var HandlebarsModel_1 = require('./HandlebarsModel'); | ||
var SourceFileTreeLeaf_1 = require('./SourceFileTreeLeaf'); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var report_1 = require("stryker-api/report"); | ||
var log4js = require("log4js"); | ||
var path = require("path"); | ||
var util = require("./util"); | ||
var fs = require("fs"); | ||
var HandlebarsModel_1 = require("./HandlebarsModel"); | ||
var SourceFileTreeLeaf_1 = require("./SourceFileTreeLeaf"); | ||
var log = log4js.getLogger('HtmlReporter'); | ||
@@ -142,4 +143,3 @@ /** | ||
}()); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = SourceFileTreeNode; | ||
//# sourceMappingURL=SourceFileTreeNode.js.map |
"use strict"; | ||
var mzfs = require('mz/fs'); | ||
var path = require('path'); | ||
var handlebars = require('handlebars'); | ||
var _ = require('lodash'); | ||
var mkdirp = require('mkdirp'); | ||
var report_1 = require('stryker-api/report'); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var mzfs = require("mz/fs"); | ||
var path = require("path"); | ||
var handlebars = require("handlebars"); | ||
var _ = require("lodash"); | ||
var mkdirp = require("mkdirp"); | ||
var report_1 = require("stryker-api/report"); | ||
function copyFolder(fromPath, to) { | ||
return mkdirRecursive(to).then(function () { return mzfs.readdir(fromPath).then(function (files) { | ||
var promisses = []; | ||
var promises = []; | ||
files.forEach(function (file) { | ||
var currentPath = path.join(fromPath, file); | ||
var toCurrentPath = path.join(to, file); | ||
promisses.push(mzfs.stat(currentPath).then(function (stats) { | ||
promises.push(mzfs.stat(currentPath).then(function (stats) { | ||
if (stats.isDirectory()) { | ||
@@ -23,3 +24,3 @@ return copyFolder(currentPath, toCurrentPath); | ||
}); | ||
return Promise.all(promisses); | ||
return Promise.all(promises); | ||
}); }); | ||
@@ -46,3 +47,3 @@ } | ||
return mzfs.readdir(dirToDelete).then(function (files) { | ||
var promisses = files.map(function (file) { | ||
var promises = files.map(function (file) { | ||
var currentPath = path.join(dirToDelete, file); | ||
@@ -61,3 +62,3 @@ return mzfs.stat(currentPath).then(function (stats) { | ||
// delete dir | ||
return Promise.all(promisses).then(function () { return mzfs.rmdir(dirToDelete); }); | ||
return Promise.all(promises).then(function () { return mzfs.rmdir(dirToDelete); }); | ||
}); | ||
@@ -109,3 +110,3 @@ } | ||
var currentBackground = null; | ||
var currentCursorMutantStatusses = { | ||
var currentCursorMutantStatuses = { | ||
killed: 0, | ||
@@ -122,12 +123,12 @@ survived: 0, | ||
case report_1.MutantStatus.Killed: | ||
currentCursorMutantStatusses.killed += valueToAdd; | ||
currentCursorMutantStatuses.killed += valueToAdd; | ||
break; | ||
case report_1.MutantStatus.Survived: | ||
currentCursorMutantStatusses.survived += valueToAdd; | ||
currentCursorMutantStatuses.survived += valueToAdd; | ||
break; | ||
case report_1.MutantStatus.TimedOut: | ||
currentCursorMutantStatusses.timeout += valueToAdd; | ||
currentCursorMutantStatuses.timeout += valueToAdd; | ||
break; | ||
case report_1.MutantStatus.NoCoverage: | ||
currentCursorMutantStatusses.noCoverage += valueToAdd; | ||
currentCursorMutantStatuses.noCoverage += valueToAdd; | ||
break; | ||
@@ -137,12 +138,12 @@ } | ||
var determineBackground = function () { | ||
if (currentCursorMutantStatusses.survived > 0) { | ||
if (currentCursorMutantStatuses.survived > 0) { | ||
return getContextClassForStatus(report_1.MutantStatus.Survived); | ||
} | ||
else if (currentCursorMutantStatusses.noCoverage > 0) { | ||
else if (currentCursorMutantStatuses.noCoverage > 0) { | ||
return getContextClassForStatus(report_1.MutantStatus.NoCoverage); | ||
} | ||
else if (currentCursorMutantStatusses.timeout > 0) { | ||
else if (currentCursorMutantStatuses.timeout > 0) { | ||
return getContextClassForStatus(report_1.MutantStatus.TimedOut); | ||
} | ||
else if (currentCursorMutantStatusses.killed > 0) { | ||
else if (currentCursorMutantStatuses.killed > 0) { | ||
return getContextClassForStatus(report_1.MutantStatus.Killed); | ||
@@ -160,3 +161,3 @@ } | ||
var mutantsAnnotations = mutantsStarting.map(function (m) { | ||
return ("<a href=\"#\" class=\"stryker-mutant-button\" data-mutant-status-annotation=\"" + getContextClassForStatus(m.mutant.status) + "\" data-mutant=\"" + m.index + "\">") + | ||
return "<a href=\"#\" class=\"stryker-mutant-button\" data-mutant-status-annotation=\"" + getContextClassForStatus(m.mutant.status) + "\" data-mutant=\"" + m.index + "\">" + | ||
("<span class=\"label label-" + getContextClassForStatus(m.mutant.status) + "\">" + m.index + "</span>") + | ||
@@ -166,5 +167,5 @@ "</a>" | ||
}); | ||
var originalCodeStartAnnotations = mutantsStarting.map(function (m) { return ("<span class=\"stryker-original-code\" data-mutant=\"" + m.index + "\">"); }); | ||
var originalCodeStartAnnotations = mutantsStarting.map(function (m) { return "<span class=\"stryker-original-code\" data-mutant=\"" + m.index + "\">"; }); | ||
var originalCodeEndAnnotations = mutantsEnding.map(function (m) { return '</span>'; }); | ||
var mutantReplacements = mutantsEnding.map(function (m) { return ("<span class=\"label label-info stryker-mutant-replacement\" hidden data-mutant=\"" + m.index + "\">" + escape(m.mutant.replacement) + "</span>"); }); | ||
var mutantReplacements = mutantsEnding.map(function (m) { return "<span class=\"label label-info stryker-mutant-replacement\" hidden data-mutant=\"" + m.index + "\">" + escape(m.mutant.replacement) + "</span>"; }); | ||
return "" + backgroundColorEndAnnotation + originalCodeEndAnnotations.join('') + mutantsAnnotations.join('') + originalCodeStartAnnotations.join('') + backgroundColorAnnotation + escape(char); | ||
@@ -171,0 +172,0 @@ }; |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6
9
2304353
7
108
33511
2
1
+ Addedfile-url@^2.0.0
+ Addedfile-url@2.0.2(transitive)