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

vash

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vash - npm Package Compare versions

Comparing version 0.8.6 to 0.8.7

lib/nodes/markupcomment.js

10

lib/codegen.js

@@ -93,2 +93,11 @@

gens.VashMarkupComment = function(node, opts, generate) {
return ''
+ bcwrap('<!--')
+ dbgstart(node, opts)
+ node.values.map(generate).join('')
+ dbgend(node, opts)
+ bcwrap('-->');
}
gens.VashBlock = function(node, opts, generate) {

@@ -163,2 +172,3 @@ var hasValues = node.values.length > 0;

|| node.parent.type === 'VashMarkupContent'
|| node.parent.type === 'VashMarkupComment'
|| node.parent.type === 'VashMarkupAttribute'

@@ -165,0 +175,0 @@ || node.parent.type === 'VashProgram';

@@ -12,2 +12,3 @@

var MarkupNode = namer(require('./nodes/markup'));
var MarkupCommentNode = namer(require('./nodes/markupcomment'));
var MarkupContentNode = namer(require('./nodes/markupcontent'));

@@ -411,2 +412,14 @@ var MarkupAttributeNode = namer(require('./nodes/markupattribute'));

if (curr.type === tks.HTML_COMMENT_OPEN) {
valueNode = this.openNode(new MarkupCommentNode(), node.values);
updateLoc(valueNode, curr);
return false;
}
if (curr.type === tks.HTML_COMMENT_CLOSE) {
updateLoc(node, curr);
this.closeNode(node);
return false;
}
if (curr.type === tks.AT_COLON && !curr._considerEscaped) {

@@ -537,2 +550,25 @@ this.flag(node, '_waitingForNewline', true);

Parser.prototype.continueMarkupCommentNode = function(node, curr, next) {
var valueNode = node.values[node.values.length-1];
if (curr.type === tks.HTML_COMMENT_OPEN) {
this.flag(node, '_finishedOpen', true);
this.flag(node, '_waitingForClose', tks.HTML_COMMENT_CLOSE);
updateLoc(node, curr);
valueNode = this.openNode(new MarkupContentNode(), node.values);
return true;
}
if (curr.type === tks.HTML_COMMENT_CLOSE && node._finishedOpen) {
this.flag(node, '_waitingForClose', null);
updateLoc(node, curr);
this.closeNode(node);
return true;
}
valueNode = ensureTextNode(node.values);
appendTextValue(valueNode, curr);
return true;
}
Parser.prototype.continueExpressionNode = function(node, curr, next) {

@@ -539,0 +575,0 @@ var valueNode = node.values[node.values.length-1];

4

lib/tokens.js

@@ -49,2 +49,4 @@ // The order of these is important, as it is the order in which

, 'HTML_TAG_CLOSE', (/^(<\/)/)
, 'HTML_COMMENT_OPEN', (/^(<!--+)/)
, 'HTML_COMMENT_CLOSE', (/^(--+>)/)
, 'LT_SIGN', (/^(<)/)

@@ -56,3 +58,3 @@ , 'GT_SIGN', (/^(>)/)

, 'BITWISE_SHIFT_OPERATOR', (/^(<<|>>>|>>)/)
, 'UNARY_OPERATOR', (/^(delete|typeof|void|\+\+|--|\+|-|~|!)\b/)
, 'UNARY_OPERATOR', (/^(delete\b|typeof\b|void|\+\+|--|\+|-|~|!)/)
, 'RELATIONAL_OPERATOR', (/^(<=|>=|instanceof|in)\b/) // Also <, >

@@ -59,0 +61,0 @@ , 'BINARY_LOGICAL_OPERATOR', (/^(&&|\|\|)\b/)

{
"name": "vash",
"description": "Razor syntax for JS templating",
"version": "0.8.6",
"version": "0.8.7",
"author": "Andrew Petersen <senofpeter@gmail.com>",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/kirbysayshi/vash",

@@ -2059,2 +2059,10 @@ var vows = require('vows')

,'html comments': {
topic: '<!--li><a href="#features">Features</a></li-->'
,'do not break parsing': function(topic) {
var tpl = vash.compile(topic);
assert.equal( tpl(), topic );
}
}
,'single line comments': {

@@ -2061,0 +2069,0 @@ 'near markup': {

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