New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@putout/printer

Package Overview
Dependencies
Maintainers
1
Versions
623
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/printer - npm Package Compare versions

Comparing version 1.57.0 to 1.58.0

11

lib/tokenize/comments.js

@@ -13,8 +13,15 @@ 'use strict';

const isClass = !path.isClassMethod();
const insideFn = path.parentPath.isFunction();
const isIndent = !path.isClassMethod() && !insideFn;
for (const {type, value} of leadingComments) {
maybe.indent(isClass);
maybe.indent(isIndent);
if (type === 'CommentLine') {
maybe.indent.inc(insideFn);
maybe.indent.inc(insideFn);
maybe.print.breakline(insideFn);
maybe.indent.dec(insideFn);
maybe.indent.dec(insideFn);
print(`//${value}`);

@@ -21,0 +28,0 @@ print.newline();

'use strict';
const {isNext} = require('../is');
module.exports.ClassExpression = classVisitor;
module.exports.ClassDeclaration = classVisitor;
module.exports.ClassDeclaration = (path, {print, indent, maybe}) => {
module.exports.ClassDeclaration = (path, {print, indent, maybe, write}) => {
indent();

@@ -14,2 +16,6 @@

});
if (!path.parentPath.isExportDeclaration() && isNext(path)) {
write.newline();
}
};

@@ -16,0 +22,0 @@

@@ -40,3 +40,10 @@ 'use strict';

print('=>');
print.space();
const body = path.get('body');
const insideCall = path.parentPath.isCallExpression();
const isJSX = body.isJSXElement();
maybe.print.space(!insideCall && isJSX);
maybe.print.space(!isJSX);
print('__body');

@@ -43,0 +50,0 @@ },

@@ -5,4 +5,16 @@ 'use strict';

const {isNext} = require('../../is');
const isFirst = (path) => !path.getPrevSibling().node;
module.exports.FunctionDeclaration = {
beforeIf(path) {
if (isFirst(path))
return false;
const prev = path.getPrevSibling();
return prev.isClassDeclaration();
},
before(path, {write}) {
write.newline();
},
print(path, {print, maybe}) {

@@ -9,0 +21,0 @@ const {async} = path.node;

@@ -10,6 +10,21 @@ 'use strict';

},
print(path, {print, traverse}) {
print(path, {print, traverse, indent, maybe}) {
const insideFn = path.parentPath.isArrowFunctionExpression();
const insideCall = path.parentPath.parentPath.isCallExpression();
if (insideFn && insideCall) {
indent.inc();
indent.inc();
indent();
}
print('__openingElement');
path.get('children').map(traverse);
print('__closingElement');
if (insideFn && insideCall) {
indent.dec();
maybe.print.breakline(insideCall);
indent.dec();
}
},

@@ -16,0 +31,0 @@ after(path, {write, indent}) {

48

lib/tokenize/jsx/jsx-opening-element.js

@@ -5,25 +5,27 @@ 'use strict';

module.exports.JSXOpeningElement = (path, {print, maybe}) => {
print('<');
print('__name');
const coupleLines = isCoupleLines(path);
const noCoupleLines = !coupleLines;
const shouldIndent = coupleLines && path.parentPath.parentPath.isJSXElement();
maybe.indent.inc(shouldIndent);
for (const attr of path.get('attributes')) {
maybe.print.space(noCoupleLines);
print(attr);
}
if (isCoupleLines(path))
print.breakline();
if (path.node.selfClosing)
print('/');
print('>');
maybe.indent.dec(shouldIndent);
module.exports.JSXOpeningElement = {
print(path, {print, maybe}) {
print('<');
print('__name');
const coupleLines = isCoupleLines(path);
const noCoupleLines = !coupleLines;
const shouldIndent = coupleLines && path.parentPath.parentPath.isJSXElement();
maybe.indent.inc(shouldIndent);
for (const attr of path.get('attributes')) {
maybe.print.space(noCoupleLines);
print(attr);
}
if (isCoupleLines(path))
print.breakline();
if (path.node.selfClosing)
print('/');
print('>');
maybe.indent.dec(shouldIndent);
},
};
{
"name": "@putout/printer",
"version": "1.57.0",
"version": "1.58.0",
"type": "commonjs",

@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

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