Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

code-block-writer

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-block-writer - npm Package Compare versions

Comparing version 13.0.1 to 13.0.2

esm/_dnt.test_shims.d.ts.map

65

esm/mod.d.ts

@@ -30,2 +30,32 @@ /**

export default class CodeBlockWriter {
/** @internal */
private readonly _indentationText;
/** @internal */
private readonly _newLine;
/** @internal */
private readonly _useTabs;
/** @internal */
private readonly _quoteChar;
/** @internal */
private readonly _indentNumberOfSpaces;
/** @internal */
private _currentIndentation;
/** @internal */
private _queuedIndentation;
/** @internal */
private _queuedOnlyIfNotBlock;
/** @internal */
private _length;
/** @internal */
private _newLineOnNextWrite;
/** @internal */
private _currentCommentChar;
/** @internal */
private _stringCharStack;
/** @internal */
private _isInRegEx;
/** @internal */
private _isOnFirstLineOfBlock;
/** @internal */
private _texts;
/**

@@ -50,2 +80,4 @@ * Constructor.

queueIndentationLevel(whitespaceText: string): this;
/** @internal */
queueIndentationLevel(countOrText: string | number): this;
/**

@@ -71,2 +103,4 @@ * Writes the text within the provided action with hanging indentation.

setIndentationLevel(whitespaceText: string): this;
/** @internal */
setIndentationLevel(countOrText: string | number): this;
/**

@@ -87,2 +121,4 @@ * Sets the indentation level within the provided action and restores the writer's indentation

withIndentationLevel(whitespaceText: string, action: () => void): this;
/** @internal */
private _withResetIndentation;
/**

@@ -111,2 +147,4 @@ * Gets the current indentation level.

indent(block: () => void): this;
/** @internal */
private _indentBlockInternal;
/**

@@ -280,2 +318,29 @@ * Conditionally writes a line of text.

toString(): string;
/** @internal */
private static readonly _newLineRegEx;
/** @internal */
private _writeIndentingNewLines;
/** @internal */
private _baseWriteNewline;
/** @internal */
private _dequeueQueuedIndentation;
/** @internal */
private _updateInternalState;
/** @internal - This is private, but exposed for testing. */
_getLastCharCodeWithOffset(offset: number): number | undefined;
/** @internal */
private _writeIndentation;
/** @internal */
private _newLineIfNewLineOnNextWrite;
/** @internal */
private _internalWrite;
/** @internal */
private static readonly _spacesOrTabsRegEx;
/** @internal */
private _getIndentationLevelFromArg;
/** @internal */
private _setIndentationState;
/** @internal */
private _getIndentationState;
}
//# sourceMappingURL=mod.d.ts.map

18

esm/mod.js

@@ -728,11 +728,13 @@ import { escapeForWithinString, getStringFromStrOrFunc } from "./utils/string_utils.js";

