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

babel-plugin-realar

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-realar - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

2

package.json
{
"name": "babel-plugin-realar",
"description": "Automatic observe jsx arrow functions for Realar",
"version": "0.2.3",
"version": "0.2.4",
"main": "./src/plugin.js",

@@ -6,0 +6,0 @@ "files": [

@@ -13,3 +13,3 @@ const { is_allowed } = require('./is-allowed');

if (is_allowed(state)) {
view_transform(path, (state.opts || {}).decorator);
view_transform(path, state.opts);
}

@@ -16,0 +16,0 @@ },

const { types, template, traverse } = require('@babel/core');
const default_decorator_fn_name = 'require("realar").observe';
module.exports = {
default_decorator_fn_name,
view_transform,
};
function view_transform(path, decorator_fn_name = default_decorator_fn_name) {
function view_transform(path, opts = {}) {
let cursor = path;

@@ -81,3 +78,8 @@ let cursor_path;

const decorated = template(`${decorator_fn_name}(BODY)`)({
let tpl = `${opts.decorator || 'require("realar").observe'}(BODY)`;
if ((!opts.decorator && opts.memo !== false) || opts.memo === true) {
tpl = `require("react").memo(${tpl})`;
}
const decorated = template(tpl)({
BODY: cursor,

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