Socket
Socket
Sign inDemoInstall

@microsoft/node-core-library

Package Overview
Dependencies
Maintainers
2
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/node-core-library - npm Package Compare versions

Comparing version 3.9.0 to 3.10.0

lib/Terminal/StringBufferTerminalProvider.d.ts

20

CHANGELOG.json

@@ -5,2 +5,22 @@ {

{
"version": "3.10.0",
"tag": "@microsoft/node-core-library_v3.10.0",
"date": "Mon, 11 Feb 2019 03:31:55 GMT",
"comments": {
"minor": [
{
"comment": "Include support for text formatting in the Terminal API."
},
{
"comment": "Add new API `InternalError.breakInDebugger`"
}
],
"patch": [
{
"comment": "Exposing utility class StringBufferTerminalProvider, useful to clients of Terminal API for their own unit tests"
}
]
}
},
{
"version": "3.9.0",

@@ -7,0 +27,0 @@ "tag": "@microsoft/node-core-library_v3.9.0",

14

CHANGELOG.md
# Change Log - @microsoft/node-core-library
This log was last generated on Thu, 10 Jan 2019 01:57:52 GMT and should not be manually modified.
This log was last generated on Mon, 11 Feb 2019 03:31:55 GMT and should not be manually modified.
## 3.10.0
Mon, 11 Feb 2019 03:31:55 GMT
### Minor changes
- Include support for text formatting in the Terminal API.
- Add new API `InternalError.breakInDebugger`
### Patches
- Exposing utility class StringBufferTerminalProvider, useful to clients of Terminal API for their own unit tests
## 3.9.0

@@ -6,0 +18,0 @@ Thu, 10 Jan 2019 01:57:52 GMT

@@ -29,1 +29,2 @@ /**

export { ConsoleTerminalProvider, IConsoleTerminalProviderOptions } from './Terminal/ConsoleTerminalProvider';
export { StringBufferTerminalProvider } from './Terminal/StringBufferTerminalProvider';

@@ -45,2 +45,4 @@ "use strict";

exports.ConsoleTerminalProvider = ConsoleTerminalProvider_1.ConsoleTerminalProvider;
var StringBufferTerminalProvider_1 = require("./Terminal/StringBufferTerminalProvider");
exports.StringBufferTerminalProvider = StringBufferTerminalProvider_1.StringBufferTerminalProvider;
//# sourceMappingURL=index.js.map

@@ -12,2 +12,11 @@ /**

/**
* If true, a JavScript `debugger;` statement will be invoked whenever the `InternalError` constructor is called.
*
* @remarks
* Generally applications should not be catching and ignoring an `InternalError`. Instead, the error should
* be reported and typically the application will terminate. Thus, if `InternalError` is constructed, it's
* almost always something we want to examine in a debugger.
*/
static breakInDebugger: boolean;
/**
* The underlying error message, without the additional boilerplate for an `InternalError`.

@@ -14,0 +23,0 @@ */

20

lib/InternalError.js

@@ -15,6 +15,2 @@ "use strict";

class InternalError extends Error {
static _formatMessage(unformattedMessage) {
return `Internal Error: ${unformattedMessage}\n\nYou have encountered a software defect. Please consider`
+ ` reporting the issue to the maintainers of this application.`;
}
/**

@@ -36,3 +32,10 @@ * Constructs a new instance of the {@link InternalError} class.

this.unformattedMessage = message;
if (InternalError.breakInDebugger) {
debugger; // tslint:disable-line:no-debugger
}
}
static _formatMessage(unformattedMessage) {
return `Internal Error: ${unformattedMessage}\n\nYou have encountered a software defect. Please consider`
+ ` reporting the issue to the maintainers of this application.`;
}
/** @override */

@@ -43,3 +46,12 @@ toString() {

}
/**
* If true, a JavScript `debugger;` statement will be invoked whenever the `InternalError` constructor is called.
*
* @remarks
* Generally applications should not be catching and ignoring an `InternalError`. Instead, the error should
* be reported and typically the application will terminate. Thus, if `InternalError` is constructed, it's
* almost always something we want to examine in a debugger.
*/
InternalError.breakInDebugger = true;
exports.InternalError = InternalError;
//# sourceMappingURL=InternalError.js.map

@@ -9,2 +9,3 @@ /**

backgroundColor?: ColorValue;
textAttributes?: TextAttribute[];
}

@@ -26,2 +27,10 @@ export declare const eolSequence: IColorableSequence;

}
export declare enum TextAttribute {
Bold = 0,
Dim = 1,
Underline = 2,
Blink = 3,
InvertColor = 4,
Hidden = 5
}
/**

@@ -55,6 +64,16 @@ * The static functions on this class are used to produce colored text

static grayBackground(text: string | IColorableSequence): IColorableSequence;
static bold(text: string | IColorableSequence): IColorableSequence;
static dim(text: string | IColorableSequence): IColorableSequence;
static underline(text: string | IColorableSequence): IColorableSequence;
static blink(text: string | IColorableSequence): IColorableSequence;
static invertColor(text: string | IColorableSequence): IColorableSequence;
static hidden(text: string | IColorableSequence): IColorableSequence;
/**
* If called with a string, returns the string wrapped in a {@link IColorableSequence}.
* If called with a {@link IColorableSequence}, returns the {@link IColorableSequence}.
*
* @internal
*/
static _normalizeStringOrColorableSequence(value: string | IColorableSequence): IColorableSequence;
private static _applyTextAttribute;
}

@@ -23,2 +23,11 @@ "use strict";

})(ColorValue = exports.ColorValue || (exports.ColorValue = {}));
var TextAttribute;
(function (TextAttribute) {
TextAttribute[TextAttribute["Bold"] = 0] = "Bold";
TextAttribute[TextAttribute["Dim"] = 1] = "Dim";
TextAttribute[TextAttribute["Underline"] = 2] = "Underline";
TextAttribute[TextAttribute["Blink"] = 3] = "Blink";
TextAttribute[TextAttribute["InvertColor"] = 4] = "InvertColor";
TextAttribute[TextAttribute["Hidden"] = 5] = "Hidden";
})(TextAttribute = exports.TextAttribute || (exports.TextAttribute = {}));
/**

@@ -88,3 +97,24 @@ * The static functions on this class are used to produce colored text

}
static bold(text) {
return Colors._applyTextAttribute(text, TextAttribute.Bold);
}
static dim(text) {
return Colors._applyTextAttribute(text, TextAttribute.Dim);
}
static underline(text) {
return Colors._applyTextAttribute(text, TextAttribute.Underline);
}
static blink(text) {
return Colors._applyTextAttribute(text, TextAttribute.Blink);
}
static invertColor(text) {
return Colors._applyTextAttribute(text, TextAttribute.InvertColor);
}
static hidden(text) {
return Colors._applyTextAttribute(text, TextAttribute.Hidden);
}
/**
* If called with a string, returns the string wrapped in a {@link IColorableSequence}.
* If called with a {@link IColorableSequence}, returns the {@link IColorableSequence}.
*
* @internal

@@ -102,4 +132,12 @@ */

}
static _applyTextAttribute(text, attribute) {
const sequence = Colors._normalizeStringOrColorableSequence(text);
if (!sequence.textAttributes) {
sequence.textAttributes = [];
}
sequence.textAttributes.push(attribute);
return sequence;
}
}
exports.Colors = Colors;
//# sourceMappingURL=Colors.js.map

