Comparing version 3.0.5 to 3.0.6
@@ -8,5 +8,6 @@ 'use strict' | ||
var path = require('path') | ||
var Cache = require('cache-point') | ||
var DmdOptions = require('./dmd-options') | ||
const path = require('path') | ||
const Cache = require('cache-point') | ||
const DmdOptions = require('./dmd-options') | ||
const dmdVersion = require('../package').version | ||
@@ -25,3 +26,3 @@ /** | ||
} else { | ||
var cached = dmd.cache.readSync([ templateData, options ]) | ||
const cached = dmd.cache.readSync([ templateData, options, dmdVersion ]) | ||
if (cached) { | ||
@@ -40,3 +41,3 @@ return cached | ||
} else { | ||
return dmd.cache.read([ templateData, options ]) | ||
return dmd.cache.read([ templateData, options, dmdVersion ]) | ||
.catch(function () { | ||
@@ -51,12 +52,12 @@ return generate(templateData, options) | ||
function generate (templateData, options) { | ||
var fs = require('fs') | ||
var path = require('path') | ||
var arrayify = require('array-back') | ||
var handlebars = require('handlebars') | ||
var walkBack = require('walk-back') | ||
var DmdOptions = require('./dmd-options') | ||
var FileSet = require('file-set') | ||
const fs = require('fs') | ||
const path = require('path') | ||
const arrayify = require('array-back') | ||
const handlebars = require('handlebars') | ||
const walkBack = require('walk-back') | ||
const DmdOptions = require('./dmd-options') | ||
const FileSet = require('file-set') | ||
function registerPartials (paths) { | ||
var fileSet = new FileSet(paths) | ||
const fileSet = new FileSet(paths) | ||
fileSet.files.forEach(function (file) { | ||
@@ -71,3 +72,3 @@ handlebars.registerPartial( | ||
function registerHelpers (helpers) { | ||
var fileSet = new FileSet(helpers) | ||
const fileSet = new FileSet(helpers) | ||
fileSet.files.forEach(function (file) { | ||
@@ -83,6 +84,6 @@ handlebars.registerHelper(require(path.resolve(process.cwd(), file))) | ||
var inputData = templateData.map(function (row) { | ||
const inputData = templateData.map(function (row) { | ||
return Object.assign({}, row) | ||
}) | ||
var inputOptions = Object.assign({}, options) | ||
const inputOptions = Object.assign({}, options) | ||
@@ -96,3 +97,3 @@ templateData = arrayify(templateData) | ||
/* state module, for sharing with the helpers */ | ||
var state = require('./state') | ||
const state = require('./state') | ||
state.templateData = templateData | ||
@@ -106,5 +107,5 @@ state.options = options | ||
if (options.plugin) { | ||
for (var i = 0; i < options.plugin.length; i++) { | ||
var plugin = options.plugin[i] | ||
var modulePath = '' | ||
for (let i = 0; i < options.plugin.length; i++) { | ||
const plugin = options.plugin[i] | ||
let modulePath = '' | ||
@@ -121,3 +122,3 @@ /* user supplied an existing path */ | ||
/* load the plugin options */ | ||
var pluginOptions = require(modulePath)(options) | ||
const pluginOptions = require(modulePath)(options) | ||
options.partial = options.partial.concat(pluginOptions.partial) | ||
@@ -135,3 +136,3 @@ options.helper = options.helper.concat(pluginOptions.helper) | ||
var compiled = handlebars.compile(options.template, { | ||
const compiled = handlebars.compile(options.template, { | ||
preventIndent: true, | ||
@@ -141,9 +142,10 @@ strict: false | ||
templateData.options = options | ||
var output = compiled(templateData) | ||
dmd.cache.writeSync([ inputData, inputOptions ], output) | ||
const output = compiled(templateData) | ||
dmd.cache.writeSync([ inputData, inputOptions, dmdVersion ], output) | ||
return output | ||
} | ||
/* always skip the cache when custom plugins, partials or helpers are used */ | ||
function skipCache (options) { | ||
return options.noCache || options.plugin.length || options.partial.length || options.helper.length | ||
} |
{ | ||
"name": "dmd", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "dmd (document with markdown) is a collection of handlebars templates for generating markdown documentation from jsdoc-parse input data. It is the default template set used by jsdoc-to-markdown.", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58081
1372