Socket
Socket
Sign inDemoInstall

hermes-parser

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hermes-parser - npm Package Compare versions

Comparing version 0.22.0 to 0.23.0

34

dist/estree/StripComponentSyntax.js

@@ -141,3 +141,5 @@ /**

function mapComponentParameters(params) {
function mapComponentParameters(params, options) {
var _options$reactRuntime;
if (params.length === 0) {

@@ -157,7 +159,8 @@ return {

};
} // Filter out any ref param and capture it's details.
} // Filter out any ref param and capture it's details when targeting React 18.
// React 19+ treats ref as a regular prop for function components.
let refParam = null;
const paramsWithoutRef = params.filter(param => {
const paramsWithoutRef = ((_options$reactRuntime = options.reactRuntimeTarget) != null ? _options$reactRuntime : '18') === '18' ? params.filter(param => {
if (param.type === 'ComponentParameter' && getComponentParameterName(param.name) === 'ref') {

@@ -169,3 +172,3 @@ refParam = param;

return true;
});
}) : params;
const [propTypes, spread] = paramsWithoutRef.reduce(([propTypes, spread], param) => {

@@ -442,3 +445,3 @@ switch (param.type) {

function mapComponentDeclaration(node) {
function mapComponentDeclaration(node, options) {
// Create empty loc for return type annotation nodes

@@ -484,3 +487,3 @@ const createRendersTypeLoc = () => ({

ref
} = mapComponentParameters(node.params);
} = mapComponentParameters(node.params, options);
let forwardRefDetails = null;

@@ -604,7 +607,7 @@

function mapComponentDeclarationIntoList(node, newBody, insertExport) {
function mapComponentDeclarationIntoList(node, newBody, options, insertExport) {
const {
comp,
forwardRefDetails
} = mapComponentDeclaration(node);
} = mapComponentDeclaration(node, options);

@@ -633,3 +636,3 @@ if (forwardRefDetails != null) {

function mapStatementList(stmts) {
function mapStatementList(stmts, options) {
const newBody = [];

@@ -641,3 +644,3 @@

{
mapComponentDeclarationIntoList(node, newBody);
mapComponentDeclarationIntoList(node, newBody, options);
break;

@@ -658,3 +661,3 @@ }

if (((_node$declaration = node.declaration) == null ? void 0 : _node$declaration.type) === 'ComponentDeclaration') {
mapComponentDeclarationIntoList(node.declaration, newBody, componentOrRef => {
mapComponentDeclarationIntoList(node.declaration, newBody, options, componentOrRef => {
switch (componentOrRef.type) {

@@ -712,3 +715,3 @@ case 'FunctionDeclaration':

if (((_node$declaration3 = node.declaration) == null ? void 0 : _node$declaration3.type) === 'ComponentDeclaration') {
mapComponentDeclarationIntoList(node.declaration, newBody, componentOrRef => nodeWith(node, {
mapComponentDeclarationIntoList(node.declaration, newBody, options, componentOrRef => nodeWith(node, {
declaration: componentOrRef

@@ -741,3 +744,3 @@ }));

function transformProgram(program, _options) {
function transformProgram(program, options) {
return _SimpleTransform.SimpleTransform.transformProgram(program, {

@@ -760,3 +763,3 @@ transform(node) {

return nodeWith(node, {
body: mapStatementList(node.body)
body: mapStatementList(node.body, options)
});

@@ -767,6 +770,7 @@ }

{
const consequent = mapStatementList(node.consequent, options);
return nodeWith(node, {
/* $FlowExpectedError[incompatible-call] We know `mapStatementList` will
not return `ModuleDeclaration` nodes if it is not passed any */
consequent: mapStatementList(node.consequent)
consequent
});

@@ -773,0 +777,0 @@ }

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

*/
const ParserOptionsKeys = new Set(['allowReturnOutsideFunction', 'babel', 'flow', 'enableExperimentalComponentSyntax', 'sourceFilename', 'sourceType', 'tokens']);
const ParserOptionsKeys = new Set(['allowReturnOutsideFunction', 'babel', 'flow', 'enableExperimentalComponentSyntax', 'reactRuntimeTarget', 'sourceFilename', 'sourceType', 'tokens']);
exports.ParserOptionsKeys = ParserOptionsKeys;
{
"name": "hermes-parser",
"version": "0.22.0",
"version": "0.23.0",
"description": "A JavaScript parser built from the Hermes engine",

@@ -12,3 +12,3 @@ "main": "dist/index.js",

"dependencies": {
"hermes-estree": "0.22.0"
"hermes-estree": "0.23.0"
},

@@ -15,0 +15,0 @@ "devDependencies": {

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

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