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

benchpressjs

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

benchpressjs - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

2

build/benchpress.min.js

@@ -1,3 +0,3 @@

/*! benchpressjs by psychobunny, built on 2021-01-04 */
/*! benchpressjs by psychobunny, built on 2021-02-13 */
"function"==typeof define&&define.amd&&define("benchpress",function(){var t=function(){"use strict";function t(e){return e==null||Array.isArray(e)&&e.length===0?"":e}function o(e,n){if(!e||typeof e!=="object")return"";var r="";var t=Object.keys(e);var o=t.length;for(var u=0;u<o;u+=1){var i=t[u];r+=n(i,u,o,e[i])}return r}function u(e,n,r,t){if(typeof n[r]!=="function")return"";try{var o=n[r].apply(e,t);return o||""}catch(e){return""}}function e(e,n,r){return t(r(e,n,t,o,u)).toString()}if(typeof Promise.try!=="function")Promise.try={try:function e(n){return new Promise(function(e){return e(n())})}}.try;return e}();"use strict";var o=typeof module==="object"&&module.exports?module.exports:{};o.runtime=t,o.helpers={},o.registerHelper=function e(n,r){o.helpers[n]=r};var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},n=function e(n){return r[n]},u=/[&<>"'`=]/g;o.registerHelper("__escape",function(e){if(e==null)return"";if(!e)return String(e);return e.toString().replace(u,n)}),o.cache={},o.globals={},o.setGlobal=function e(n,r){o.globals[n]=r};var i=Object.assign||jQuery.extend;function c(t){return new Promise(function(n,e){var r=o.loader(t,function(e){n(e)});if(r&&r.then)r.then(n,e)})}function f(e,n,r){n=o.addGlobals(n||{});return Promise.try(function(){o.cache[e]=o.cache[e]||c(e);return o.cache[e]}).then(function(e){if(r)e=e.blocks&&e.blocks[r];if(!e)return"";return t(o.helpers,n,e)})}function e(e,n,r,t){if(console.warn("Deprecated: Benchpress.parse is deprecated, to be removed in v3.0.0"),!t&&"object"==typeof n&&"function"==typeof r)t=r,r=n,n=null;if("function"!=typeof t)throw TypeError("Invalid Arguments: callback must be a function");if(!e)return void t("");f(e,r,n).then(function(e){return setTimeout(t,0,e)},function(e){return console.error(e)})}return o.addGlobals=function(e){return i({},o.globals,e)},o.flush=function(){o.cache={}},o.render=f,o.parse=function(e,n,r,t){console.warn("Deprecated: Benchpress.parse is deprecated, to be removed in v3.0.0"),t||"object"!=typeof n||"function"!=typeof r||(t=r,r=n,n=null);if("function"!=typeof t)throw TypeError("Invalid Arguments: callback must be a function");if(!e)return void t("");f(e,r,n).then(function(e){return setTimeout(t,0,e)},function(e){return console.error(e)})},o.registerLoader=function(e){o.loader=e},o});
/* tslint:disable */
/* eslint-disable */
/**
* @param {string} source
* @param {string} filename
* @returns {string}
* @param {string} source
* @param {string} filename
* @returns {string}
*/
export function compile(source: string, filename: string): string;
let imports = {};
imports['__wbindgen_placeholder__'] = module.exports;
let wasm;
const { TextDecoder } = require(String.raw`util`);
const { TextDecoder, TextEncoder } = require(String.raw`util`);

@@ -53,16 +53,52 @@ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });

let cachegetNodeBufferMemory0 = null;
function getNodeBufferMemory0() {
if (cachegetNodeBufferMemory0 === null || cachegetNodeBufferMemory0.buffer !== wasm.memory.buffer) {
cachegetNodeBufferMemory0 = Buffer.from(wasm.memory.buffer);
}
return cachegetNodeBufferMemory0;
let cachedTextEncoder = new TextEncoder('utf-8');
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
});
function passStringToWasm0(arg, malloc) {
function passStringToWasm0(arg, malloc, realloc) {
const len = Buffer.byteLength(arg);
const ptr = malloc(len);
getNodeBufferMemory0().write(arg, ptr, len);
WASM_VECTOR_LEN = len;
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length);
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len);
const mem = getUint8Memory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3);
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
}
WASM_VECTOR_LEN = offset;
return ptr;