// handle comments
if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = CommentChar.Line;
if (!this.isInString()) {
if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = CommentChar.Line;
}
else if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.ASTERISK) {
this._currentCommentChar = CommentChar.Star;
}
else if (this._currentCommentChar === CommentChar.Star && pastChar === CHARS.ASTERISK && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = undefined;
}
}
else if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.ASTERISK) {
this._currentCommentChar = CommentChar.Star;
}
else if (this._currentCommentChar === CommentChar.Star && pastChar === CHARS.ASTERISK && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = undefined;
}
if (this.isInComment()) {

@@ -739,0 +741,0 @@ continue;

@@ -1,1 +0,5 @@

export {};
/** @internal */
export declare function escapeForWithinString(str: string, quoteKind: string): string;
/** @internal */
export declare function getStringFromStrOrFunc(strOrFunc: string | (() => string)): string;
//# sourceMappingURL=string_utils.d.ts.map
{
"name": "code-block-writer",
"version": "13.0.1",
"version": "13.0.2",
"description": "A simple code writer that assists with formatting and visualizing blocks of code.",

@@ -37,5 +37,5 @@ "keywords": [

"chai": "4.3.7",
"@deno/shim-deno": "~0.17.0"
"@deno/shim-deno": "~0.18.0"
},
"_generatedBy": "dnt@0.39.0"
"_generatedBy": "dnt@dev"
}

@@ -5,3 +5,3 @@ # code-block-writer

[![CI](https://github.com/dsherret/code-block-writer/workflows/CI/badge.svg)](https://github.com/dsherret/code-block-writer/actions?query=workflow%3ACI)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/code_block_writer/mod.ts)
[![JSR](https://jsr.io/badges/@david/code-block-writer)](https://jsr.io/@david/code-block-writer)
[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

@@ -14,3 +14,3 @@

```ts
import CodeBlockWriter from "https://deno.land/x/code_block_writer/mod.ts";
deno add jsr:@david/code-block-writer
```

@@ -29,3 +29,4 @@

```typescript
import CodeBlockWriter from "https://deno.land/x/code_block_writer/mod.ts";
// import CodeBlockWriter from "code-block-writer"; // for npm
import CodeBlockWriter from "@david/code-block-writer";

@@ -32,0 +33,0 @@ const writer = new CodeBlockWriter({

@@ -30,2 +30,32 @@ /**

export default class CodeBlockWriter {
/** @internal */
private readonly _indentationText;
/** @internal */
private readonly _newLine;
/** @internal */
private readonly _useTabs;
/** @internal */
private readonly _quoteChar;
/** @internal */
private readonly _indentNumberOfSpaces;
/** @internal */
private _currentIndentation;
/** @internal */
private _queuedIndentation;
/** @internal */
private _queuedOnlyIfNotBlock;
/** @internal */
private _length;
/** @internal */
private _newLineOnNextWrite;
/** @internal */
private _currentCommentChar;
/** @internal */
private _stringCharStack;
/** @internal */
private _isInRegEx;
/** @internal */
private _isOnFirstLineOfBlock;
/** @internal */
private _texts;
/**

@@ -50,2 +80,4 @@ * Constructor.

queueIndentationLevel(whitespaceText: string): this;
/** @internal */
queueIndentationLevel(countOrText: string | number): this;
/**

@@ -71,2 +103,4 @@ * Writes the text within the provided action with hanging indentation.

setIndentationLevel(whitespaceText: string): this;
/** @internal */
setIndentationLevel(countOrText: string | number): this;
/**

@@ -87,2 +121,4 @@ * Sets the indentation level within the provided action and restores the writer's indentation

withIndentationLevel(whitespaceText: string, action: () => void): this;
/** @internal */
private _withResetIndentation;
/**

@@ -111,2 +147,4 @@ * Gets the current indentation level.

indent(block: () => void): this;
/** @internal */
private _indentBlockInternal;
/**

@@ -280,2 +318,29 @@ * Conditionally writes a line of text.

toString(): string;
/** @internal */
private static readonly _newLineRegEx;
/** @internal */
private _writeIndentingNewLines;
/** @internal */
private _baseWriteNewline;
/** @internal */
private _dequeueQueuedIndentation;
/** @internal */
private _updateInternalState;
/** @internal - This is private, but exposed for testing. */
_getLastCharCodeWithOffset(offset: number): number | undefined;
/** @internal */
private _writeIndentation;
/** @internal */
private _newLineIfNewLineOnNextWrite;
/** @internal */
private _internalWrite;
/** @internal */
private static readonly _spacesOrTabsRegEx;
/** @internal */
private _getIndentationLevelFromArg;
/** @internal */
private _setIndentationState;
/** @internal */
private _getIndentationState;
}
//# sourceMappingURL=mod.d.ts.map

@@ -730,11 +730,13 @@ "use strict";

// handle comments
if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = CommentChar.Line;
if (!this.isInString()) {
if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = CommentChar.Line;
}
else if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.ASTERISK) {
this._currentCommentChar = CommentChar.Star;
}
else if (this._currentCommentChar === CommentChar.Star && pastChar === CHARS.ASTERISK && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = undefined;
}
}
else if (this._currentCommentChar == null && pastChar === CHARS.FORWARD_SLASH && currentChar === CHARS.ASTERISK) {
this._currentCommentChar = CommentChar.Star;
}
else if (this._currentCommentChar === CommentChar.Star && pastChar === CHARS.ASTERISK && currentChar === CHARS.FORWARD_SLASH) {
this._currentCommentChar = undefined;
}
if (this.isInComment()) {

@@ -741,0 +743,0 @@ continue;

@@ -1,1 +0,5 @@

export {};
/** @internal */
export declare function escapeForWithinString(str: string, quoteKind: string): string;
/** @internal */
export declare function getStringFromStrOrFunc(strOrFunc: string | (() => string)): string;
//# sourceMappingURL=string_utils.d.ts.map

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