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

@babel/generator

Package Overview
Dependencies
Maintainers
5
Versions
183
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 7.0.0-beta.47 to 7.0.0-beta.48

24

lib/buffer.js

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

_trimRight = function _trimRight() {
_trimRight = function () {
return data;

@@ -77,7 +77,8 @@ };

const _this$_sourcePosition = this._sourcePosition,
line = _this$_sourcePosition.line,
column = _this$_sourcePosition.column,
filename = _this$_sourcePosition.filename,
identifierName = _this$_sourcePosition.identifierName;
const {
line,
column,
filename,
identifierName
} = this._sourcePosition;

@@ -94,7 +95,8 @@ this._append(str, line, column, identifierName, filename);

const _this$_sourcePosition2 = this._sourcePosition,
line = _this$_sourcePosition2.line,
column = _this$_sourcePosition2.column,
filename = _this$_sourcePosition2.filename,
identifierName = _this$_sourcePosition2.identifierName;
const {
line,
column,
filename,
identifierName
} = this._sourcePosition;

@@ -101,0 +103,0 @@ this._queue.unshift([str, line, column, identifierName, filename]);

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

exports.Directive = Directive;
exports.InterpreterDirective = InterpreterDirective;
Object.defineProperty(exports, "DirectiveLiteral", {
enumerable: true,
get: function get() {
get: function () {
return _types.StringLiteral;

@@ -22,2 +23,6 @@ }

function File(node) {
if (node.program) {
this.print(node.program.interpreter, node);
}
this.print(node.program, node);

@@ -62,2 +67,6 @@ }

this.semicolon();
}
function InterpreterDirective(node) {
this.token(`#!${node.value}\n`);
}

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

t = function t() {
t = function () {
return data;

@@ -19,0 +19,0 @@ };

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

t = function t() {
t = function () {
return data;

@@ -103,2 +103,3 @@ };

this.print(node.typeArguments, node);
this.print(node.typeParameters, node);

@@ -165,2 +166,3 @@

this.print(node.callee, node);
this.print(node.typeArguments, node);
this.print(node.typeParameters, node);

@@ -179,2 +181,3 @@

this.print(node.callee, node);
this.print(node.typeArguments, node);
this.print(node.typeParameters, node);

@@ -181,0 +184,0 @@ this.token("(");

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

exports.InterfaceDeclaration = InterfaceDeclaration;
exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation;
exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;

@@ -46,2 +47,3 @@ exports.MixedTypeAnnotation = MixedTypeAnnotation;

exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot;
exports.ObjectTypeCallProperty = ObjectTypeCallProperty;

@@ -58,3 +60,3 @@ exports.ObjectTypeIndexer = ObjectTypeIndexer;

enumerable: true,
get: function get() {
get: function () {
return _types2.NumericLiteral;

@@ -65,3 +67,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _types2.StringLiteral;

@@ -74,3 +76,3 @@ }

t = function t() {
t = function () {
return data;

@@ -356,2 +358,16 @@ };

function InterfaceTypeAnnotation(node) {
this.word("interface");
if (node.extends && node.extends.length) {
this.space();
this.word("extends");
this.space();
this.printList(node.extends, node);
}
this.space();
this.print(node.body, node);
}
function IntersectionTypeAnnotation(node) {

@@ -473,3 +489,3 @@ this.printJoin(node.types, node, {

const props = node.properties.concat(node.callProperties || [], node.indexers || []);
const props = node.properties.concat(node.callProperties || [], node.indexers || [], node.internalSlots || []);

@@ -502,2 +518,23 @@ if (props.length) {

function ObjectTypeInternalSlot(node) {
if (node.static) {
this.word("static");
this.space();
}
this.token("[");
this.token("[");
this.print(node.id, node);
this.token("]");
this.token("]");
if (node.optional) this.token("?");
if (!node.method) {
this.token(":");
this.space();
}
this.print(node.value, node);
}
function ObjectTypeCallProperty(node) {

@@ -504,0 +541,0 @@ if (node.static) {

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

enumerable: true,
get: function get() {
get: function () {
return _templateLiterals[key];

@@ -26,3 +26,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _expressions[key];

@@ -39,3 +39,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _statements[key];

@@ -52,3 +52,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _classes[key];

@@ -65,3 +65,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _methods[key];

@@ -78,3 +78,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _modules[key];

@@ -91,3 +91,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _types[key];

@@ -104,3 +104,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _flow[key];

@@ -117,3 +117,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _base[key];

@@ -130,3 +130,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _jsx[key];

@@ -143,3 +143,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _typescript[key];

@@ -146,0 +146,0 @@ }

@@ -82,6 +82,4 @@ "use strict";

this.indent();
var _arr = node.children;
for (var _i = 0; _i < _arr.length; _i++) {
const child = _arr[_i];
for (const child of node.children) {
this.print(child, node);

@@ -130,6 +128,4 @@ }

this.indent();
var _arr2 = node.children;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
const child = _arr2[_i2];
for (const child of node.children) {
this.print(child, node);

@@ -136,0 +132,0 @@ }

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

t = function t() {
t = function () {
return data;

@@ -21,0 +21,0 @@ };

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

t = function t() {
t = function () {
return data;

@@ -23,0 +23,0 @@ };

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

t = function t() {
t = function () {
return data;

@@ -113,3 +113,3 @@ };

const buildForXStatement = function buildForXStatement(op) {
const buildForXStatement = function (op) {
return function (node) {

@@ -286,7 +286,3 @@ this.word("for");

if (!t().isFor(parent)) {
var _arr = node.declarations;
for (var _i = 0; _i < _arr.length; _i++) {
const declar = _arr[_i];
for (const declar of node.declarations) {
if (declar.init) {

@@ -293,0 +289,0 @@ hasInits = true;

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

exports.StringLiteral = StringLiteral;
exports.BigIntLiteral = BigIntLiteral;

@@ -22,3 +23,3 @@ function t() {

t = function t() {
t = function () {
return data;

@@ -33,3 +34,3 @@ };

_jsesc = function _jsesc() {
_jsesc = function () {
return data;

@@ -170,2 +171,13 @@ };

return this.token(val);
}
function BigIntLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.token(raw);
return;
}
this.token(node.value);
}

@@ -147,4 +147,6 @@ "use strict";

function TSPropertySignature(node) {
const readonly = node.readonly,
initializer = node.initializer;
const {
readonly,
initializer
} = node;

@@ -192,3 +194,5 @@ if (readonly) {

function TSIndexSignature(node) {
const readonly = node.readonly;
const {
readonly
} = node;

@@ -264,4 +268,6 @@ if (readonly) {

function tsPrintFunctionOrConstructorType(node) {
const typeParameters = node.typeParameters,
parameters = node.parameters;
const {
typeParameters,
parameters
} = node;
this.print(typeParameters, node);

@@ -313,15 +319,3 @@ this.token("(");

for (var _iterator = members, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const member = _ref;
for (const member of members) {
this.print(member, node);

@@ -410,5 +404,7 @@ this.newline();

function TSMappedType(node) {
const readonly = node.readonly,
typeParameter = node.typeParameter,
optional = node.optional;
const {
readonly,
typeParameter,
optional
} = node;
this.token("{");

@@ -459,7 +455,9 @@ this.space();

function TSInterfaceDeclaration(node) {
const declare = node.declare,
id = node.id,
typeParameters = node.typeParameters,
extendz = node.extends,
body = node.body;
const {
declare,
id,
typeParameters,
extends: extendz,
body
} = node;

@@ -492,6 +490,8 @@ if (declare) {

function TSTypeAliasDeclaration(node) {
const declare = node.declare,
id = node.id,
typeParameters = node.typeParameters,
typeAnnotation = node.typeAnnotation;
const {
declare,
id,
typeParameters,
typeAnnotation
} = node;

@@ -515,4 +515,6 @@ if (declare) {

function TSAsExpression(node) {
const expression = node.expression,
typeAnnotation = node.typeAnnotation;
const {
expression,
typeAnnotation
} = node;
this.print(expression, node);

@@ -526,4 +528,6 @@ this.space();

function TSTypeAssertion(node) {
const typeAnnotation = node.typeAnnotation,
expression = node.expression;
const {
typeAnnotation,
expression
} = node;
this.token("<");

@@ -537,6 +541,8 @@ this.print(typeAnnotation, node);

function TSEnumDeclaration(node) {
const declare = node.declare,
isConst = node.const,
id = node.id,
members = node.members;
const {
declare,
const: isConst,
id,
members
} = node;

@@ -561,4 +567,6 @@ if (declare) {

function TSEnumMember(node) {
const id = node.id,
initializer = node.initializer;
const {
id,
initializer
} = node;
this.print(id, node);

@@ -577,4 +585,6 @@

function TSModuleDeclaration(node) {
const declare = node.declare,
id = node.id;
const {
declare,
id
} = node;

@@ -615,5 +625,7 @@ if (declare) {

function TSImportEqualsDeclaration(node) {
const isExport = node.isExport,
id = node.id,
moduleReference = node.moduleReference;
const {
isExport,
id,
moduleReference
} = node;

@@ -666,4 +678,6 @@ if (isExport) {

function tsPrintSignatureDeclarationBase(node) {
const typeParameters = node.typeParameters,
parameters = node.parameters;
const {
typeParameters,
parameters
} = node;
this.print(typeParameters, node);

@@ -670,0 +684,0 @@ this.token("(");

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

t = function t() {
t = function () {
return data;

@@ -39,22 +39,7 @@ };

var _arr = Object.keys(obj);
for (var _i = 0; _i < _arr.length; _i++) {
const type = _arr[_i];
for (const type of Object.keys(obj)) {
const aliases = t().FLIPPED_ALIAS_KEYS[type];
if (aliases) {
for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i2 >= _iterator.length) break;
_ref = _iterator[_i2++];
} else {
_i2 = _iterator.next();
if (_i2.done) break;
_ref = _i2.value;
}
const alias = _ref;
for (const alias of aliases) {
add(alias, obj[type]);

@@ -61,0 +46,0 @@ }

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

t = function t() {
t = function () {
return data;

@@ -31,0 +31,0 @@ };

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

t = function t() {
t = function () {
return data;

@@ -157,2 +157,10 @@ };

nodes.ObjectTypeInternalSlot = function (node, parent) {
if (parent.internalSlots[0] === node && (!parent.properties || !parent.properties.length) && (!parent.callProperties || !parent.callProperties.length) && (!parent.indexers || !parent.indexers.length)) {
return {
before: true
};
}
};
const list = {

@@ -159,0 +167,0 @@ VariableDeclaration(node) {

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

_isInteger = function _isInteger() {
_isInteger = function () {
return data;

@@ -22,3 +22,3 @@ };

_repeat = function _repeat() {
_repeat = function () {
return data;

@@ -37,3 +37,3 @@ };

t = function t() {
t = function () {
return data;

@@ -485,16 +485,3 @@ };

for (var _iterator = comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const comment = _ref;
for (const comment of comments) {
this._printComment(comment);

@@ -501,0 +488,0 @@ }

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

_sourceMap = function _sourceMap() {
_sourceMap = function () {
return data;

@@ -14,0 +14,0 @@ };

{
"name": "@babel/generator",
"version": "7.0.0-beta.47",
"version": "7.0.0-beta.48",
"description": "Turns an AST into code.",

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

"dependencies": {
"@babel/types": "7.0.0-beta.47",
"@babel/types": "7.0.0-beta.48",
"jsesc": "^2.5.1",

@@ -22,5 +22,5 @@ "lodash": "^4.17.5",

"devDependencies": {
"@babel/helper-fixtures": "7.0.0-beta.47",
"babylon": "7.0.0-beta.47"
"@babel/helper-fixtures": "7.0.0-beta.48",
"@babel/parser": "7.0.0-beta.48"
}
}
# @babel/generator
> Turns a [Babylon AST](https://github.com/babel/babel/blob/master/packages/babylon/ast/spec.md) into code.
> Turns the [babel AST](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) into code.

@@ -14,3 +14,3 @@ ## Install

```js
import {parse} from 'babylon';
import {parse} from '@babel/parser';
import generate from '@babel/generator';

@@ -61,3 +61,3 @@

```js
import {parse} from 'babylon';
import {parse} from '@babel/parser';
import generate from '@babel/generator';

@@ -64,0 +64,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