New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jsx-dom-runtime

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsx-dom-runtime - npm Package Compare versions

Comparing version 0.20.0 to 0.21.0

162

babel-preset/index.js
import { declarePreset } from '@babel/helper-plugin-utils';
import _createPlugin from '@babel/plugin-transform-react-jsx/lib/create-plugin.js';
const svgTags = new Set([
const svg = [
'svg',

@@ -55,11 +55,134 @@ 'animate',

'use',
]);
];
const html = [
'a',
'abbr',
'address',
'area',
'article',
'aside',
'audio',
'b',
'base',
'bdi',
'bdo',
'big',
'blockquote',
'body',
'br',
'button',
'canvas',
'caption',
'cite',
'code',
'col',
'colgroup',
'data',
'datalist',
'dd',
'del',
'details',
'dfn',
'dialog',
'div',
'dl',
'dt',
'em',
'embed',
'fieldset',
'figcaption',
'figure',
'footer',
'form',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'head',
'header',
'hgroup',
'hr',
'html',
'i',
'iframe',
'img',
'input',
'ins',
'kbd',
'keygen',
'label',
'legend',
'li',
'link',
'main',
'map',
'mark',
'menu',
'menuitem',
'meta',
'meter',
'nav',
'noindex',
'noscript',
'object',
'ol',
'optgroup',
'option',
'output',
'p',
'param',
'picture',
'pre',
'progress',
'q',
'rp',
'rt',
'ruby',
's',
'samp',
'script',
'section',
'select',
'slot',
'small',
'source',
'span',
'strong',
'style',
'sub',
'summary',
'sup',
'table',
'template',
'tbody',
'td',
'textarea',
'tfoot',
'th',
'thead',
'time',
'title',
'tr',
'track',
'u',
'ul',
'var',
'video',
'wbr',
'webview',
];
const svgTags = new Set(svg);
const htmlTags = new Set(html);
const jsxPlugin = (babel) => {
const { types: t } = babel;
const svgNsAttribute = () => {
const createNsAttribute = (val) => {
return t.jSXAttribute(
t.jSXIdentifier('__ns'),
t.JSXExpressionContainer(t.numericLiteral(1))
t.JSXExpressionContainer(t.numericLiteral(val))
);

@@ -72,3 +195,3 @@ };

if (svgTags.has(path.node.name.name)) {
path.node.attributes.push(svgNsAttribute());
path.node.attributes.push(createNsAttribute(1));
}

@@ -79,20 +202,21 @@ },

switch (attr.name) {
case 'className':
case 'classname': {
attr.name = 'class';
break;
if (htmlTags.has(path.parent.name.name)) {
const name = attr.name.toLowerCase();
switch (name) {
case 'classname': {
attr.name = 'class';
return;
}
case 'htmlfor': {
attr.name = 'for';
return;
}
}
case 'htmlFor':
case 'htmlfor': {
attr.name = 'for';
break;
if (attr.name.startsWith('on')) {
attr.name = name;
return;
}
}
if (attr.name.startsWith('on')) {
attr.name = attr.name.toLowerCase();
return;
}
}

@@ -99,0 +223,0 @@ }

4

package.json
{
"name": "jsx-dom-runtime",
"version": "0.20.0",
"version": "0.21.0",
"description": "A tiny in 500 bytes library to JSX syntax templates for DOM",

@@ -38,3 +38,3 @@ "type": "module",

"size": "size-limit",
"dev": "npm run lint && npm run build && npm test && npm run size"
"dev": "npm run lint && npm run build && npx jest --clearCache && npm test && npm run size"
},

@@ -41,0 +41,0 @@ "dependencies": {

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