Sorry, the diff of this file is too big to display
| {"uuid":"908fa24f-6b19-4376-86a3-16c4b113b338","parent":"fdcf62c0-6142-4f09-921e-3a9758008b9c","pid":55554,"argv":["/Users/alex/.nvm/versions/node/v8.16.2/bin/node","/Users/alex/Documents/projects/magicpen/node_modules/.bin/mocha"],"execArgv":[],"cwd":"/Users/alex/Documents/projects/magicpen","time":1576448259377,"ppid":55553,"root":"6197f830-3f12-4953-8032-94fb3137b85a","coverageFilename":"/Users/alex/Documents/projects/magicpen/.nyc_output/908fa24f-6b19-4376-86a3-16c4b113b338.json","files":["/Users/alex/Documents/projects/magicpen/lib/MagicPen.js","/Users/alex/Documents/projects/magicpen/lib/utils.js","/Users/alex/Documents/projects/magicpen/lib/duplicateText.js","/Users/alex/Documents/projects/magicpen/lib/rgbRegexp.js","/Users/alex/Documents/projects/magicpen/lib/cssStyles.js","/Users/alex/Documents/projects/magicpen/lib/supportsColor.js","/Users/alex/Documents/projects/magicpen/lib/platform.js","/Users/alex/Documents/projects/magicpen/lib/TextSerializer.js","/Users/alex/Documents/projects/magicpen/lib/flattenBlocksInLines.js","/Users/alex/Documents/projects/magicpen/lib/HtmlSerializer.js","/Users/alex/Documents/projects/magicpen/lib/themeMapper.js","/Users/alex/Documents/projects/magicpen/lib/AnsiSerializer.js","/Users/alex/Documents/projects/magicpen/lib/ColoredConsoleSerializer.js"]} |
| {"uuid":"fdcf62c0-6142-4f09-921e-3a9758008b9c","parent":null,"pid":55553,"argv":["/Users/alex/.nvm/versions/node/v8.16.2/bin/node","/Users/alex/.nvm/versions/node/v8.16.2/bin/npm","run","test-node"],"execArgv":[],"cwd":"/Users/alex/Documents/projects/magicpen","time":1576448258859,"ppid":55552,"root":"6197f830-3f12-4953-8032-94fb3137b85a","coverageFilename":"/Users/alex/Documents/projects/magicpen/.nyc_output/fdcf62c0-6142-4f09-921e-3a9758008b9c.json","files":[]} |
| {"processes":{"908fa24f-6b19-4376-86a3-16c4b113b338":{"parent":"fdcf62c0-6142-4f09-921e-3a9758008b9c","children":[]},"fdcf62c0-6142-4f09-921e-3a9758008b9c":{"parent":null,"children":["908fa24f-6b19-4376-86a3-16c4b113b338"]}},"files":{"/Users/alex/Documents/projects/magicpen/lib/MagicPen.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/utils.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/duplicateText.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/rgbRegexp.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/cssStyles.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/supportsColor.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/platform.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/TextSerializer.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/flattenBlocksInLines.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/HtmlSerializer.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/themeMapper.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/AnsiSerializer.js":["908fa24f-6b19-4376-86a3-16c4b113b338"],"/Users/alex/Documents/projects/magicpen/lib/ColoredConsoleSerializer.js":["908fa24f-6b19-4376-86a3-16c4b113b338"]},"externalIds":{}} |
@@ -15,5 +15,3 @@ var utils = require('./utils'); | ||
| function AnsiSerializer(theme) { | ||
| this.theme = theme; | ||
| } | ||
| function AnsiSerializer() {} | ||
@@ -97,3 +95,3 @@ AnsiSerializer.prototype = new TextSerializer(); | ||
| AnsiSerializer.prototype.text = function (options) { | ||
| AnsiSerializer.prototype.text = function (options, themes) { | ||
| var content = String(options.content); | ||
@@ -104,3 +102,3 @@ if (content === '') { | ||
| var styles = themeMapper(this.theme, options.styles); | ||
| var styles = themeMapper(themes.ansi || {}, options.styles); | ||
@@ -107,0 +105,0 @@ if (styles.length > 0) { |
@@ -6,5 +6,3 @@ var cssStyles = require('./cssStyles'); | ||
| function ColoredConsoleSerializer(theme) { | ||
| this.theme = theme; | ||
| } | ||
| function ColoredConsoleSerializer() {} | ||
@@ -42,3 +40,3 @@ ColoredConsoleSerializer.prototype.format = 'coloredConsole'; | ||
| if (this[outputEntry.style]) { | ||
| result.push(this[outputEntry.style](outputEntry.args)); | ||
| result.push(this[outputEntry.style](outputEntry.args, outputEntry.themes)); | ||
| } | ||
@@ -53,3 +51,3 @@ }, this); | ||
| ColoredConsoleSerializer.prototype.text = function (options) { | ||
| ColoredConsoleSerializer.prototype.text = function (options, themes) { | ||
| var content = String(options.content); | ||
@@ -60,3 +58,3 @@ if (content === '') { | ||
| var styles = themeMapper(this.theme, options.styles); | ||
| var styles = themeMapper(themes.coloredConsole || {}, options.styles); | ||
@@ -63,0 +61,0 @@ var result = ['%c' + content.replace(/%/g, '%%')]; |
| var utils = require('./utils'); | ||
| var duplicateText = require('./duplicateText'); | ||
| function createPadding(length) { | ||
| return { style: 'text', args: { content: duplicateText(' ', length), styles: [] } }; | ||
| function createPadding(length, themes) { | ||
| return { | ||
| style: 'text', | ||
| args: { | ||
| content: duplicateText(' ', length), | ||
| styles: [] | ||
| }, | ||
| themes: themes | ||
| }; | ||
| } | ||
@@ -23,3 +30,3 @@ | ||
| var args = { content: line, styles: outputEntry.args.styles }; | ||
| return [{ style: 'text', args: args }]; | ||
| return [{ style: 'text', args: args, themes: outputEntry.themes }]; | ||
| }); | ||
@@ -63,3 +70,3 @@ case 'block': return flattenBlocksInLines(outputEntry.args); | ||
| var paddingLength = startIndex - linesLengths[index]; | ||
| resultLine.push(createPadding(paddingLength)); | ||
| resultLine.push(createPadding(paddingLength, outputEntry.themes)); | ||
| Array.prototype.push.apply(resultLine, blockLine); | ||
@@ -66,0 +73,0 @@ linesLengths[index] = startIndex + blockLinesLengths[index]; |
@@ -5,5 +5,3 @@ var cssStyles = require('./cssStyles'); | ||
| function HtmlSerializer(theme) { | ||
| this.theme = theme; | ||
| } | ||
| function HtmlSerializer() {} | ||
@@ -25,3 +23,3 @@ HtmlSerializer.prototype.format = 'html'; | ||
| return this[outputEntry.style] ? | ||
| this[outputEntry.style](outputEntry.args) : | ||
| this[outputEntry.style](outputEntry.args, outputEntry.themes) : | ||
| ''; | ||
@@ -37,3 +35,3 @@ }, this); | ||
| HtmlSerializer.prototype.text = function (options) { | ||
| HtmlSerializer.prototype.text = function (options, themes) { | ||
| var content = String(options.content); | ||
@@ -52,5 +50,4 @@ | ||
| var styles = themeMapper(themes.html || {}, options.styles); | ||
| var styles = themeMapper(this.theme, options.styles); | ||
| if (styles.length > 0) { | ||
@@ -57,0 +54,0 @@ var styleProperties = []; |
+32
-22
@@ -47,3 +47,3 @@ /*global window*/ | ||
| if (typeof exports === 'object' && typeof exports.nodeName !== 'string' && require('./supportsColor').stdout) { | ||
| MagicPen.defaultFormat = 'ansi'; // colored console | ||
| MagicPen.defaultFormat = 'ansi'; | ||
| } else if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { | ||
@@ -89,3 +89,3 @@ if (window._phantom || window.mochaPhantomJS || (window.__karma__ && window.__karma__.config.captureConsole)) { | ||
| return utils.arrayEquals(a.args.styles, b.args.styles); | ||
| return utils.arrayEquals(a.args.styles, b.args.styles) && a.themes === b.themes; | ||
| } | ||
@@ -105,3 +105,2 @@ | ||
| } | ||
| if (hasSameTextStyling(lastEntry, entry)) { | ||
@@ -113,3 +112,4 @@ result[result.length - 1] = { | ||
| styles: lastEntry.args.styles | ||
| } | ||
| }, | ||
| themes: lastEntry.themes | ||
| }; | ||
@@ -137,3 +137,4 @@ } else { | ||
| styles: lastEntry.args.styles | ||
| } | ||
| }, | ||
| themes: this._themes | ||
| }; | ||
@@ -201,3 +202,3 @@ } else { | ||
| var theme = this._themes[format] || {}; | ||
| var serializer = new MagicPen.serializers[format](theme); | ||
| var serializer = new MagicPen.serializers[format](); | ||
| return serializer.serialize(this.output); | ||
@@ -224,3 +225,4 @@ }; | ||
| style: 'text', | ||
| args: { content: lineContent, styles: styles } | ||
| args: { content: lineContent, styles: styles }, | ||
| themes: this._themes | ||
| }); | ||
@@ -236,3 +238,4 @@ } | ||
| style: 'text', | ||
| args: { content: content, styles: styles } | ||
| args: { content: content, styles: styles }, | ||
| themes: this._themes | ||
| }); | ||
@@ -247,3 +250,3 @@ } | ||
| return outputEntry.style === 'text' ? | ||
| { style: 'text', args: { content: outputEntry.args.content, styles: [] } } : | ||
| { style: 'text', args: { content: outputEntry.args.content, styles: [] }, themes: outputEntry.themes } : | ||
| outputEntry; | ||
@@ -308,4 +311,5 @@ })); | ||
| }); | ||
| return this.write({ style: 'block', args: blockOutput }); | ||
| return this.write({ style: 'block', args: blockOutput, themes: this._themes }); | ||
| }; | ||
| function isRawOutput(options) { | ||
@@ -324,3 +328,3 @@ return options && | ||
| if (!format) { | ||
| throw new Error('The alt method is only supported on pen where the format has already been set'); | ||
| throw new Error('The alt method is only supported on a pen where the format has already been set'); | ||
| } | ||
@@ -349,13 +353,17 @@ | ||
| if (!format) { | ||
| throw new Error('The alt method is only supported on pen where the format has already been set'); | ||
| throw new Error('The raw method is only supported on a pen where the format has already been set'); | ||
| } | ||
| if (typeof options === 'string') { | ||
| return this.write({ style: 'raw', args: { | ||
| height: 0, | ||
| width: 0, | ||
| content: function () { | ||
| return options; | ||
| } | ||
| }}); | ||
| return this.write({ | ||
| style: 'raw', | ||
| args: { | ||
| height: 0, | ||
| width: 0, | ||
| content: function () { | ||
| return options; | ||
| } | ||
| }, | ||
| themes: this._themes | ||
| }); | ||
| } | ||
@@ -372,3 +380,3 @@ | ||
| return this.write({ style: 'raw', args: options }); | ||
| return this.write({ style: 'raw', args: options, themes: this._themes }); | ||
| } | ||
@@ -389,3 +397,4 @@ | ||
| style: 'block', | ||
| args: amend(lastEntry.args, pen) | ||
| args: amend(lastEntry.args, pen), | ||
| themes: pen._themes | ||
| }; | ||
@@ -588,3 +597,4 @@ newOutput[output.length - 1] = lastLine; | ||
| style: 'block', | ||
| args: replaceText(output.clone(), outputEntry.args, regexp, cb) | ||
| args: replaceText(output.clone(), outputEntry.args, regexp, cb), | ||
| themes: outputEntry.themes | ||
| }); | ||
@@ -591,0 +601,0 @@ } else if (outputEntry.style !== 'text') { |
@@ -15,3 +15,3 @@ var flattenBlocksInLines = require('./flattenBlocksInLines'); | ||
| return this[outputEntry.style] ? | ||
| String(this[outputEntry.style](outputEntry.args)) : | ||
| String(this[outputEntry.style](outputEntry.args, outputEntry.themes)) : | ||
| ''; | ||
@@ -18,0 +18,0 @@ }, this).join(''); |
+1
-1
| { | ||
| "name": "magicpen", | ||
| "version": "6.2.0", | ||
| "version": "6.2.1", | ||
| "description": "Styled output in both consoles and browsers", | ||
@@ -5,0 +5,0 @@ "main": "./lib/MagicPen.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed 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
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
515905
41.55%29
20.83%5210
0.64%32
-3.03%