@bigcommerce/stencil-paper-handlebars
Advanced tools
Comparing version 5.11.2 to 5.11.3
13
index.js
@@ -7,3 +7,3 @@ 'use strict'; | ||
const AppError = require('./lib/appError'); | ||
const { CompileError, FormatError, RenderError, DecoratorError, TemplateNotFoundError, ValidationError } = require('./lib/errors'); | ||
const { CompileError, FormatError, RenderError, DecoratorError, TemplateNotFoundError, ValidationError, PrecompileError } = require('./lib/errors'); | ||
@@ -27,2 +27,3 @@ const handlebarsOptions = { | ||
ValidationError, | ||
PrecompileError, | ||
}; | ||
@@ -340,3 +341,3 @@ } | ||
return new Promise((resolve, reject) => { | ||
let precompiledTemplate; | ||
let precompiled, precompiledTemplate; | ||
context = context || {}; | ||
@@ -348,6 +349,10 @@ | ||
// Compile the template | ||
try { | ||
delete this.handlebars.compile; | ||
const precompiled = this.handlebars.precompile(template, handlebarsOptions); | ||
precompiled = this.handlebars.precompile(template, handlebarsOptions); | ||
} catch (e) { | ||
return reject(new PrecompileError(e.message)); | ||
} | ||
try { | ||
eval(`precompiledTemplate = ${precompiled}`); | ||
@@ -354,0 +359,0 @@ template = this.handlebars.template(precompiledTemplate); |
@@ -9,2 +9,3 @@ const AppError = require('./appError'); | ||
class ValidationError extends Error {}; | ||
class PrecompileError extends Error {}; | ||
@@ -17,3 +18,4 @@ module.exports = { | ||
TemplateNotFoundError, | ||
ValidationError | ||
ValidationError, | ||
PrecompileError | ||
}; |
{ | ||
"name": "@bigcommerce/stencil-paper-handlebars", | ||
"version": "5.11.2", | ||
"version": "5.11.3", | ||
"description": "A paper plugin to render pages using Handlebars.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
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
1126837
6189