Socket
Socket
Sign inDemoInstall

hermes-transform

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hermes-transform - npm Package Compare versions

Comparing version 0.10.1 to 0.11.0

16

dist/detachedNode.js

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

exports.asDetachedNode = void 0;
exports.asDetachedNodeForCodeGen = asDetachedNodeForCodeGen;
exports.deepCloneNode = deepCloneNode;

@@ -39,3 +40,18 @@ exports.detachedProps = detachedProps;

}
/* $FlowExpectedError[unclear-type] Type safety is not needed for generated
* code, this avoids us always having to pass a generic property within codegen */
function asDetachedNodeForCodeGen(node) {
if (node == null) {
return null;
}
if (isDetachedNode(node)) {
return node;
}
return shallowCloneNode(node, {});
}
const asDetachedNode = (node, {

@@ -42,0 +58,0 @@ useDeepClone

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

exports.Identifier = Identifier;
exports.MemberExpression = MemberExpression;
exports.Program = Program;

@@ -120,2 +121,16 @@ exports.TemplateElement = TemplateElement;

return node;
}
function MemberExpression(props) {
var _props$optional2;
const node = (0, _detachedNode.detachedProps)(props.parent, {
type: 'MemberExpression',
object: (0, _detachedNode.asDetachedNode)(props.object),
property: (0, _detachedNode.asDetachedNode)(props.property),
computed: props.computed,
optional: (_props$optional2 = props.optional) != null ? _props$optional2 : false
});
(0, _detachedNode.setParentPointersInDirectChildren)(node);
return node;
}

3

dist/index.js

@@ -15,3 +15,3 @@ /**

});
exports.traverseWithContext = exports.traverse = exports.transform = exports.t = exports.print = exports.parse = exports.cloneJSDocCommentsToNewNode = exports.asDetachedNode = exports.SimpleTraverser = void 0;
exports.traverseWithContext = exports.traverse = exports.transform = exports.t = exports.print = exports.parse = exports.makeCommentOwnLine = exports.cloneJSDocCommentsToNewNode = exports.asDetachedNode = exports.SimpleTraverser = void 0;

@@ -50,2 +50,3 @@ var _hermesParser = require("hermes-parser");

exports.cloneJSDocCommentsToNewNode = _comments.cloneJSDocCommentsToNewNode;
exports.makeCommentOwnLine = _comments.makeCommentOwnLine;

@@ -52,0 +53,0 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

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

exports.isTrailingComment = isTrailingComment;
exports.makeCommentOwnLine = makeCommentOwnLine;
exports.moveCommentsToNewNode = moveCommentsToNewNode;

@@ -71,3 +72,3 @@ exports.setCommentsOnNode = setCommentsOnNode;

});
setCommentsOnNode(newNode, comments.map(cloneCommentWithMarkers));
setCommentsOnNode(newNode, [...getCommentsForNode(newNode), ...comments.map(cloneCommentWithMarkers)]);
}

@@ -170,2 +171,21 @@

function makeCommentOwnLine(code, comment) {
let newCode = code; // Since we always want a line break we need to ensure a newline is found when
// searching out from either side of the comment range.
let firstNewline = getFirstNewlineIndex(code);
if (firstNewline === -1) {
// No newline in file, lets add one.
newCode += _os.EOL;
firstNewline = newCode.length;
} // Prettier only uses these ranges for detecting whitespace, so this nonsensical
// range is safe.
// $FlowExpectedError[cannot-write]
comment.range = [firstNewline + 1, firstNewline];
return newCode;
}
function appendCommentToSource(code, comment, placement) {

@@ -186,16 +206,3 @@ let newCode = code;

{
// Since we always want a line break we need to ensure a newline is found when
// searching out from either side of the comment range.
let firstNewline = getFirstNewlineIndex(code);
if (firstNewline === -1) {
// No newline in file, lets add one.
newCode += _os.EOL;
firstNewline = newCode.length;
} // Prettier only uses these ranges for detecting whitespace, so this nonsensical
// range is safe.
// $FlowExpectedError[cannot-write]
comment.range = [firstNewline + 1, firstNewline];
newCode = makeCommentOwnLine(code, comment);
break;

@@ -202,0 +209,0 @@ }

{
"name": "hermes-transform",
"version": "0.10.1",
"version": "0.11.0",
"description": "Tools built on top of Hermes-ESTree to enable codebase transformation",

@@ -15,5 +15,5 @@ "main": "dist/index.js",

"flow-enums-runtime": "^0.0.6",
"hermes-eslint": "0.10.1",
"hermes-estree": "0.10.1",
"hermes-parser": "0.10.1"
"hermes-eslint": "0.11.0",
"hermes-estree": "0.11.0",
"hermes-parser": "0.11.0"
},

@@ -20,0 +20,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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