@@ -14,10 +14,25 @@ import { ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';

/**
* Terminal provider that prints to STDOUT (for log- and verbose-level messages) and
* STDERR (for warning- and error-level messsages).
*
* @beta
*/
export declare class ConsoleTerminalProvider implements ITerminalProvider {
/**
* If true, verbose-level messages should be written to the console.
*/
verboseEnabled: boolean;
constructor(options?: Partial<IConsoleTerminalProviderOptions>);
/**
* {@inheritdoc ITerminalProvider.write}
*/
write(data: string, severity: TerminalProviderSeverity): void;
/**
* {@inheritdoc ITerminalProvider.eolCharacter}
*/
readonly eolCharacter: string;
/**
* {@inheritdoc ITerminalProvider.supportsColor}
*/
readonly supportsColor: boolean;
}

@@ -9,2 +9,5 @@ "use strict";

/**
* Terminal provider that prints to STDOUT (for log- and verbose-level messages) and
* STDERR (for warning- and error-level messsages).
*
* @beta

@@ -14,5 +17,11 @@ */

constructor(options = {}) {
/**
* If true, verbose-level messages should be written to the console.
*/
this.verboseEnabled = false;
this.verboseEnabled = !!options.verboseEnabled;
}
/**
* {@inheritdoc ITerminalProvider.write}
*/
write(data, severity) {

@@ -38,5 +47,11 @@ switch (severity) {

}
/**
* {@inheritdoc ITerminalProvider.eolCharacter}
*/
get eolCharacter() {
return os_1.EOL;
}
/**
* {@inheritdoc ITerminalProvider.supportsColor}
*/
get supportsColor() {

@@ -43,0 +58,0 @@ return safe_1.enabled;

@@ -235,2 +235,38 @@ "use strict";

}
if (segment.textAttributes) {
for (const textAttribute of segment.textAttributes) {
switch (textAttribute) {
case Colors_1.TextAttribute.Bold: {
startColorCodes.push(1);
endColorCodes.push(21);
break;
}
case Colors_1.TextAttribute.Dim: {
startColorCodes.push(2);
endColorCodes.push(22);
break;
}
case Colors_1.TextAttribute.Underline: {
startColorCodes.push(4);
endColorCodes.push(24);
break;
}
case Colors_1.TextAttribute.Blink: {
startColorCodes.push(5);
endColorCodes.push(25);
break;
}
case Colors_1.TextAttribute.InvertColor: {
startColorCodes.push(7);
endColorCodes.push(27);
break;
}
case Colors_1.TextAttribute.Hidden: {
startColorCodes.push(8);
endColorCodes.push(28);
break;
}
}
}
}
for (let j = 0; j < startColorCodes.length; j++) {

@@ -237,0 +273,0 @@ const code = startColorCodes[j];

{
"name": "@microsoft/node-core-library",
"version": "3.9.0",
"version": "3.10.0",
"description": "Core libraries that every NodeJS toolchain project should use",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is too big to display

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc