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

babel-plugin-htm

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-htm - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

41

dist/babel-plugin-htm.js

@@ -5,2 +5,3 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
/**

@@ -23,2 +24,3 @@ * @param {Babel} babel

var inlineVNodes = options.monomorphic || pragma === false;
var symbol = Symbol();

@@ -75,4 +77,30 @@ function dottedIdentifier(keypath) {

function flatten(props, result) {
if ( result === void 0 ) result = [];
var head = props[symbol];
var rest = objectWithoutProperties( props, [symbol] );
var tail = rest;
if (head) { head.forEach(function (obj) {
flatten(obj, result);
}); }
if (Object.keys(tail).length > 0) {
result.push(tail);
}
return result;
}
function spreadNode(args, state) {
// 'Object.assign({}, x)', can be collapsed to 'x'.
if (args.length > 0 && t.isNode(args[0])) {
args.unshift({});
} // 'Object.assign(x)', can be collapsed to 'x'.
if (args.length === 1) {
return propsNode(args[0]);
} // 'Object.assign({}, x)', can be collapsed to 'x'.
if (args.length === 2 && !t.isNode(args[0]) && Object.keys(args[0]).length === 0) {

@@ -87,3 +115,2 @@ return propsNode(args[1]);

function propsNode(props) {
if (props == null) { return t.nullLiteral(); }
return t.isNode(props) ? props : t.objectExpression(Object.keys(props).map(function (key) {

@@ -118,3 +145,3 @@ var value = props[key];

var newTag = typeof tag === 'string' ? t.stringLiteral(tag) : tag;
var newProps = !Array.isArray(props) ? propsNode(props) : spreadNode(props, state);
var newProps = props ? spreadNode(flatten(props), state) : t.nullLiteral();
var newChildren = t.arrayExpression(children.map(childMapper));

@@ -142,6 +169,7 @@ return createVNode(newTag, newProps, newChildren);

Object.assign = function () {
var obj;
var objs = [], len = arguments.length;
while ( len-- ) objs[ len ] = arguments[ len ];
return objs;
return ( obj = {}, obj[symbol] = objs, obj );
};

@@ -169,3 +197,4 @@

var tree = treeify(statics, expr);
path.replaceWith(transform(tree, state));
var node = !Array.isArray(tree) ? transform(tree, state) : t.arrayExpression(tree.map(function (root) { return transform(root, state); }));
path.replaceWith(node);
}

@@ -172,0 +201,0 @@ }

4

package.json
{
"name": "babel-plugin-htm",
"version": "2.0.0",
"version": "2.1.0",
"description": "Babel plugin to compile htm's Tagged Template syntax to hyperscript or inline VNodes.",

@@ -35,4 +35,4 @@ "main": "dist/babel-plugin-htm.js",

"devDependencies": {
"microbundle": "^0.8.3"
"microbundle": "^0.10.1"
}
}

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