edge.js
Advanced tools
Comparing version 5.3.5 to 5.3.6
@@ -69,3 +69,3 @@ import { Parser } from 'edge-parser'; | ||
*/ | ||
compile(templatePath: string, localVariables?: string[]): LoaderTemplate; | ||
compile(templatePath: string, localVariables?: string[], skipCache?: boolean): LoaderTemplate; | ||
/** | ||
@@ -72,0 +72,0 @@ * Compiles the template contents to string. The output is same as the `edge-parser`, |
@@ -200,5 +200,5 @@ "use strict"; | ||
*/ | ||
compile(templatePath, localVariables) { | ||
compile(templatePath, localVariables, skipCache = false) { | ||
const absPath = this.loader.makePath(templatePath); | ||
let cachedResponse = this.cacheManager.get(absPath); | ||
let cachedResponse = skipCache ? null : this.cacheManager.get(absPath); | ||
/** | ||
@@ -216,3 +216,5 @@ * Process the template and cache it | ||
const template = buffer.flush(); | ||
this.cacheManager.set(absPath, { template }); | ||
if (!skipCache) { | ||
this.cacheManager.set(absPath, { template }); | ||
} | ||
cachedResponse = { template }; | ||
@@ -219,0 +221,0 @@ } |
@@ -103,3 +103,3 @@ /** | ||
claimTag(fn: ClaimTagFn): this; | ||
compile(templatePath: string, localVariables?: string[]): LoaderTemplate; | ||
compile(templatePath: string, localVariables?: string[], skipCache?: boolean): LoaderTemplate; | ||
tokenize(templatePath: string, parser?: Parser): Token[]; | ||
@@ -106,0 +106,0 @@ /** |
@@ -99,3 +99,3 @@ "use strict"; | ||
compilePartial(templatePath, ...localVariables) { | ||
const { template: compiledTemplate } = this.compiler.compile(templatePath, localVariables); | ||
const { template: compiledTemplate } = this.compiler.compile(templatePath, localVariables, true); | ||
return this.wrapToFunction(compiledTemplate, ...localVariables); | ||
@@ -102,0 +102,0 @@ } |
{ | ||
"name": "edge.js", | ||
"version": "5.3.5", | ||
"version": "5.3.6", | ||
"description": "Template engine", | ||
@@ -41,3 +41,3 @@ "main": "build/index.js", | ||
"@poppinss/dev-utils": "^2.0.3", | ||
"@types/node": "^17.0.25", | ||
"@types/node": "^17.0.34", | ||
"commitizen": "^4.2.4", | ||
@@ -47,4 +47,4 @@ "cz-conventional-changelog": "^3.3.0", | ||
"del-cli": "^4.0.1", | ||
"doctoc": "^2.1.0", | ||
"eslint": "^8.13.0", | ||
"doctoc": "^2.2.0", | ||
"eslint": "^8.15.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
@@ -54,3 +54,3 @@ "eslint-plugin-adonis": "^2.1.0", | ||
"github-label-sync": "^2.2.0", | ||
"husky": "^7.0.4", | ||
"husky": "^8.0.1", | ||
"japa": "^4.0.0", | ||
@@ -60,3 +60,3 @@ "mrm": "^4.0.0", | ||
"prettier": "^2.6.2", | ||
"typescript": "^4.6.3" | ||
"typescript": "^4.6.4" | ||
}, | ||
@@ -63,0 +63,0 @@ "config": { |
141617
4096