Socket
Socket
Sign inDemoInstall

hast-util-to-estree

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hast-util-to-estree - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

34

index.js

@@ -46,9 +46,9 @@ 'use strict'

if (result.type !== 'JSXFragment' && result.type !== 'JSXElement') {
result = createJsxFragment(null, [result])
result = createJsxFragment(tree, [result])
}
body.push(create(null, {type: 'ExpressionStatement', expression: result}))
body.push(create(tree, {type: 'ExpressionStatement', expression: result}))
}
return create(null, {type: 'Program', body: body, sourceType: 'module'})
return create(tree, {type: 'Program', body: body, sourceType: 'module'})
}

@@ -199,3 +199,6 @@

expression:
(node.data && node.data.estree) ||
(node.data &&
node.data.estree &&
node.data.estree.body[0] &&
node.data.estree.body[0].expression) ||
create(node, {type: 'JSXEmptyExpression'})

@@ -205,2 +208,3 @@ })

// eslint-disable-next-line complexity
function mdxJsxElement(node, context) {

@@ -242,3 +246,6 @@ var parentSchema = context.schema

expression:
(attr.value.data && attr.value.data.estree) ||
(attr.value.data &&
attr.value.data.estree &&
attr.value.data.estree.body[0] &&
attr.value.data.estree.body[0].expression) ||
create(null, {type: 'JSXEmptyExpression'})

@@ -261,3 +268,9 @@ })

argument:
(attr.data && attr.data.estree && attr.data.estree.argument) ||
(attr.data &&
attr.data.estree &&
attr.data.estree.body[0] &&
attr.data.estree.body[0].expression &&
attr.data.estree.body[0].expression.properties &&
attr.data.estree.body[0].expression.properties[0] &&
attr.data.estree.body[0].expression.properties[0].argument) ||
create(null, {type: 'ObjectExpression', properties: {}})

@@ -391,13 +404,16 @@ })

function create(hast, estree) {
function create(hast, esnode) {
var p = position(hast)
if (p.start.line) {
estree.loc = {
esnode.start = p.start.offset
esnode.end = p.end.offset
esnode.loc = {
start: {line: p.start.line, column: p.start.column - 1},
end: {line: p.end.line, column: p.end.column - 1}
}
esnode.range = [p.start.offset, p.end.offset]
}
return estree
return esnode
}

@@ -404,0 +420,0 @@

{
"name": "hast-util-to-estree",
"version": "1.0.3",
"version": "1.1.0",
"description": "hast utility to transform to estree (JavaScript AST) JSX",

@@ -57,3 +57,3 @@ "license": "MIT",

"mdast-util-to-hast": "^10.1.0",
"micromark-extension-mdxjs": "^0.1.0",
"micromark-extension-mdxjs": "^0.3.0",
"nyc": "^15.0.0",

@@ -60,0 +60,0 @@ "prettier": "^2.0.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