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

odesza

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

odesza - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

45

index.js

@@ -11,6 +11,8 @@ /**

const vm = require('vm');
const p = require('path');
const path = require('path');
const stripComments = require('strip-comments');
const odesza = {};
const blocks = {};
const cache = {

@@ -42,6 +44,5 @@ templates: {},

// strip comments
template = template.replace(/(?:\/\*(?:[\s\S]*?)\*\/)|(?:([\s;])+\/\/(?:.*)$)/gm, '$1');
template = stripComments(template);
var s = getStatements(template);
let s = getStatements(template);

@@ -92,6 +93,6 @@ // if an extend statement is found, fill the extended template blocks in

s.include.forEach(statement => {
let path = `${basePath}${statement}`;
let p = `${basePath}${statement}`;
template = template
.split(`include ${statement}`)
.join(odesza.renderFile(path, options));
.join(odesza.renderFile(p, options));
});

@@ -111,5 +112,5 @@

odesza.renderFile = function(location, options) {
var template;
let basePath = location.substr(0, location.lastIndexOf('/') + 1);
location = resolvePath(location);
var basePath = location.substr(0, location.lastIndexOf('/') + 1);
var template;
if (useCache && cache.templates[location] != null) {

@@ -125,3 +126,3 @@ template = cache.templates[location];

/**
* Disables template and path caching.
* Disables caching.
*

@@ -139,3 +140,3 @@ * @public

* @public
* @param {string} path
* @param {string} file
* @param {object} options

@@ -145,5 +146,5 @@ * @param {function} fn

odesza.__express = function(path, options, fn) {
odesza.__express = function(file, options, fn) {
try {
return fn(null, odesza.renderFile(path, options));
return fn(null, odesza.renderFile(file, options));
} catch (e) {

@@ -180,14 +181,14 @@ return fn(e);

* @private
* @param {string} path The relative path to the file.
* @return {string} The resolved path.
* @param {string} file The relative file to the file.
* @return {string} The resolved path for the file.
*/
function resolvePath(path) {
if (typeof path != 'string') {
throw new TypeError('invalid path: input must be a string');
function resolvePath(file) {
if (typeof file != 'string') {
throw new TypeError('invalid file: input must be a string');
}
if (useCache && cache.paths[path] != null) {
return cache.paths[path];
if (useCache && cache.paths[file] != null) {
return cache.paths[file];
}
var resolvedPath = p.resolve(path);
var resolvedPath = path.resolve(file);
if (!fs.existsSync(resolvedPath)) {

@@ -199,6 +200,6 @@ if (fs.existsSync(`${resolvedPath}.ode`)) {

} else {
throw new Error(`cannot find file with path: ${path}`);
throw new Error(`cannot find file with file: ${file}`);
}
}
cache.paths[path] = resolvedPath;
cache.paths[file] = resolvedPath;
return resolvedPath;

@@ -205,0 +206,0 @@ }

{
"name": "odesza",
"version": "0.4.1",
"version": "0.5.0",
"description": "Write clean, expressive templates with just HTML and inline JavaScript",

@@ -23,4 +23,5 @@ "main": "index.js",

"dependencies": {
"commander": "^2.9.0"
"commander": "^2.9.0",
"strip-comments": "^0.4.2"
}
}
# Odesza
Odesza is a templating engine that allows you to write clean, expressive templates with inline JavaScript.
Odesza is a templating engine that allows you to write clean, expressive templates with inline JavaScript. Some of the features include
- multiple inheritance (extends, includes, blocks)
- multiple inheritance (extends, includes, block scope)
- full access to inline ES6 JavaScript
- support for Express
- no magic or new language to learn
- support for Express framework
- no "magic" or new shorthand to learn

@@ -10,0 +10,0 @@ ### Inspiration

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