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

htmltemplate-transform

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmltemplate-transform - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "htmltemplate-transform",
"version": "0.0.1",
"version": "0.0.2",
"description": "Pluggable transforms for HTML::Template",

@@ -5,0 +5,0 @@ "main": "index.js",

var fs = require('fs');
var path = require('path');
var crypto = require('crypto');
var assert = require('assert');

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

var resolvePath = options.resolvePath;
var hashTemplateFileName = options.hashTemplateFileName || hash;

@@ -30,2 +28,4 @@ assert(Array.isArray(tags), 'Expected options.includeTags to be an array of available include tags.');

if (this.isRoot && !isNested) {
this.state.parentFilePath = this.state.rootFilepath;
this.after(function(root) {

@@ -64,5 +64,11 @@ this.update(

var include = resolvePath(node.name, state.rootFilepath, filename);
var id = hashTemplateFileName(include);
var include = resolvePath(node.name, state.parentFilePath, filename);
var id = filepathAsBlockId(
// Resolving the included filepath against root filepath to
// have both human-readable output and disregard project
// location.
path.relative(path.dirname(state.rootFilepath), include)
);
var ast = parser.parse(

@@ -75,3 +81,3 @@ fs.readFileSync(include, 'utf8'),

this.state = assign({}, state, {
rootFilepath: include
parentFilePath: include
});

@@ -126,6 +132,6 @@

function hash(string) {
return 'block_' + crypto.createHash('md5').update(string).digest('hex');
function filepathAsBlockId(string) {
return string.replace(/[^a-zA-Z0-9_]/g, '_');
}
module.exports = inline;

@@ -8,3 +8,3 @@ [

"type": "SingleAttribute",
"name": "nested-include_inc"
"name": "inc_nested_include_inc"
}

@@ -59,3 +59,3 @@ ],

"type": "SingleAttribute",
"name": "include_inc"
"name": "inc_include_inc"
}

@@ -83,3 +83,3 @@ ],

"type": "SingleAttribute",
"name": "nested-include_inc"
"name": "inc_nested_include_inc"
},

@@ -158,3 +158,3 @@ {

"type": "SingleAttribute",
"name": "include_inc"
"name": "inc_include_inc"
}

@@ -177,3 +177,3 @@ ]

"type": "SingleAttribute",
"name": "nested-include_inc"
"name": "inc_nested_include_inc"
},

@@ -180,0 +180,0 @@ {

@@ -26,7 +26,2 @@ var fs = require('fs');

return path.resolve(path.dirname(from), to);
},
// NOTE: This is just to make sure that tests have the same
// regardless of project location.
hashTemplateFileName: function(filename) {
return path.basename(filename).replace(/\./, '_');
}

@@ -33,0 +28,0 @@ })

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