Socket
Socket
Sign inDemoInstall

babel-generator

Package Overview
Dependencies
Maintainers
6
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-generator - npm Package Compare versions

Comparing version 6.11.4 to 6.14.0

48

lib/buffer.js

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

/**
* The Buffer class exists to manage the queue of tokens being pushed onto the output string
* in such a way that the final string buffer is treated as write-only until the final .get()
* call. This allows V8 to optimize the output efficiently by not requiring it to store the
* string in contiguous memory.
*/
var Buffer = function () {

@@ -37,2 +30,3 @@ function Buffer(map) {

this._sourcePosition = {
identifierName: null,
line: null,

@@ -46,6 +40,2 @@ column: null,

/**
* Get the final string output from the buffer, along with the sourcemap if one exists.
*/
Buffer.prototype.get = function get() {

@@ -60,6 +50,2 @@ this._flush();

/**
* Add a string to the buffer that cannot be reverted.
*/
Buffer.prototype.append = function append(str) {

@@ -71,12 +57,8 @@ this._flush();

var filename = _sourcePosition.filename;
var identifierName = _sourcePosition.identifierName;
this._append(str, line, column, filename);
this._append(str, line, column, identifierName, filename);
};
/**
* Add a string to the buffer than can be reverted.
*/
Buffer.prototype.queue = function queue(str) {
// Drop trailing spaces when a newline is inserted.
if (str === "\n") while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) {

@@ -88,4 +70,5 @@ this._queue.shift();

var filename = _sourcePosition2.filename;
var identifierName = _sourcePosition2.identifierName;
this._queue.unshift([str, line, column, filename]);
this._queue.unshift([str, line, column, identifierName, filename]);
};

@@ -100,6 +83,5 @@

Buffer.prototype._append = function _append(str, line, column, filename) {
// If there the line is ending, adding a new mapping marker is redundant
Buffer.prototype._append = function _append(str, line, column, identifierName, filename) {
if (this._map && str[0] !== "\n") {
this._map.mark(this._position.line, this._position.column, line, column, filename);
this._map.mark(this._position.line, this._position.column, line, column, identifierName, filename);
}

@@ -129,3 +111,2 @@

Buffer.prototype.endsWith = function endsWith(suffix) {
// Fast path to avoid iterating over this._queue.
if (suffix.length === 1) {

@@ -150,4 +131,2 @@ var last = void 0;

// We assume that everything being matched is at most a single token plus some whitespace,
// which everything currently is, but otherwise we'd have to expand _last or check _buf.
return false;

@@ -160,7 +139,2 @@ };

/**
* Sets a given position as the current source location so generated code after this call
* will be given this position in the sourcemap.
*/
Buffer.prototype.source = function source(prop, loc) {

@@ -171,2 +145,3 @@ if (prop && !loc) return;

this._sourcePosition.identifierName = loc && loc.identifierName || null;
this._sourcePosition.line = pos ? pos.line : null;

@@ -177,13 +152,9 @@ this._sourcePosition.column = pos ? pos.column : null;

/**
* Call a callback with a specific source location and restore on completion.
*/
Buffer.prototype.withSource = function withSource(prop, loc, cb) {
if (!this._map) return cb();
// Use the call stack to manage a stack of "source location" data.
var originalLine = this._sourcePosition.line;
var originalColumn = this._sourcePosition.column;
var originalFilename = this._sourcePosition.filename;
var originalIdentifierName = this._sourcePosition.identifierName;

@@ -197,2 +168,3 @@ this.source(prop, loc);

this._sourcePosition.filename = originalFilename;
this._sourcePosition.identifierName = originalIdentifierName;
};

@@ -199,0 +171,0 @@

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

this.print(node.argument, node);
} /* eslint max-len: 0 */
}

@@ -167,3 +167,3 @@ function DoExpression(node) {

function EmptyStatement() {
this.semicolon(true /* force */);
this.semicolon(true);
}

@@ -185,4 +185,2 @@

function AssignmentExpression(node, parent) {
// Somewhere inside a for statement `init` node but doesn't usually
// needs a paren except for `in` expressions: `for (a in b ? a : b;;)`
var parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent);

@@ -189,0 +187,0 @@

"use strict";
exports.__esModule = true;
exports.TypeParameterDeclaration = exports.StringLiteralTypeAnnotation = exports.NumericLiteralTypeAnnotation = exports.GenericTypeAnnotation = exports.ClassImplements = undefined;
exports.AnyTypeAnnotation = AnyTypeAnnotation;

@@ -14,2 +13,3 @@ exports.ArrayTypeAnnotation = ArrayTypeAnnotation;

exports.DeclareModule = DeclareModule;
exports.DeclareModuleExports = DeclareModuleExports;
exports.DeclareTypeAlias = DeclareTypeAlias;

@@ -58,12 +58,5 @@ exports.DeclareVariable = DeclareVariable;

exports.VoidTypeAnnotation = VoidTypeAnnotation;
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function AnyTypeAnnotation() {
this.word("any");
} /* eslint max-len: 0 */
}

@@ -122,2 +115,11 @@ function ArrayTypeAnnotation(node) {

function DeclareModuleExports(node) {
this.word("declare");
this.space();
this.word("module");
this.token(".");
this.word("exports");
this.print(node.typeAnnotation, node);
}
function DeclareTypeAlias(node) {

@@ -159,4 +161,3 @@ this.word("declare");

// this node type is overloaded, not sure why but it makes it EXTREMELY annoying
if (parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") {
if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") {
this.token(":");

@@ -359,6 +360,4 @@ } else {

if (node.optional) this.token("?");
if (!t.isFunctionTypeAnnotation(node.value)) {
this.token(":");
this.space();
}
this.token(":");
this.space();
this.print(node.value, node);

@@ -365,0 +364,0 @@ }

@@ -101,3 +101,2 @@ "use strict";

// print "special" specifiers first
var hasSpecial = false;

@@ -150,3 +149,2 @@ while (true) {

if (specifiers && specifiers.length) {
// print "special" specifiers first
while (true) {

@@ -153,0 +151,0 @@ var first = specifiers[0];

@@ -72,3 +72,2 @@ "use strict";

// Recursively get the last statement.
function getLastStatement(statement) {

@@ -181,5 +180,2 @@ if (!t.isStatement(statement.body)) return statement;

// Esprima bug puts the catch clause in a `handlers` array.
// see https://code.google.com/p/esprima/issues/detail?id=433
// We run into this from regenerator generated ast.
if (node.handlers) {

@@ -251,3 +247,2 @@ this.print(node.handlers[0], node);

function variableDeclarationIdent() {
// "let " or "var " indentation.
this.token(",");

@@ -261,3 +256,2 @@ this.newline();

function constDeclarationIdent() {
// "const " indentation.
this.token(",");

@@ -275,3 +269,3 @@ this.newline();

var hasInits = false;
// don't add whitespace to loop heads
if (!t.isFor(parent)) {

@@ -293,3 +287,2 @@ for (var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {

if (declar.init) {
// has an init so let's split it up over multiple lines
hasInits = true;

@@ -300,14 +293,2 @@ }

//
// use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on
// this will format declarations like:
//
// let foo = "bar", bar = "foo";
//
// into
//
// let foo = "bar",
// bar = "foo";
//
var separator = void 0;

@@ -318,8 +299,5 @@ if (hasInits) {

//
this.printList(node.declarations, node, { separator: separator });
if (t.isFor(parent)) {
// don't give semicolons to these nodes since they'll be inserted in the parent generator
if (parent.left === node || parent.init === node) return;

@@ -326,0 +304,0 @@ }

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

function Identifier(node) {
// FIXME: We hang variance off Identifer to support Flow's def-site variance.
// This is a terrible hack, but changing type annotations to use a new,
// dedicated node would be a breaking change. This should be cleaned up in
// the next major.
if (node.variance) {

@@ -45,4 +41,3 @@ if (node.variance === "plus") {

this.word(node.name);
} /* eslint max-len: 0 */
/* eslint quotes: 0 */
}

@@ -86,3 +81,2 @@ function RestElement(node) {

} else {
// print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});`
if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {

@@ -95,3 +89,2 @@ this.print(node.value, node);

// shorthand!
if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {

@@ -121,7 +114,2 @@ return;

} else {
// If the array expression ends with a hole, that hole
// will be ignored by the interpreter, but if it ends with
// two (or more) holes, we need to write out two (or more)
// commas so that the resulting code is interpreted with
// both (all) of the holes.
this.token(",");

@@ -162,3 +150,2 @@ }

// escape illegal js but valid json unicode characters
val = val.replace(/[\u000A\u000D\u2028\u2029]/g, function (c) {

@@ -169,12 +156,8 @@ return "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4);

if (this.format.quotes === "single" && !t.isJSX(parent)) {
// remove double quotes
val = val.slice(1, -1);
// unescape double quotes
val = val.replace(/\\"/g, '"');
// escape single quotes
val = val.replace(/'/g, "\\'");
// add single quotes
val = "'" + val + "'";

@@ -181,0 +164,0 @@ }

@@ -43,7 +43,2 @@ "use strict";

/**
* Babel's code generator, turns an ast into code, maintaining sourcemaps,
* user preferences, and valid output.
*/
var Generator = function (_Printer) {

@@ -67,8 +62,2 @@ (0, _inherits3.default)(Generator, _Printer);

/**
* Generate code and sourcemap from ast.
*
* Appends comments that weren't attached to any node to the end of the generated output.
*/
Generator.prototype.generate = function generate() {

@@ -81,9 +70,2 @@ return _Printer.prototype.generate.call(this, this.ast);

/**
* Normalize generator options, setting defaults.
*
* - Detects code indentation.
* - If `opts.compact = "auto"` and the code is over 100KB, `compact` will be set to `true`.
*/
function normalizeOptions(code, opts, tokens) {

@@ -126,3 +108,3 @@ var style = " ";

if (format.compact === "auto") {
format.compact = code.length > 100000; // 100KB
format.compact = code.length > 100000;

@@ -141,5 +123,2 @@ if (format.compact) {

/**
* Determine if input code uses more single or double quotes.
*/
function findCommonStringDelimiter(code, tokens) {

@@ -174,8 +153,2 @@ var occurences = {

/**
* We originally exported the Generator class above, but to make it extra clear that it is a private API,
* we have moved that to an internal class instance and simplified the interface to the two public methods
* that we wish to support.
*/
var CodeGenerator = exports.CodeGenerator = function () {

@@ -182,0 +155,0 @@ function CodeGenerator(ast, opts, code) {

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

// Rather than using `t.is` on each object property, we pre-expand any type aliases
// into concrete types so that the 'find' call below can be as fast as possible.
var expandedParens = expandAliases(parens);

@@ -91,0 +89,0 @@ var expandedWhitespaceNodes = expandAliases(_whitespace2.default.nodes);

@@ -59,3 +59,2 @@ "use strict";

if (t.isMemberExpression(parent) && parent.object === node) {
// (foo++).test()
return true;

@@ -95,3 +94,2 @@ }

// Logical expressions with the same precedence don't need parens.
if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {

@@ -107,3 +105,2 @@ return true;

if (node.operator === "in") {
// let i = (1 in []);
if (t.isVariableDeclarator(parent)) {

@@ -113,3 +110,2 @@ return true;

// for ((1 in []);;);
if (t.isFor(parent)) {

@@ -125,6 +121,2 @@ return true;

if (t.isForStatement(parent)) {
// Although parentheses wouldn"t hurt around sequence
// expressions in the head of for loops, traditional style
// dictates that e.g. i++, j++ should not be wrapped with
// parentheses.
return false;

@@ -161,4 +153,2 @@ }

// Otherwise err on the side of overparenthesization, adding
// explicit exceptions above if this proves overzealous.
return true;

@@ -193,3 +183,2 @@ }

function ArrowFunctionExpression(node, parent) {
// export default (function () {});
if (t.isExportDeclaration(parent)) {

@@ -234,4 +223,2 @@ return true;

// Walk up the print stack to deterimine if our node can come first
// in statement.
function isFirstInStatement(printStack) {

@@ -238,0 +225,0 @@ var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

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

/**
* Crawl a node to test if it contains a CallExpression, a Function, or a Helper.
*
* @example
* crawl(node)
* // { hasCall: false, hasFunction: true, hasHelper: false }
*/
function crawl(node) {

@@ -53,6 +45,2 @@ var state = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

/**
* Test if a node is or has a helper.
*/
function isHelper(node) {

@@ -76,12 +64,3 @@ if (t.isMemberExpression(node)) {

/**
* Tests for node types that need whitespace.
*/
exports.nodes = {
/**
* Test if AssignmentExpression needs whitespace.
*/
AssignmentExpression: function AssignmentExpression(node) {

@@ -96,8 +75,2 @@ var state = crawl(node.right);

},
/**
* Test if SwitchCase needs whitespace.
*/
SwitchCase: function SwitchCase(node, parent) {

@@ -108,8 +81,2 @@ return {

},
/**
* Test if LogicalExpression needs whitespace.
*/
LogicalExpression: function LogicalExpression(node) {

@@ -122,8 +89,2 @@ if (t.isFunction(node.left) || t.isFunction(node.right)) {

},
/**
* Test if Literal needs whitespace.
*/
Literal: function Literal(node) {

@@ -136,8 +97,2 @@ if (node.value === "use strict") {

},
/**
* Test if CallExpression needs whitespace.
*/
CallExpression: function CallExpression(node) {

@@ -151,8 +106,2 @@ if (t.isFunction(node.callee) || isHelper(node)) {

},
/**
* Test if VariableDeclaration needs whitespace.
*/
VariableDeclaration: function VariableDeclaration(node) {

@@ -176,8 +125,2 @@ for (var i = 0; i < node.declarations.length; i++) {

},
/**
* Test if IfStatement needs whitespace.
*/
IfStatement: function IfStatement(node) {

@@ -193,6 +136,2 @@ if (t.isBlockStatement(node.consequent)) {

/**
* Test if Property or SpreadProperty needs whitespace.
*/
exports.nodes.ObjectProperty = exports.nodes.ObjectTypeProperty = exports.nodes.ObjectMethod = exports.nodes.SpreadProperty = function (node, parent) {

@@ -206,30 +145,9 @@ if (parent.properties[0] === node) {

/**
* Returns lists from node types that need whitespace.
*/
exports.list = {
/**
* Return VariableDeclaration declarations init properties.
*/
VariableDeclaration: function VariableDeclaration(node) {
return (0, _map2.default)(node.declarations, "init");
},
/**
* Return VariableDeclaration elements.
*/
ArrayExpression: function ArrayExpression(node) {
return node.elements;
},
/**
* Return VariableDeclaration properties.
*/
ObjectExpression: function ObjectExpression(node) {

@@ -240,6 +158,2 @@ return node.properties;

/**
* Add whitespace tests for nodes and their aliases.
*/
(0, _each2.default)({

@@ -246,0 +160,0 @@ Function: true,

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

/* eslint max-len: 0 */
var SCIENTIFIC_NOTATION = /e/i;

@@ -94,6 +92,2 @@ var ZERO_DECIMAL_INTEGER = /\.0+$/;

/**
* Increment indent size.
*/
Printer.prototype.indent = function indent() {

@@ -105,6 +99,2 @@ if (this.format.compact || this.format.concise) return;

/**
* Decrement indent size.
*/
Printer.prototype.dedent = function dedent() {

@@ -116,6 +106,2 @@ if (this.format.compact || this.format.concise) return;

/**
* Add a semicolon to the buffer.
*/
Printer.prototype.semicolon = function semicolon() {

@@ -125,9 +111,5 @@ var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];

this._maybeAddAuxComment();
this._append(";", !force /* queue */);
this._append(";", !force);
};
/**
* Add a right brace to the buffer.
*/
Printer.prototype.rightBrace = function rightBrace() {

@@ -140,6 +122,2 @@ if (this.format.minified) {

/**
* Add a space to the buffer unless it is compact.
*/
Printer.prototype.space = function space() {

@@ -155,6 +133,2 @@ var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];

/**
* Writes a token that can't be safely parsed without taking whitespace into account.
*/
Printer.prototype.word = function word(str) {

@@ -169,28 +143,10 @@ if (this._endsWithWord) this._space();

/**
* Writes a number token so that we can validate if it is an integer.
*/
Printer.prototype.number = function number(str) {
this.word(str);
// Integer tokens need special handling because they cannot have '.'s inserted
// immediately after them.
this._endsWithInteger = (0, _isInteger2.default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
};
/**
* Writes a simple token.
*/
Printer.prototype.token = function token(str) {
// space is mandatory to avoid outputting <!--
// http://javascript.spec.whatwg.org/#comment-syntax
if (str === "--" && this.endsWith("!") ||
// Need spaces for operators of the same kind to avoid: `a+++b`
str[0] === "+" && this.endsWith("+") || str[0] === "-" && this.endsWith("-") ||
// Needs spaces to avoid changing '34' to '34.', which would still be a valid number.
str[0] === "." && this._endsWithInteger) {
if (str === "--" && this.endsWith("!") || str[0] === "+" && this.endsWith("+") || str[0] === "-" && this.endsWith("-") || str[0] === "." && this._endsWithInteger) {
this._space();

@@ -203,6 +159,2 @@ }

/**
* Add a newline (or many newlines), maintaining formatting.
*/
Printer.prototype.newline = function newline(i) {

@@ -216,3 +168,2 @@ if (this.format.retainLines || this.format.compact) return;

// never allow more than two lines
if (this.endsWith("\n\n")) return;

@@ -252,7 +203,7 @@

Printer.prototype._space = function _space() {
this._append(" ", true /* queue */);
this._append(" ", true);
};
Printer.prototype._newline = function _newline() {
this._append("\n", true /* queue */);
this._append("\n", true);
};

@@ -273,3 +224,2 @@

Printer.prototype._maybeIndent = function _maybeIndent(str) {
// we've got a newline before us so prepend on the indentation
if (this._indent && this.endsWith("\n") && str[0] !== "\n") {

@@ -281,3 +231,2 @@ this._buf.queue(this._getIndent());

Printer.prototype._maybeAddParen = function _maybeAddParen(str) {
// see startTerminatorless() instance method
var parenPushNewlineState = this._parenPushNewlineState;

@@ -294,3 +243,2 @@ if (!parenPushNewlineState) return;

if (cha === "\n" || cha === "/") {
// we're going to break this terminator expression so we need to add a parentheses
this.token("(");

@@ -305,3 +253,2 @@ this.indent();

// catch up to this nodes newline if we're behind
var pos = loc ? loc[prop] : null;

@@ -317,6 +264,2 @@ if (pos && pos.line !== null) {

/**
* Get the current indent.
*/
Printer.prototype._getIndent = function _getIndent() {

@@ -326,18 +269,2 @@ return (0, _repeat2.default)(this.format.indent.style, this._indent);

/**
* Set some state that will be modified if a newline has been inserted before any
* non-space characters.
*
* This is to prevent breaking semantics for terminatorless separator nodes. eg:
*
* return foo;
*
* returns `foo`. But if we do:
*
* return
* foo;
*
* `undefined` will be returned and not `foo` due to the terminator.
*/
Printer.prototype.startTerminatorless = function startTerminatorless() {

@@ -349,6 +276,2 @@ return this._parenPushNewlineState = {

/**
* Print an ending parentheses if a starting one has been printed.
*/
Printer.prototype.endTerminatorless = function endTerminatorless(state) {

@@ -397,3 +320,2 @@ if (state.printed) {

// end
this._printStack.pop();

@@ -532,7 +454,4 @@

// Fast path since 'this.newline' does nothing when not tracking lines.
if (this.format.retainLines || this.format.compact) return;
// Fast path for concise since 'this.newline' just inserts a space when
// concise formatting is in use.
if (this.format.concise) {

@@ -546,3 +465,2 @@ this.space();

if (node.start != null && !node._ignoreUserWhitespace && this._whitespace) {
// user node
if (leading) {

@@ -564,4 +482,3 @@ var _comments = node.leadingComments;

} else {
// generated node
if (!leading) lines++; // always include at least a single line after
if (!leading) lines++;
if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0;

@@ -573,3 +490,2 @@

// generated nodes can't add starting file whitespace
if (!this._buf.hasContent()) lines = 0;

@@ -582,4 +498,2 @@ }

Printer.prototype._getComments = function _getComments(leading, node) {
// Note, we use a boolean flag here instead of passing in the attribute name as it is faster
// because this is called extremely frequently.
return node && (leading ? node.leadingComments : node.trailingComments) || [];

@@ -593,4 +507,2 @@ };

// Some plugins use this to mark comments as removed using the AST-root 'comments' property,
// where they can't manually mutate the AST node comment lists.
if (comment.ignore) return;

@@ -606,3 +518,2 @@

// whitespace before
this.newline(this._whitespace ? this._whitespace.getNewlinesBefore(comment) : 0);

@@ -614,3 +525,2 @@

//
if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) {

@@ -631,6 +541,3 @@ var offset = comment.loc && comment.loc.start.column;

// whitespace after
this.newline((this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) + (
// Subtract one to account for the line force-added above.
comment.type === "CommentLine" ? -1 : 0));
this.newline((this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) + (comment.type === "CommentLine" ? -1 : 0));
};

@@ -637,0 +544,0 @@

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

/**
* Build a sourcemap.
*/
var SourceMap = function () {

@@ -49,6 +45,2 @@ function SourceMap(opts, code) {

/**
* Get the sourcemap.
*/
SourceMap.prototype.get = function get() {

@@ -58,13 +50,5 @@ return this._map.toJSON();

/**
* Mark the current generated position with a source position. May also be passed null line/column
* values to insert a mapping to nothing.
*/
SourceMap.prototype.mark = function mark(generatedLine, generatedColumn, line, column, filename) {
// Adding an empty mapping at the start of a generated line just clutters the map.
SourceMap.prototype.mark = function mark(generatedLine, generatedColumn, line, column, identifierName, filename) {
if (this._lastGenLine !== generatedLine && line === null) return;
// If this mapping points to the same source location as the last one, we can ignore it since
// the previous one covers it.
if (this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) {

@@ -79,2 +63,3 @@ return;

this._map.addMapping({
name: identifierName,
generated: {

@@ -81,0 +66,0 @@ line: generatedLine,

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

/**
* Get whitespace around tokens.
*/
var Whitespace = function () {

@@ -24,6 +20,2 @@ function Whitespace(tokens) {

/**
* Count all the newlines before a node.
*/
Whitespace.prototype.getNewlinesBefore = function getNewlinesBefore(node) {

@@ -47,6 +39,2 @@ var startToken = void 0;

/**
* Count all the newlines after a node.
*/
Whitespace.prototype.getNewlinesAfter = function getNewlinesAfter(node) {

@@ -75,6 +63,2 @@ var startToken = void 0;

/**
* Count all the newlines between two tokens.
*/
Whitespace.prototype._getNewlinesBetween = function _getNewlinesBetween(startToken, endToken) {

@@ -97,6 +81,2 @@ if (!endToken || !endToken.loc) return 0;

/**
* Find a token between start and end.
*/
Whitespace.prototype._findToken = function _findToken(test, start, end) {

@@ -103,0 +83,0 @@ if (start >= end) return -1;

{
"name": "babel-generator",
"version": "6.11.4",
"version": "6.14.0",
"description": "Turns an AST into code.",

@@ -16,3 +16,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"babel-runtime": "^6.9.0",
"babel-types": "^6.10.2",
"babel-types": "^6.14.0",
"detect-indent": "^3.0.1",

@@ -24,4 +24,4 @@ "lodash": "^4.2.0",

"babel-helper-fixtures": "^6.9.0",
"babylon": "^6.7.0"
"babylon": "^6.9.0"
}
}
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