Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fs.appendFileSync(outputFile," function pug_classes_object(val) { var classString = '', padding = ''; for (var key in val) { if (key && val[key] && pug_has_own_property.call(val, key)) { var classString = classString + padding + key; var padding = ' '; } } return classString; }")
fs.appendFileSync(outputFile," function pug_classes_array(val, escaping) { var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping); for (var i = 0; i < val.length; i++) { var className = pug_classes(val[i]); if (!className) continue; escapeEnabled && escaping[i] && (className = pug_escape(className)); var classString = classString + padding + className; var padding = ' '; } return classString; }")
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.merge.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.classes.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.style.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.attr.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.attrs.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
fs.appendFileSync(outputFile," var pug = {\r\n")
fs.appendFileSync(outputFile," merge:" + minify.js(pug.runtime.merge.toString()) + ',\r\n')
fs.appendFileSync(outputFile," classes:" + minify.js(pug.runtime.classes.toString()) + ',\r\n')
fs.appendFileSync(outputFile," style:" + minify.js(pug.runtime.style.toString()) + ',\r\n')
fs.appendFileSync(outputFile," attr:" + minify.js(pug.runtime.attr.toString()) + ',\r\n')
fs.appendFileSync(outputFile," attrs:" + minify.js(pug.runtime.attrs.toString()) + ',\r\n')
fs.appendFileSync(outputFile," escape:" + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + ',\r\n')
fs.appendFileSync(outputFile," rethrow:" + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
fs.appendFileSync(outputFile," }\r\n")
fs.appendFileSync(outputFile,"\r\n")
fs.appendFileSync(outputFile,' var puglatizer = {}')
fs.appendFileSync(outputFile,"\r\n")
return callback()
},
// Here we build all the pug functions
const fs = require('fs');
const path = require('path');
const autoBind = require('auto-bind');
const pug = require('pug');
const debug = require('debug')('cache-pug-templates');
const _ = require('lodash');
const rateLimit = require('function-rate-limit');
//
for (const [key, value] of Object.entries(pug.runtime)) {
pug[key] = value;
}
class CachePugTemplates {
constructor(config) {
this.config = {
app: false,
views: false,
logger: console,
callback: false,
cache: true,
concurrency: 1,
interval: 500,
...config
};
function(callback) {
fs.appendFileSync(outputFile,";(function(root,factory){\r\n")
fs.appendFileSync(outputFile," if (typeof define === 'function' && define.amd) {\r\n")
fs.appendFileSync(outputFile," define([], factory);\r\n")
fs.appendFileSync(outputFile," } else if (typeof exports === 'object') {\r\n")
fs.appendFileSync(outputFile," module.exports = factory();\r\n")
fs.appendFileSync(outputFile," } else {\r\n")
fs.appendFileSync(outputFile," if (typeof root === 'undefined' || root !== Object(root)) {\r\n")
fs.appendFileSync(outputFile," throw new Error('puglatizer: window does not exist or is not an object');\r\n")
fs.appendFileSync(outputFile," }\r\n")
fs.appendFileSync(outputFile," root.puglatizer = factory();\r\n")
fs.appendFileSync(outputFile," }\r\n")
fs.appendFileSync(outputFile,"}(this, function () {\r\n")
fs.appendFileSync(outputFile," function pug_classes_object(val) { var classString = '', padding = ''; for (var key in val) { if (key && val[key] && pug_has_own_property.call(val, key)) { var classString = classString + padding + key; var padding = ' '; } } return classString; }")
fs.appendFileSync(outputFile," function pug_classes_array(val, escaping) { var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping); for (var i = 0; i < val.length; i++) { var className = pug_classes(val[i]); if (!className) continue; escapeEnabled && escaping[i] && (className = pug_escape(className)); var classString = classString + padding + className; var padding = ' '; } return classString; }")
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.merge.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.classes.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.style.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.attr.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.attrs.toString()) + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + '\r\n')
fs.appendFileSync(outputFile," " + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
fs.appendFileSync(outputFile," var pug = {\r\n")
fs.appendFileSync(outputFile," merge:" + minify.js(pug.runtime.merge.toString()) + ',\r\n')
fs.appendFileSync(outputFile," classes:" + minify.js(pug.runtime.classes.toString()) + ',\r\n')
fs.appendFileSync(outputFile," style:" + minify.js(pug.runtime.style.toString()) + ',\r\n')
fs.appendFileSync(outputFile," attr:" + minify.js(pug.runtime.attr.toString()) + ',\r\n')
fs.appendFileSync(outputFile," attrs:" + minify.js(pug.runtime.attrs.toString()) + ',\r\n')
fs.appendFileSync(outputFile," escape:" + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + ',\r\n')
fs.appendFileSync(outputFile," rethrow:" + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
fs.appendFileSync(outputFile," }\r\n")
fs.appendFileSync(outputFile,"\r\n")