Skip to content

Commit 2cbb089

Browse files
committed
fix: Update handlebars to 4.7
1 parent 91cfe2e commit 2cbb089

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"dependencies": {
3333
"@types/minimatch": "3.0.3",
3434
"fs-extra": "^8.1.0",
35-
"handlebars": "~4.5.3",
35+
"handlebars": "^4.7.0",
3636
"highlight.js": "^9.17.1",
3737
"lodash": "^4.17.15",
3838
"marked": "^0.8.0",

src/lib/output/plugins/MarkedPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class MarkedPlugin extends ContextAwareRendererComponent {
139139
const contents = FS.readFileSync(path, 'utf-8');
140140
if (path.substr(-4).toLocaleLowerCase() === '.hbs') {
141141
const template = Handlebars.compile(contents);
142-
return template(context);
142+
return template(context, { allowProtoMethodsByDefault: true, allowProtoPropertiesByDefault: true });
143143
} else {
144144
return contents;
145145
}

src/lib/output/renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class Renderer extends ChildableComponent<Application, RendererComponent>
163163

164164
// Theme must be set as this is only called in render, and render ensures theme is set.
165165
page.template = page.template || this.theme!.resources.templates.getResource(page.templateName)!.getTemplate();
166-
page.contents = page.template(page);
166+
page.contents = page.template(page, { allowProtoMethodsByDefault: true, allowProtoPropertiesByDefault: true });
167167

168168
this.trigger(PageEvent.END, page);
169169
if (page.isDefaultPrevented) {

src/lib/output/utils/resources/templates.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export class Template<T = any> extends Resource {
1717
return this.template;
1818
}
1919

20-
render(context: any, options?: any): string {
20+
render(context: any, options?: Handlebars.RuntimeOptions): string {
2121
const template = this.getTemplate();
22-
return template(context, options);
22+
return template(context, { ...options, allowProtoMethodsByDefault: true, allowProtoPropertiesByDefault: true });
2323
}
2424
}
2525

0 commit comments

Comments
 (0)