bajo-template 2.9.3 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.github/FUNDING.yml +0 -0
  2. package/.github/workflows/repo-lockdown.yml +0 -0
  3. package/.jsdoc.conf.json +0 -0
  4. package/LICENSE +0 -0
  5. package/README.md +0 -0
  6. package/docs/BajoTemplate.html +0 -0
  7. package/docs/data/search.json +0 -0
  8. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  9. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  10. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  11. package/docs/global.html +0 -0
  12. package/docs/index.html +0 -0
  13. package/docs/index.js.html +0 -0
  14. package/docs/lib_imports.js.html +0 -0
  15. package/docs/module-Imports.html +0 -0
  16. package/docs/scripts/core.js +0 -0
  17. package/docs/scripts/core.min.js +0 -0
  18. package/docs/scripts/resize.js +0 -0
  19. package/docs/scripts/search.js +0 -0
  20. package/docs/scripts/search.min.js +5 -5
  21. package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
  22. package/docs/scripts/third-party/fuse.js +0 -0
  23. package/docs/scripts/third-party/hljs-line-num-original.js +0 -0
  24. package/docs/scripts/third-party/hljs-line-num.js +0 -0
  25. package/docs/scripts/third-party/hljs-original.js +0 -0
  26. package/docs/scripts/third-party/hljs.js +0 -0
  27. package/docs/scripts/third-party/popper.js +0 -0
  28. package/docs/scripts/third-party/tippy.js +0 -0
  29. package/docs/scripts/third-party/tocbot.js +0 -0
  30. package/docs/scripts/third-party/tocbot.min.js +0 -0
  31. package/docs/static/bitcoin.jpeg +0 -0
  32. package/docs/static/home.md +0 -0
  33. package/docs/static/logo-ecosystem.png +0 -0
  34. package/docs/static/logo.png +0 -0
  35. package/docs/styles/clean-jsdoc-theme-base.css +0 -0
  36. package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
  37. package/docs/styles/clean-jsdoc-theme-light.css +0 -0
  38. package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
  39. package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
  40. package/docs/styles/clean-jsdoc-theme.min.css +0 -0
  41. package/extend/bajo/intl/en-US.json +0 -0
  42. package/extend/bajo/intl/id.json +0 -0
  43. package/extend/bajoTemplate/layout/default.html +0 -0
  44. package/extend/bajoTemplate/layout/email.html +0 -0
  45. package/extend/bajoTemplate/layout/email.id.html +0 -0
  46. package/extend/bajoTemplate/partial/script-block.html +0 -0
  47. package/extend/bajoTemplate/partial/style-block.html +0 -0
  48. package/index.js +4 -34
  49. package/lib/imports.js +169 -170
  50. package/package.json +1 -1
  51. package/test/bajo-template.test.js +275 -275
  52. package/wiki/CHANGES.md +74 -69
  53. package/wiki/CONFIG.md +0 -0
  54. package/wiki/CONTRIBUTING.md +0 -0
