Socket
Socket
Sign inDemoInstall

pug

Package Overview
Dependencies
8
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta2 to 2.0.0-beta3

38

lib/index.js

@@ -37,3 +37,2 @@ 'use strict';

function applyPlugins(value, options, plugins, name) {

@@ -48,2 +47,17 @@ return plugins.reduce(function (value, plugin) {

}
function findReplacementFunc(plugins, name) {
var eligiblePlugins = plugins.filter(function (plugin) {
return plugin[name];
});
if (eligiblePlugins.length > 1) {
throw new Error('Two or more plugins all implement ' + name + ' method.');
} else if (eligiblePlugins.length) {
return eligiblePlugins[0][name];
} else {
return null;
}
}
/**

@@ -113,5 +127,23 @@ * Object for global custom filters. Note that you can also just pass a `filters`

},
read: function (filename) {
resolve: function (filename, source, loadOptions) {
var replacementFunc = findReplacementFunc(plugins, 'resolve');
if (replacementFunc) {
return replacementFunc(filename, source, options);
}
return load.resolve(filename, source, loadOptions);
},
read: function (filename, loadOptions) {
dependencies.push(filename);
var str = applyPlugins(fs.readFileSync(filename, 'utf8'), {filename: filename}, plugins, 'preLex');
var contents;
var replacementFunc = findReplacementFunc(plugins, 'read');
if (replacementFunc) {
contents = replacementFunc(filename, options);
} else {
contents = load.read(filename, loadOptions);
}
var str = applyPlugins(contents, {filename: filename}, plugins, 'preLex');
debug_sources[filename] = str;

@@ -118,0 +150,0 @@ return str;

2

package.json
{
"name": "pug",
"description": "A clean, whitespace-sensitive template language for writing HTML",
"version": "2.0.0-beta2",
"version": "2.0.0-beta3",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -6,0 +6,0 @@ "maintainers": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc