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

jsx2tag

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

jsx2tag - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

17

cjs/index.js

@@ -21,2 +21,3 @@ 'use strict';

const place = (_, $) => ('@' + $.toLowerCase());
const fragment = ['', ''];

@@ -86,3 +87,8 @@ /**

const component = typeof entry === 'function';
// avoid dealing with µbe classes
// handle fragments as tag array
if (component && entry === h)
return tag.call(this, fragment, children);
// handle classes and component callbacks (keep µbe classes around)
if (component && !('tagName' in entry)) {

@@ -93,2 +99,4 @@ // pass {...props, children} to the component

}
// handler µbe classes or regular HTML/SVG/XML cases
const template = ['<'];

@@ -109,2 +117,4 @@ const args = [template];

}
// handle children or self-closing XML tags
const {length} = children;

@@ -121,2 +131,4 @@ template[i] += (length || !xml) ? '>' : ' />';

}
// handle closing tag
if (

@@ -138,2 +150,4 @@ length || (

}
// be sure the template argument is always the same
const whole = template.join(er);

@@ -143,4 +157,5 @@ args[0] = cache.get(whole) || template;

cache.set(whole, template);
return tag.apply(this, args);
};
exports.createPragma = createPragma;

@@ -20,2 +20,3 @@ /*! (c) Andrea Giammarchi - ISC */

const place = (_, $) => ('@' + $.toLowerCase());
const fragment = ['', ''];

@@ -84,3 +85,8 @@ /**

const component = typeof entry === 'function';
// avoid dealing with µbe classes
// handle fragments as tag array
if (component && entry === h)
return tag.call(this, fragment, children);
// handle classes and component callbacks (keep µbe classes around)
if (component && !('tagName' in entry)) {

@@ -91,2 +97,4 @@ // pass {...props, children} to the component

}
// handler µbe classes or regular HTML/SVG/XML cases
const template = ['<'];

@@ -107,2 +115,4 @@ const args = [template];

}
// handle children or self-closing XML tags
const {length} = children;

@@ -119,2 +129,4 @@ template[i] += (length || !xml) ? '>' : ' />';

}
// handle closing tag
if (

@@ -136,2 +148,4 @@ length || (

}
// be sure the template argument is always the same
const whole = template.join(er);

@@ -141,3 +155,4 @@ args[0] = cache.get(whole) || template;

cache.set(whole, template);
return tag.apply(this, args);
};

2

package.json
{
"name": "jsx2tag",
"version": "0.1.2",
"version": "0.1.3",
"description": "Enable JSX for Template Literal Tags based projects",

@@ -5,0 +5,0 @@ "main": "./cjs/index.js",

@@ -29,2 +29,5 @@ # JSX2TAG

```js
/** @jsx h */
/** @jsxFrag h */
// your template literal library of choice

@@ -61,4 +64,11 @@ const {render, html} = require('uhtml-ssr');

Follow [@Robbb_J](https://twitter.com/Robbb_J) post [about minimal requirements](https://blog.r0b.io/post/using-jsx-without-react/) and you'll be good.
Specify `pragma` and `pragmaFrag` or use this syntax on top:
```js
/** @jsx h */
/** @jsxFrag h */
```
Otherwise, follow [@Robbb_J](https://twitter.com/Robbb_J) post [about minimal requirements](https://blog.r0b.io/post/using-jsx-without-react/) and you'll be good.
A huge thanks to him for writing such simple, step by step, guide.
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