@@ -85,2 +121,3 @@ }

try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);

@@ -90,7 +127,8 @@ var len0 = WASM_VECTOR_LEN;

var len1 = WASM_VECTOR_LEN;
wasm.compile(8, ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[8 / 4 + 0];
var r1 = getInt32Memory0()[8 / 4 + 1];
wasm.compile(retptr, ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);

@@ -130,7 +168,7 @@ }

module.exports.__wbg_error_b23efba5bfb5cec5 = function(arg0) {
module.exports.__wbg_error_9783be44659339ea = function(arg0) {
console.error(getObject(arg0));
};
module.exports.__wbg_warn_942f927afebcc748 = function(arg0) {
module.exports.__wbg_warn_632e55193637edf0 = function(arg0) {
console.warn(getObject(arg0));

@@ -137,0 +175,0 @@ };

@@ -19,2 +19,9 @@ <!--

## Version 2.4.1 (2021-02-13)
### Fixes
- Allow `/` in paths [#102](https://github.com/benchpressjs/benchpressjs/issues/102)
- Add a warning for probable template token syntax errors
## Version 2.4.0 (2021-01-04)

@@ -21,0 +28,0 @@

{
"name": "benchpressjs",
"version": "2.4.0",
"version": "2.4.1",
"author": "psychobunny <psycho.bunny@hotmail.com>",

@@ -24,9 +24,9 @@ "description": "An ultralight and super fast templating framework",

"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-transform-arrow-functions": "^7.12.1",
"@babel/plugin-transform-block-scoped-functions": "^7.12.1",
"@babel/plugin-transform-block-scoping": "^7.12.1",
"@babel/plugin-transform-function-name": "^7.12.1",
"@babel/plugin-transform-shorthand-properties": "^7.12.1",
"@babel/core": "^7.12.16",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-transform-arrow-functions": "^7.12.13",
"@babel/plugin-transform-block-scoped-functions": "^7.12.13",
"@babel/plugin-transform-block-scoping": "^7.12.13",
"@babel/plugin-transform-function-name": "^7.12.13",
"@babel/plugin-transform-shorthand-properties": "^7.12.13",
"async": "^3.2.0",

@@ -36,4 +36,4 @@ "babel-eslint": "^10.1.0",

"coveralls": "^3.1.0",
"documentation": "^13.1.0",
"eslint": "^7.13.0",
"documentation": "^13.1.1",
"eslint": "^7.20.0",
"eslint-config-airbnb-base": "^14.2.1",

@@ -49,5 +49,5 @@ "eslint-plugin-import": "^2.22.1",

"mkdirp": "^1.0.4",
"mocha": "^8.2.1",
"mocha": "^8.3.0",
"nyc": "^15.1.0",
"uglify-js": "^3.11.5"
"uglify-js": "^3.12.8"
},

@@ -54,0 +54,0 @@ "license": "MIT",

@@ -25,9 +25,17 @@ # <img alt="benchpress" src="https://cdn.rawgit.com/benchpressjs/benchpressjs/master/benchpress.svg" />

```js
const fs = require('fs').promises;
const benchpress = require('benchpressjs');
const template = 'My favourite forum software is {forum}. This templating engine is written in {language}.';
benchpress.precompile(template, { filename: "your-file.tpl" }).then((precompiled) => {
// store it somewhere
});
// precompiled output
const template = await fs.readFile('path/to/source/templates/favorite.tpl', 'utf8');
const compiled = benchpress.precompile(template, { filename: 'favorite.tpl' });
await fs.writeFile('path/to/compiled/templates/favorite.jst', compiled);
```
`path/to/source/templates/favorite.tpl`
```html
My favourite forum software is {forum}. This templating engine is written in {language}.
```
`path/to/compiled/templates/favorite.jst`
```js
(function (factory) {

@@ -71,3 +79,3 @@ if (typeof module === 'object' && module.exports) {

app.get('/myroute', function(res, req, next) {
app.get('/myroute', function(req, res, next) {
res.render('myview', data);

@@ -74,0 +82,0 @@ });

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