perf: improve performance by 4x by simplified parseFile

- previously deprecated `getTemplate()` and `getTemplateSync()` not no longer supported
- `opts` no longer support dynamic set in `parseFile()`, `renderFile()` arguments
This commit is contained in:
harttle
2021-09-27 23:04:41 +08:00
parent 6b9f872bcc
commit 24f5346084
14 changed files with 103 additions and 151 deletions
+2 -2
View File
@@ -91,7 +91,7 @@ describe('Liquid', function () {
root: ['/root/'],
extname: '.html'
})
const tpls = await engine.getTemplate('mocha')
const tpls = await engine.parseFileSync('mocha')
expect(tpls.length).to.gte(1)
expect(tpls[0].token.getText()).to.contain('module.exports')
})
@@ -126,7 +126,7 @@ describe('Liquid', function () {
root: ['/boo', '/root/'],
extname: '.html'
})
return expect(() => engine.getTemplateSync('/not/exist.html'))
return expect(() => engine.parseFileSync('/not/exist.html'))
.to.throw(/Failed to lookup "\/not\/exist.html" in "\/boo,\/root\/"/)
})
})