@@ -1,275 +1,275 @@
1
- /* global describe, it, beforeEach */
2
-
3
- import fs from 'node:fs'
4
- import os from 'node:os'
5
- import path from 'node:path'
6
- import { expect } from 'chai'
7
-
8
- import factory from '../index.js'
9
-
10
- const createTempRoot = () => fs.mkdtempSync(path.join(os.tmpdir(), 'bajo-template-test-'))
11
-
12
- describe('BajoTemplate', () => {
13
- let app
14
- let BajoTemplate
15
-
16
- beforeEach(async () => {
17
- const lodashLike = {
18
- get: (obj, p, defValue) => {
19
- const parts = p.split('.')
20
- let cur = obj
21
- for (const part of parts) {
22
- if (cur == null || !(part in cur)) return defValue
23
- cur = cur[part]
24
- }
25
- return cur
26
- },
27
- omit: (obj, keys) => Object.fromEntries(Object.entries(obj).filter(([k]) => !keys.includes(k))),
28
- last: (arr) => arr[arr.length - 1],
29
- isEmpty: (val) => {
30
- if (val == null) return true
31
- if (Array.isArray(val) || typeof val === 'string') return val.length === 0
32
- if (typeof val === 'object') return Object.keys(val).length === 0
33
- return false
34
- },
35
- isPlainObject: (val) => Object.prototype.toString.call(val) === '[object Object]',
36
- isArray: Array.isArray,
37
- filter: (arr, fn) => arr.filter(fn),
38
- map: (arr, fn) => arr.map(fn),
39
- template: (content) => {
40
- return (locals) => `compiled:${content}:${locals.name ?? ''}`
41
- }
42
- }
43
-
44
- app = {
45
- lib: {
46
- fs,
47
- _: lodashLike,
48
- aneka: {
49
- titleize: (text) => text.split(' ').map(w => w[0].toUpperCase() + w.slice(1)).join(' ')
50
- },
51
- parseObject: (obj, opts) => ({ obj, opts })
52
- },
53
- baseClass: {
54
- Base: class Base {
55
- constructor (pkgName, appRef) {
56
- this.pkgName = pkgName
57
- this.app = appRef
58
- this.ns = 'bajoTemplate'
59
- }
60
-
61
- t (text, ...params) {
62
- return `${text}:${params.length}`
63
- }
64
-
65
- error (msg, ...params) {
66
- return new Error([msg, ...params].join('|'))
67
- }
68
- }
69
- },
70
- bajo: {
71
- format: (val, type, opts) => `${type}:${val}:${opts.lang}`,
72
- breakNsPath: (key) => ({ path: key.split(':')[1] ?? '' }),
73
- config: {
74
- intl: { fallback: 'en' },
75
- env: 'dev'
76
- }
77
- },
78
- getAllNs: () => ['bajoTemplate', 'waibuMpa'],
79
- waibu: {
80
- getSetting: (key, { defValue }) => `setting:${key}:${defValue}`
81
- },
82
- waibuMpa: {
83
- jsonStringify: (v) => JSON.stringify(v)
84
- },
85
- configHandlers: []
86
- }
87
-
88
- BajoTemplate = await factory.call({ app }, 'bajo-template')
89
- })
90
-
91
- it('initializes default configuration', () => {
92
- const tpl = new BajoTemplate()
93
-
94
- expect(tpl.config.layout.fallback).to.equal(true)
95
- expect(tpl.config.loopDetectorDur).to.equal('1m')
96
- expect(tpl.config.cache.ttlDur).to.equal('1s')
97
- expect(tpl.loopDetector).to.deep.equal({})
98
- })
99
-
100
- it('buildCompileImports exposes utility functions', () => {
101
- const tpl = new BajoTemplate()
102
- const locals = { schema: { view: { site: { title: 'Local title' } } } }
103
- const req = { lang: 'id' }
104
-
105
- const imports = tpl.buildCompileImports(locals, req)
106
-
107
- expect(imports._titleize('hello world')).to.equal('Hello World')
108
- expect(imports._hasPlugin('waibuMpa')).to.equal(true)
109
- expect(imports._jsonStringify({ a: 1 })).to.equal('{"a":1}')
110
- expect(imports._format(7, 'number')).to.equal('number:7:id')
111
- expect(imports._getSetting('main:/site/title', 'Default')).to.equal('Local title')
112
- })
113
-
114
- it('buildCompileImports _excerpt delegates to getExcerpt', () => {
115
- const tpl = new BajoTemplate()
116
- const imports = tpl.buildCompileImports({}, { lang: 'en' })
117
-
118
- expect(imports._excerpt('one two three four', 2)).to.equal('one two...')
119
- })
120
-
121
- it('clearLoopDetector removes expired entries only', () => {
122
- const tpl = new BajoTemplate()
123
- tpl.config.loopDetectorDur = 100
124
- tpl.loopDetector = {
125
- old: { ts: Date.now() - 1000, file: ['a'] },
126
- fresh: { ts: Date.now(), file: ['b'] }
127
- }
128
-
129
- tpl._clearLoopDetector()
130
-
131
- expect(Object.keys(tpl.loopDetector)).to.deep.equal(['fresh'])
132
- })
133
-
134
- it('detectLoop records history and throws on repeated same file', () => {
135
- const tpl = new BajoTemplate()
136
- const opts = { groupId: 'g1' }
137
- const file = '/tmp/view.html'
138
-
139
- tpl._detectLoop('x.template:/view.html', file, opts)
140
- expect(tpl.loopDetector.g1.file).to.deep.equal([file])
141
-
142
- expect(() => tpl._detectLoop('x.template:/view.html', file, opts)).to.throw('loopDetected')
143
- })
144
-
145
- it('detectLoop allows repeated file when basename starts with tilde', () => {
146
- const tpl = new BajoTemplate()
147
- const opts = { groupId: 'g2' }
148
- const file = '/tmp/~view.html'
149
-
150
- tpl._detectLoop('x.template:/~view.html', file, opts)
151
- expect(() => tpl._detectLoop('x.template:/~view.html', file, opts)).to.not.throw()
152
- })
153
-
154
- it('splitContent parses front matter and body from text', () => {
155
- const tpl = new BajoTemplate()
156
- const input = '---\ntitle: Test\n---\nBody content'
157
- const result = tpl.splitContent(input, false)
158
-
159
- expect(result.frontMatter.trim()).to.equal('title: Test')
160
- expect(result.content.trim()).to.equal('Body content')
161
- })
162
-
163
- it('splitContent reads file input when readFile is true', () => {
164
- const tpl = new BajoTemplate()
165
- const root = createTempRoot()
166
- const file = path.join(root, 'sample.txt')
167
- fs.writeFileSync(file, '---\nname: A\n---\nHello', 'utf8')
168
-
169
- const result = tpl.splitContent(file, true)
170
-
171
- expect(result.frontMatter.trim()).to.equal('name: A')
172
- expect(result.content.trim()).to.equal('Hello')
173
- fs.rmSync(root, { recursive: true, force: true })
174
- })
175
-
176
- it('getExcerpt and getTruncated return expected text', () => {
177
- const tpl = new BajoTemplate()
178
-
179
- expect(tpl.getExcerpt('one two three four', 2)).to.equal('one two...')
180
- expect(tpl.getExcerpt('one two', 5)).to.equal('one two')
181
- expect(tpl.getTruncated('abcdef', 3)).to.equal('abc...')
182
- expect(tpl.getTruncated('abc', 10)).to.equal('abc')
183
- expect(tpl.getExcerpt('one two three', 2, ' (more)')).to.equal('one two (more)')
184
- })
185
-
186
- it('parseFrontMatter tries handlers and parses first valid object/array', async () => {
187
- const tpl = new BajoTemplate()
188
- const calls = []
189
- app.configHandlers = [
190
- {
191
- ext: '.js',
192
- readHandler: async () => {
193
- calls.push('.js')
194
- return { ignored: true }
195
- }
196
- },
197
- {
198
- ext: '.yaml',
199
- readHandler: async () => {
200
- calls.push('.yaml')
201
- throw new Error('bad')
202
- }
203
- },
204
- {
205
- ext: '.toml',
206
- readHandler: async (input, parseValue) => {
207
- calls.push([input, parseValue])
208
- return { title: 'ok' }
209
- }
210
- }
211
- ]
212
-
213
- const out = await tpl.parseFrontMatter('title = "ok"', 'id')
214
-
215
- expect(calls).to.deep.equal(['.yaml', ['title = "ok"', true]])
216
- expect(out).to.deep.equal({ obj: { title: 'ok' }, opts: { parseValue: false, lang: 'id' } })
217
- })
218
-
219
- it('parseFrontMatter returns empty object when no handler succeeds', async () => {
220
- const tpl = new BajoTemplate()
221
- app.configHandlers = [
222
- { ext: '.yaml', readHandler: async () => '' },
223
- { ext: '.toml', readHandler: async () => null }
224
- ]
225
-
226
- const out = await tpl.parseFrontMatter('x', 'en')
227
- expect(out).to.deep.equal({})
228
- })
229
-
230
- it('compile reads from cache when available', async () => {
231
- const tpl = new BajoTemplate()
232
- const cached = (locals) => `cached:${locals.name}`
233
- let templateCalled = false
234
-
235
- app.lib._.template = () => {
236
- templateCalled = true
237
- return () => 'should-not-run'
238
- }
239
- app.bajoCache = {
240
- get: async () => cached,
241
- set: async () => {}
242
- }
243
-
244
- const out = await tpl.compile('hello', { name: 'A' }, { ttl: 5 })
245
- expect(out).to.equal('cached:A')
246
- expect(templateCalled).to.equal(false)
247
- })
248
-
249
- it('compile writes cache when not available', async () => {
250
- const tpl = new BajoTemplate()
251
- const setCalls = []
252
- app.bajoCache = {
253
- get: async () => undefined,
254
- set: async (payload) => setCalls.push(payload)
255
- }
256
-
257
- const out = await tpl.compile('hello', { name: 'B' }, { ttl: 123 })
258
-
259
- expect(out).to.equal('compiled:hello:B')
260
- expect(setCalls).to.have.lengthOf(1)
261
- expect(setCalls[0].ttl).to.equal(123)
262
- expect(setCalls[0].key.startsWith('fn:')).to.equal(true)
263
- })
264
-
265
- it('renderString applies optional postProcessor', async () => {
266
- const tpl = new BajoTemplate()
267
- tpl._renderString = async () => 'rendered'
268
-
269
- const out = await tpl.renderString('x', {}, {
270
- postProcessor: async ({ text }) => text + ':post'
271
- })
272
-
273
- expect(out).to.equal('rendered:post')
274
- })
275
- })
1
+ /* global describe, it, beforeEach */
2
+
3
+ import fs from 'node:fs'
4
+ import os from 'node:os'
5
+ import path from 'node:path'
6
+ import { expect } from 'chai'
7
+
8
+ import factory from '../index.js'
9
+
10
+ const createTempRoot = () => fs.mkdtempSync(path.join(os.tmpdir(), 'bajo-template-test-'))
11
+
12
+ describe('BajoTemplate', () => {
13
+ let app
14
+ let BajoTemplate
15
+
16
+ beforeEach(async () => {
17
+ const lodashLike = {
18
+ get: (obj, p, defValue) => {
19
+ const parts = p.split('.')
20
+ let cur = obj
21
+ for (const part of parts) {
22
+ if (cur == null || !(part in cur)) return defValue
23
+ cur = cur[part]
24
+ }
25
+ return cur
26
+ },
27
+ omit: (obj, keys) => Object.fromEntries(Object.entries(obj).filter(([k]) => !keys.includes(k))),
28
+ last: (arr) => arr[arr.length - 1],
29
+ isEmpty: (val) => {
30
+ if (val == null) return true
31
+ if (Array.isArray(val) || typeof val === 'string') return val.length === 0
32
+ if (typeof val === 'object') return Object.keys(val).length === 0
33
+ return false
34
+ },
35
+ isPlainObject: (val) => Object.prototype.toString.call(val) === '[object Object]',
36
+ isArray: Array.isArray,
37
+ filter: (arr, fn) => arr.filter(fn),
38
+ map: (arr, fn) => arr.map(fn),
39
+ template: (content) => {
40
+ return (locals) => `compiled:${content}:${locals.name ?? ''}`
41
+ }
42
+ }
43
+
44
+ app = {
45
+ lib: {
46
+ fs,
47
+ _: lodashLike,
48
+ aneka: {
49
+ titleize: (text) => text.split(' ').map(w => w[0].toUpperCase() + w.slice(1)).join(' ')
50
+ },
51
+ parseObject: (obj, opts) => ({ obj, opts })
52
+ },
53
+ baseClass: {
54
+ Base: class Base {
55
+ constructor (pkgName, appRef) {
56
+ this.pkgName = pkgName
57
+ this.app = appRef
58
+ this.ns = 'bajoTemplate'
59
+ }
60
+
61
+ t (text, ...params) {
62
+ return `${text}:${params.length}`
63
+ }
64
+
65
+ error (msg, ...params) {
66
+ return new Error([msg, ...params].join('|'))
67
+ }
68
+ }
69
+ },
70
+ bajo: {
71
+ format: (val, type, opts) => `${type}:${val}:${opts.lang}`,
72
+ breakNsPath: (key) => ({ path: key.split(':')[1] ?? '' }),
73
+ config: {
74
+ intl: { fallback: 'en' },
75
+ env: 'dev'
76
+ }
77
+ },
78
+ getAllNs: () => ['bajoTemplate', 'waibuMpa'],
79
+ waibu: {
80
+ getSetting: (key, { defValue }) => `setting:${key}:${defValue}`
81
+ },
82
+ waibuMpa: {
83
+ jsonStringify: (v) => JSON.stringify(v)
84
+ },
85
+ configHandlers: []
86
+ }
87
+
88
+ BajoTemplate = await factory.call({ app }, 'bajo-template')
89
+ })
90
+
91
+ it('initializes default configuration', () => {
92
+ const tpl = new BajoTemplate()
93
+
94
+ expect(tpl.config.layout.fallback).to.equal(true)
95
+ expect(tpl.config.loopDetectorDur).to.equal('1m')
96
+ expect(tpl.config.cache.ttlDur).to.equal('1s')
97
+ expect(tpl.loopDetector).to.deep.equal({})
98
+ })
99
+
100
+ it('buildCompileImports exposes utility functions', () => {
101
+ const tpl = new BajoTemplate()
102
+ const locals = { schema: { view: { site: { title: 'Local title' } } } }
103
+ const req = { lang: 'id' }
104
+
105
+ const imports = tpl.buildCompileImports(locals, req)
106
+
107
+ expect(imports._titleize('hello world')).to.equal('Hello World')
108
+ expect(imports._hasPlugin('waibuMpa')).to.equal(true)
109
+ expect(imports._jsonStringify({ a: 1 })).to.equal('{"a":1}')
110
+ expect(imports._format(7, 'number')).to.equal('number:7:id')
111
+ expect(imports._getSetting('main:/site/title', 'Default')).to.equal('Local title')
112
+ })
113
+
114
+ it('buildCompileImports _excerpt delegates to getExcerpt', () => {
115
+ const tpl = new BajoTemplate()
116
+ const imports = tpl.buildCompileImports({}, { lang: 'en' })
117
+
118
+ expect(imports._excerpt('one two three four', 2)).to.equal('one two...')
119
+ })
120
+
121
+ it('clearLoopDetector removes expired entries only', () => {
122
+ const tpl = new BajoTemplate()
123
+ tpl.config.loopDetectorDur = 100
124
+ tpl.loopDetector = {
125
+ old: { ts: Date.now() - 1000, file: ['a'] },
126
+ fresh: { ts: Date.now(), file: ['b'] }
127
+ }
128
+
129
+ tpl._clearLoopDetector()
130
+
131
+ expect(Object.keys(tpl.loopDetector)).to.deep.equal(['fresh'])
132
+ })
133
+
134
+ it('detectLoop records history and throws on repeated same file', () => {
135
+ const tpl = new BajoTemplate()
136
+ const opts = { groupId: 'g1' }
137
+ const file = '/tmp/view.html'
138
+
139
+ tpl._detectLoop('x.template:/view.html', file, opts)
140
+ expect(tpl.loopDetector.g1.file).to.deep.equal([file])
141
+
142
+ expect(() => tpl._detectLoop('x.template:/view.html', file, opts)).to.throw('loopDetected')
143
+ })
144
+
145
+ it('detectLoop allows repeated file when basename starts with tilde', () => {
146
+ const tpl = new BajoTemplate()
147
+ const opts = { groupId: 'g2' }
148
+ const file = '/tmp/~view.html'
149
+
150
+ tpl._detectLoop('x.template:/~view.html', file, opts)
151
+ expect(() => tpl._detectLoop('x.template:/~view.html', file, opts)).to.not.throw()
152
+ })
153
+
154
+ it('splitContent parses front matter and body from text', () => {
155
+ const tpl = new BajoTemplate()
156
+ const input = '---\ntitle: Test\n---\nBody content'
157
+ const result = tpl.splitContent(input, false)
158
+
159
+ expect(result.frontMatter.trim()).to.equal('title: Test')
160
+ expect(result.content.trim()).to.equal('Body content')
161
+ })
162
+
163
+ it('splitContent reads file input when readFile is true', () => {
164
+ const tpl = new BajoTemplate()
165
+ const root = createTempRoot()
166
+ const file = path.join(root, 'sample.txt')
167
+ fs.writeFileSync(file, '---\nname: A\n---\nHello', 'utf8')
168
+
169
+ const result = tpl.splitContent(file, true)
170
+
171
+ expect(result.frontMatter.trim()).to.equal('name: A')
172
+ expect(result.content.trim()).to.equal('Hello')
173
+ fs.rmSync(root, { recursive: true, force: true })
174
+ })
175
+
176
+ it('getExcerpt and getTruncated return expected text', () => {
177
+ const tpl = new BajoTemplate()
178
+
179
+ expect(tpl.getExcerpt('one two three four', 2)).to.equal('one two...')
180
+ expect(tpl.getExcerpt('one two', 5)).to.equal('one two')
181
+ expect(tpl.getTruncated('abcdef', 3)).to.equal('abc...')
182
+ expect(tpl.getTruncated('abc', 10)).to.equal('abc')
183
+ expect(tpl.getExcerpt('one two three', 2, ' (more)')).to.equal('one two (more)')
184
+ })
185
+
186
+ it('parseFrontMatter tries handlers and parses first valid object/array', async () => {
187
+ const tpl = new BajoTemplate()
188
+ const calls = []
189
+ app.configHandlers = [
190
+ {
191
+ ext: '.js',
192
+ readHandler: async () => {
193
+ calls.push('.js')
194
+ return { ignored: true }
195
+ }
196
+ },
197
+ {
198
+ ext: '.yaml',
199
+ readHandler: async () => {
200
+ calls.push('.yaml')
201
+ throw new Error('bad')
202
+ }
203
+ },
204
+ {
205
+ ext: '.toml',
206
+ readHandler: async (input, parseValue) => {
207
+ calls.push([input, parseValue])
208
+ return { title: 'ok' }
209
+ }
210
+ }
211
+ ]
212
+
213
+ const out = await tpl.parseFrontMatter('title = "ok"', 'id')
214
+
215
+ expect(calls).to.deep.equal(['.yaml', ['title = "ok"', true]])
216
+ expect(out).to.deep.equal({ obj: { title: 'ok' }, opts: { parseValue: false, lang: 'id' } })
217
+ })
218
+
219
+ it('parseFrontMatter returns empty object when no handler succeeds', async () => {
220
+ const tpl = new BajoTemplate()
221
+ app.configHandlers = [
222
+ { ext: '.yaml', readHandler: async () => '' },
223
+ { ext: '.toml', readHandler: async () => null }
224
+ ]
225
+
226
+ const out = await tpl.parseFrontMatter('x', 'en')
227
+ expect(out).to.deep.equal({})
228
+ })
229
+
230
+ it('compile reads from cache when available', async () => {
231
+ const tpl = new BajoTemplate()
232
+ const cached = (locals) => `cached:${locals.name}`
233
+ let templateCalled = false
234
+
235
+ app.lib._.template = () => {
236
+ templateCalled = true
237
+ return () => 'should-not-run'
238
+ }
239
+ app.bajoCache = {
240
+ get: async () => cached,
241
+ set: async () => {}
242
+ }
243
+
244
+ const out = await tpl.compile('hello', { name: 'A' }, { ttl: 5 })
245
+ expect(out).to.equal('cached:A')
246
+ expect(templateCalled).to.equal(false)
247
+ })
248
+
249
+ it('compile writes cache when not available', async () => {
250
+ const tpl = new BajoTemplate()
251
+ const setCalls = []
252
+ app.bajoCache = {
253
+ get: async () => undefined,
254
+ set: async (payload) => setCalls.push(payload)
255
+ }
256
+
257
+ const out = await tpl.compile('hello', { name: 'B' }, { ttl: 123 })
258
+
259
+ expect(out).to.equal('compiled:hello:B')
260
+ expect(setCalls).to.have.lengthOf(1)
261
+ expect(setCalls[0].ttl).to.equal(123)
262
+ expect(setCalls[0].key.startsWith('fn:')).to.equal(true)
263
+ })
264
+
265
+ it('renderString applies optional postProcessor', async () => {
266
+ const tpl = new BajoTemplate()
267
+ tpl._renderString = async () => 'rendered'
268
+
269
+ const out = await tpl.renderString('x', {}, {
270
+ postProcessor: async ({ text }) => text + ':post'
271
+ })
272
+
273
+ expect(out).to.equal('rendered:post')
274
+ })
275
+ })