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.9.3 to 0.9.4

2

build/vash-runtime.js

@@ -27,3 +27,3 @@ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.vash=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

"description": "Razor syntax for JS templating",
"version": "0.9.3",
"version": "0.9.4",
"author": "Andrew Petersen <senofpeter@gmail.com>",

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

@@ -0,1 +1,57 @@

v0.9.4
=====
* Fix else if. Fix #91
* Allow `@{ @(exp) }` again. Fixes #89
v0.9.3
=====
* Track next non whitespace or newline character. fix #82
v0.9.2
=====
* Allow two-letter tlds for email addresses. #80
v0.9.1
=====
* Throw errors when attempting to close known void tags. #67
v0.9.0
=====
* BREAKING: enforce closing tags. #77
v0.8.8
=====
* Ensure html comments are closed properly. #77
v0.8.7
=====
* Handle html comments. #70
v0.8.6
=====
* Handle markup nodes that lose their content. #68
v0.8.5
=====
* Ensure .name is present on node ctors. #73
v0.8.4
=====
* dashes within tag names are ok. fix #71
v0.8.2
=====
* remove deprecation warnings. apparently razor allows that. #59, #62
v0.8.1

@@ -2,0 +58,0 @@ ======

@@ -1001,2 +1001,11 @@

if (
curr.type === tks.AT && next.type === tks.PAREN_OPEN
) {
// Backwards compatibility, allowing for @for() { @(exp) }
valueNode = this.openNode(new ExpressionNode(), node.values);
updateLoc(valueNode, curr);
return true;
}
var attachmentNode;

@@ -1003,0 +1012,0 @@

@@ -76,3 +76,3 @@ // The order of these is important, as it is the order in which

, 'FUNCTION', (/^(function)(?![\d\w])/)
, 'BLOCK_KEYWORD', (/^(catch|do|else|finally|for|function|goto|if|switch|try|while|with)(?![\d\w])/)
, 'BLOCK_KEYWORD', (/^(catch|do|else if|else|finally|for|function|goto|if|switch|try|while|with)(?![\d\w])/)
, 'KEYWORD', (/^(break|case|continue|instanceof|return|var)(?![\d\w])/)

@@ -79,0 +79,0 @@ , 'IDENTIFIER', (/^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)/)

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

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

@@ -151,4 +151,7 @@ <!-- This document was generated from README.vash -->

Just `require` Vash, and compile. If you want something fancier, try [vashify](https://www.npmjs.com/package/vashify)!
Just `require` Vash, and compile. If you want something fancier, try [vashify](https://www.npmjs.com/package/vashify)! Then you can directly require any `.vash` file and it will be resolved as compiled template:
var tpl = require('my-awesome-template.vash');
document.querySelector('#content').innerHTML = tpl({ t: 'template' });
<a name="browser---requirejs"></a>Browser - RequireJS

@@ -304,3 +307,3 @@ ---------------------------

banana creme
banana cream

@@ -432,3 +435,3 @@ As you can see, Vash does not require a model to be referenced, or even passed in.

@model.forEach(function(item){
item
this should be content @item
})

@@ -438,3 +441,3 @@

(empty string)
(Error when compiling)

@@ -447,3 +450,3 @@ In this situation, you have two options. The first is the `@:` (at colon) escape. It tells Vash that until it sees a newline, treat the input as content, not code.

@model.forEach(function(item){
@: item
@: this should be content @item
})

@@ -453,3 +456,3 @@

a
this should be content a

@@ -1131,3 +1134,3 @@ The other option, in the event that more than one line is needed, is by using an imaginary HTML tag named `<text>`. When Vash sees this tag, it switches to content mode, and discards the tag. This means that the tag will never be output.

-j, --json <json> Pass options to the Vash compiler. See docs for valid options.
-o, --out <path> Write template into <path>' directory
-o, --out <path> Write template into <path> directory
-u, --uglify Uglify the template, safely

@@ -1134,0 +1137,0 @@ -a, --no-autolink Wrap each template in `vash.link`.

@@ -1815,2 +1815,12 @@ var vows = require('vows')

,'else if': {
topic: '@if (!model.w){<p>A</p>} else if (model.w) {<p>B</p>}<p>C</p>'
,'codegen': function( topic ){
var tpl = vash.compile(topic);
assert.equal( tpl({w: false}), '<p>A</p><p>C</p>' );
}
}
,'switch statement': {

@@ -2168,17 +2178,16 @@

topic: function(){
this.lex = function(input){
var l = new vash.VLexer(input)
,tokens = []
,tok;
this.asAST = function (input) {
var Lexer = require('../../lib/lexer');
var Parser = require('../../lib/parser');
var l = new Lexer();
while(tok = l.advance()) tokens.push(tok);
return tokens.reverse();
}
l.write(input);
var tokens = l.read();
this.parse = function(tokens, opts){
opts = vash.vQuery.extend( opts || {}, vash.config );
var p = new Parser();
p.write(tokens);
var more = true;
while(more !== null) more = p.read();
var p = new vash.VParser(tokens, opts);
p.parse();
return p;
return p.stack[0];
}

@@ -2194,16 +2203,3 @@

,'does not close parent tag': function(topic){
var Lexer = require('../../lib/lexer');
var Parser = require('../../lib/parser');
var l = new Lexer();
l.write(topic);
var tokens = l.read();
var p = new Parser();
p.write(tokens);
var more = true;
while(more !== null) more = p.read();
var root = p.stack[0];
var root = this.asAST(topic);
assert.equal( root.body[0].type, 'VashMarkup' );

@@ -2218,2 +2214,17 @@ assert.equal( root.body[0].values[0].type, 'VashMarkupContent' );

}
,'else if else if': {
topic: '@if (a){<p>A</p>} else if (b) {<p>B</p>} else {<p>C</p>}<p>D</p>'
,'has proper structure': function( topic ){
var tpl = vash.compile(topic);
var ast = this.asAST(topic);
var ifBlock = ast.body[0].values[0].values[1];
assert.equal(ifBlock.keyword, 'if');
assert.equal(ifBlock.tail[1].keyword, 'else if');
assert.equal(ifBlock.tail[1].tail[1].keyword, 'else');
}
}
}

@@ -2269,2 +2280,13 @@

,'@expressions within a block': {
topic: '@{ @(model + "b") }'
,'are content': function(topic) {
var tpl = vash.compile(topic);
var actual = tpl('a');
assert.equal(actual, 'ab');
}
}
/*,'implicit compilation': {

@@ -2271,0 +2293,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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