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

recast

Package Overview
Dependencies
Maintainers
2
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recast - npm Package Compare versions

Comparing version 0.23.4 to 0.23.5

9

lib/comments.js

@@ -5,3 +5,3 @@ "use strict";

var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
var types = tslib_1.__importStar(require("ast-types"));

@@ -128,3 +128,4 @@ var n = types.namedTypes;

var lastTie = tiesToBreak[tieCount - 1];
assert_1.default.strictEqual(lastTie.precedingNode === comment.precedingNode, lastTie.followingNode === comment.followingNode);
(0, tiny_invariant_1.default)((lastTie.precedingNode === comment.precedingNode) ===
(lastTie.followingNode === comment.followingNode));
if (lastTie.followingNode !== comment.followingNode) {

@@ -183,4 +184,4 @@ breakTies(tiesToBreak, lines);

comment = tiesToBreak[indexOfFirstLeadingComment - 1];
assert_1.default.strictEqual(comment.precedingNode, pn);
assert_1.default.strictEqual(comment.followingNode, fn);
(0, tiny_invariant_1.default)(comment.precedingNode === pn);
(0, tiny_invariant_1.default)(comment.followingNode === fn);
var gap = lines.sliceString(comment.loc.end, gapEndPos);

@@ -187,0 +188,0 @@ if (/\S/.test(gap)) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
var types = tslib_1.__importStar(require("ast-types"));

@@ -30,3 +30,3 @@ var util = tslib_1.__importStar(require("./util"));

var FastPath = function FastPath(value) {
assert_1.default.ok(this instanceof FastPath);
(0, tiny_invariant_1.default)(this instanceof FastPath);
this.stack = [value];

@@ -325,3 +325,3 @@ };

if (pp === np && name === "right") {
assert_1.default.strictEqual(parent.right, node);
(0, tiny_invariant_1.default)(parent.right === node);
return true;

@@ -494,15 +494,15 @@ }

childName === 0) {
assert_1.default.strictEqual(parent.body[0], child);
(0, tiny_invariant_1.default)(parent.body[0] === child);
return true;
}
if (n.ExpressionStatement.check(parent) && childName === "expression") {
assert_1.default.strictEqual(parent.expression, child);
(0, tiny_invariant_1.default)(parent.expression === child);
return true;
}
if (n.AssignmentExpression.check(parent) && childName === "left") {
assert_1.default.strictEqual(parent.left, child);
(0, tiny_invariant_1.default)(parent.left === child);
return true;
}
if (n.ArrowFunctionExpression.check(parent) && childName === "body") {
assert_1.default.strictEqual(parent.body, child);
(0, tiny_invariant_1.default)(parent.body === child);
return true;

@@ -515,19 +515,19 @@ }

childName === 0) {
assert_1.default.strictEqual(parent.expressions[0], child);
(0, tiny_invariant_1.default)(parent.expressions[0] === child);
continue;
}
if (n.CallExpression.check(parent) && childName === "callee") {
assert_1.default.strictEqual(parent.callee, child);
(0, tiny_invariant_1.default)(parent.callee === child);
continue;
}
if (n.MemberExpression.check(parent) && childName === "object") {
assert_1.default.strictEqual(parent.object, child);
(0, tiny_invariant_1.default)(parent.object === child);
continue;
}
if (n.ConditionalExpression.check(parent) && childName === "test") {
assert_1.default.strictEqual(parent.test, child);
(0, tiny_invariant_1.default)(parent.test === child);
continue;
}
if (isBinary(parent) && childName === "left") {
assert_1.default.strictEqual(parent.left, child);
(0, tiny_invariant_1.default)(parent.left === child);
continue;

@@ -538,3 +538,3 @@ }

childName === "argument") {
assert_1.default.strictEqual(parent.argument, child);
(0, tiny_invariant_1.default)(parent.argument === child);
continue;

@@ -541,0 +541,0 @@ }

@@ -5,3 +5,3 @@ "use strict";

var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
var source_map_1 = tslib_1.__importDefault(require("source-map"));

@@ -18,3 +18,3 @@ var options_1 = require("./options");

this.cachedTabWidth = void 0;
assert_1.default.ok(infos.length > 0);
(0, tiny_invariant_1.default)(infos.length > 0);
this.length = infos.length;

@@ -66,3 +66,3 @@ this.name = sourceFileName || null;

var targetChar = targetLines.charAt(targetCursor);
assert_1.default.strictEqual(sourceChar, targetChar);
(0, tiny_invariant_1.default)(sourceChar === targetChar);
var sourceName = mapping.sourceLines.name;

@@ -88,5 +88,5 @@ // Add mappings one character at a time for maximum resolution.

Lines.prototype.bootstrapCharAt = function (pos) {
assert_1.default.strictEqual(typeof pos, "object");
assert_1.default.strictEqual(typeof pos.line, "number");
assert_1.default.strictEqual(typeof pos.column, "number");
(0, tiny_invariant_1.default)(typeof pos === "object");
(0, tiny_invariant_1.default)(typeof pos.line === "number");
(0, tiny_invariant_1.default)(typeof pos.column === "number");
var line = pos.line, column = pos.column, strings = this.toString().split(lineTerminatorSeqExp), string = strings[line - 1];

@@ -102,5 +102,5 @@ if (typeof string === "undefined")

Lines.prototype.charAt = function (pos) {
assert_1.default.strictEqual(typeof pos, "object");
assert_1.default.strictEqual(typeof pos.line, "number");
assert_1.default.strictEqual(typeof pos.column, "number");
(0, tiny_invariant_1.default)(typeof pos === "object");
(0, tiny_invariant_1.default)(typeof pos.line === "number");
(0, tiny_invariant_1.default)(typeof pos.column === "number");
var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;

@@ -122,3 +122,3 @@ if (typeof info === "undefined" || c < 0)

return this;
assert_1.default.ok(width > 0, "negative margin: " + width);
(0, tiny_invariant_1.default)(width > 0, "negative margin: " + width);
if (skipFirstLine && this.length === 1)

@@ -134,3 +134,3 @@ return this;

var newMappings_1 = lines.mappings;
assert_1.default.strictEqual(newMappings_1.length, 0);
(0, tiny_invariant_1.default)(newMappings_1.length === 0);
this.mappings.forEach(function (mapping) {

@@ -154,3 +154,3 @@ newMappings_1.push(mapping.indent(width, skipFirstLine, true));

var newMappings_2 = lines.mappings;
assert_1.default.strictEqual(newMappings_2.length, 0);
(0, tiny_invariant_1.default)(newMappings_2.length === 0);
this.mappings.forEach(function (mapping) {

@@ -177,3 +177,3 @@ newMappings_2.push(mapping.indent(by));

var newMappings_3 = lines.mappings;
assert_1.default.strictEqual(newMappings_3.length, 0);
(0, tiny_invariant_1.default)(newMappings_3.length === 0);
this.mappings.forEach(function (mapping) {

@@ -192,3 +192,3 @@ newMappings_3.push(mapping.indent(by, true));

Lines.prototype.getIndentAt = function (line) {
assert_1.default.ok(line >= 1, "no line " + line + " (line numbers start from 1)");
(0, tiny_invariant_1.default)(line >= 1, "no line " + line + " (line numbers start from 1)");
return Math.max(this.infos[line - 1].indent, 0);

@@ -393,3 +393,3 @@ };

else {
assert_1.default.ok(start.line < end.line);
(0, tiny_invariant_1.default)(start.line < end.line);
sliced[0] = sliceInfo(sliced[0], start.column);

@@ -401,3 +401,3 @@ sliced.push(sliceInfo(sliced.pop(), 0, end.column));

var newMappings_4 = lines.mappings;
assert_1.default.strictEqual(newMappings_4.length, 0);
(0, tiny_invariant_1.default)(newMappings_4.length === 0);
this.mappings.forEach(function (mapping) {

@@ -536,3 +536,3 @@ var sliced = mapping.slice(this, start, end);

list.push.apply(list, args);
assert_1.default.strictEqual(list.length, args.length + 1);
(0, tiny_invariant_1.default)(list.length === args.length + 1);
return emptyLines.join(list);

@@ -553,4 +553,4 @@ };

// '\t'
assert_1.default.strictEqual(typeof tabWidth, "number");
assert_1.default.ok(tabWidth > 0);
(0, tiny_invariant_1.default)(typeof tabWidth === "number");
(0, tiny_invariant_1.default)(tabWidth > 0);
var next = Math.ceil(count / tabWidth) * tabWidth;

@@ -594,3 +594,3 @@ if (next === count) {

var cacheable = !options && tabless && string.length <= maxCacheKeyLen;
assert_1.default.ok(tabWidth || tabless, "No tab width specified but encountered tabs in string\n" + string);
(0, tiny_invariant_1.default)(tabWidth || tabless, "No tab width specified but encountered tabs in string\n" + string);
if (cacheable && hasOwn.call(fromStringCache, string))

@@ -646,5 +646,5 @@ return fromStringCache[string];

}
assert_1.default.ok(indent >= 0);
assert_1.default.ok(sliceStart <= sliceEnd);
assert_1.default.strictEqual(lineLength, indent + sliceEnd - sliceStart);
(0, tiny_invariant_1.default)(indent >= 0);
(0, tiny_invariant_1.default)(sliceStart <= sliceEnd);
(0, tiny_invariant_1.default)(lineLength === indent + sliceEnd - sliceStart);
if (info.indent === indent &&

@@ -651,0 +651,0 @@ info.sliceStart === sliceStart &&

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
var util_1 = require("./util");

@@ -26,3 +26,3 @@ var Mapping = /** @class */ (function () {

else {
assert_1.default.strictEqual(name, "start");
(0, tiny_invariant_1.default)(name === "start");
}

@@ -165,8 +165,8 @@ return skipChars(sourceLines, sourceFromPos, lines, targetFromPos, targetToPos);

else {
assert_1.default.strictEqual(lineDiff, 0);
(0, tiny_invariant_1.default)(lineDiff === 0);
}
while ((0, util_1.comparePos)(targetCursor, targetToPos) < 0 &&
targetLines.nextPos(targetCursor, true)) {
assert_1.default.ok(sourceLines.nextPos(sourceCursor, true));
assert_1.default.strictEqual(sourceLines.charAt(sourceCursor), targetLines.charAt(targetCursor));
(0, tiny_invariant_1.default)(sourceLines.nextPos(sourceCursor, true));
(0, tiny_invariant_1.default)(sourceLines.charAt(sourceCursor) === targetLines.charAt(targetCursor));
}

@@ -190,8 +190,8 @@ }

else {
assert_1.default.strictEqual(lineDiff, 0);
(0, tiny_invariant_1.default)(lineDiff === 0);
}
while ((0, util_1.comparePos)(targetToPos, targetCursor) < 0 &&
targetLines.prevPos(targetCursor, true)) {
assert_1.default.ok(sourceLines.prevPos(sourceCursor, true));
assert_1.default.strictEqual(sourceLines.charAt(sourceCursor), targetLines.charAt(targetCursor));
(0, tiny_invariant_1.default)(sourceLines.prevPos(sourceCursor, true));
(0, tiny_invariant_1.default)(sourceLines.charAt(sourceCursor) === targetLines.charAt(targetCursor));
}

@@ -198,0 +198,0 @@ }

@@ -5,3 +5,3 @@ "use strict";

var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
var types = tslib_1.__importStar(require("ast-types"));

@@ -115,3 +115,3 @@ var b = types.builders;

var TreeCopier = function TreeCopier(lines, tokens) {
assert_1.default.ok(this instanceof TreeCopier);
(0, tiny_invariant_1.default)(this instanceof TreeCopier);
this.lines = lines;

@@ -118,0 +118,0 @@ this.tokens = tokens;

@@ -5,3 +5,3 @@ "use strict";

var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
var linesModule = tslib_1.__importStar(require("./lines"));

@@ -20,4 +20,4 @@ var types = tslib_1.__importStar(require("ast-types"));

var Patcher = function Patcher(lines) {
assert_1.default.ok(this instanceof Patcher);
assert_1.default.ok(lines instanceof linesModule.Lines);
(0, tiny_invariant_1.default)(this instanceof Patcher);
(0, tiny_invariant_1.default)(lines instanceof linesModule.Lines);
var self = this, replacements = [];

@@ -41,3 +41,3 @@ self.replace = function (loc, lines) {

function pushSlice(from, to) {
assert_1.default.ok((0, util_1.comparePos)(from, to) <= 0);
(0, tiny_invariant_1.default)((0, util_1.comparePos)(from, to) <= 0);
toConcat.push(lines.slice(from, to));

@@ -80,3 +80,3 @@ }

var oldComment = reprint.oldPath.getValue();
assert_1.default.ok(oldComment.leading || oldComment.trailing);
(0, tiny_invariant_1.default)(oldComment.leading || oldComment.trailing);
patcher.replace(oldComment.loc,

@@ -129,3 +129,3 @@ // Comments can't have .comments, so it doesn't matter whether we

function getReprinter(path) {
assert_1.default.ok(path instanceof fast_path_1.default);
(0, tiny_invariant_1.default)(path instanceof fast_path_1.default);
// Make sure that this path refers specifically to a Node, rather than

@@ -224,3 +224,3 @@ // some non-Node subproperty of a Node.

Printable.assert(oldNode);
assert_1.default.deepEqual(reprints, []);
(0, tiny_invariant_1.default)(reprints.length === 0);
if (newNode.type !== oldNode.type) {

@@ -227,0 +227,0 @@ return false;

@@ -5,3 +5,3 @@ "use strict";

var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var tiny_invariant_1 = tslib_1.__importDefault(require("tiny-invariant"));
var types = tslib_1.__importStar(require("ast-types"));

@@ -257,4 +257,4 @@ var n = types.namedTypes;

var afterLeftBackTickPos = copyPos(node.loc.start);
assert_1.default.strictEqual(lines.charAt(afterLeftBackTickPos), "`");
assert_1.default.ok(lines.nextPos(afterLeftBackTickPos));
(0, tiny_invariant_1.default)(lines.charAt(afterLeftBackTickPos) === "`");
(0, tiny_invariant_1.default)(lines.nextPos(afterLeftBackTickPos));
var firstQuasi = node.quasis[0];

@@ -267,4 +267,4 @@ if (comparePos(firstQuasi.loc.start, afterLeftBackTickPos) < 0) {

var rightBackTickPos = copyPos(node.loc.end);
assert_1.default.ok(lines.prevPos(rightBackTickPos));
assert_1.default.strictEqual(lines.charAt(rightBackTickPos), "`");
(0, tiny_invariant_1.default)(lines.prevPos(rightBackTickPos));
(0, tiny_invariant_1.default)(lines.charAt(rightBackTickPos) === "`");
var lastQuasi = node.quasis[node.quasis.length - 1];

@@ -296,3 +296,3 @@ if (comparePos(rightBackTickPos, lastQuasi.loc.end) < 0) {

if (lines.charAt(rightCurlyPos) === "}") {
assert_1.default.ok(lines.nextPos(rightCurlyPos));
(0, tiny_invariant_1.default)(lines.nextPos(rightCurlyPos));
// Now rightCurlyPos is technically the position just after the }.

@@ -299,0 +299,0 @@ var quasiAfter = node.quasis[i + 1];

{
"author": "Ben Newman <bn@cs.stanford.edu>",
"name": "recast",
"version": "0.23.4",
"version": "0.23.5",
"description": "JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator",

@@ -45,6 +45,6 @@ "keywords": [

"dependencies": {
"assert": "^2.0.0",
"ast-types": "^0.16.1",
"esprima": "~4.0.0",
"source-map": "~0.6.1",
"tiny-invariant": "^1.3.3",
"tslib": "^2.0.1"

@@ -51,0 +51,0 @@ },

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

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