minijinja-js 2.12.0 → 2.13.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.
@@ -6,34 +6,46 @@ type UndefinedBehavior = "strict" | "chainable" | "lenient" | "semi_strct";
6
6
  */
7
7
  export class Environment {
8
8
  free(): void;
9
- constructor();
10
9
  /**
11
10
  * Registers a new template by name and source.
12
11
  */
13
12
  addTemplate(name: string, source: string): void;
14
13
  /**
15
- * Removes a template by name.
14
+ * Removes a global again.
16
15
  */
17
- removeTemplate(name: string): void;
16
+ removeGlobal(name: string): void;
18
17
  /**
19
18
  * Clears all templates from the environment.
20
19
  */
21
20
  clearTemplates(): void;
21
+ /**
22
+ * Enables python compatibility.
23
+ */
24
+ enablePyCompat(): void;
25
+ /**
26
+ * Removes a template by name.
27
+ */
28
+ removeTemplate(name: string): void;
29
+ /**
30
+ * Like `renderStr` but with a named template for auto escape detection.
31
+ */
32
+ renderNamedStr(name: string, source: string, ctx: any): string;
22
33
  /**
23
34
  * Renders a registered template by name with the given context.
24
35
  */
25
36
  renderTemplate(name: string, ctx: any): string;
26
37
  /**
27
- * Renders a string template with the given context.
38
+ * Sets a callback to join template paths (for relative includes/extends).
28
39
  *
29
- * This is useful for one-off template rendering without registering the template. The
30
- * template is parsed and rendered immediately.
40
+ * The callback receives `(name, parent)` and should return a joined path string.
41
+ * If it throws or returns a non-string, the original `name` is used.
31
42
  */
32
- renderStr(source: string, ctx: any): string;
43
+ setPathJoinCallback(func: Function): void;
44
+ constructor();
33
45
  /**
34
- * Like `renderStr` but with a named template for auto escape detection.
46
+ * Registers a test function.
35
47
  */
36
- renderNamedStr(name: string, source: string, ctx: any): string;
48
+ addTest(name: string, func: Function): void;
37
49
  /**
38
50
  * Evaluates an expression with the given context.
39
51
  *
@@ -45,26 +57,25 @@ export class Environment {
45
57
  * Registers a filter function.
46
58
  */
47
59
  addFilter(name: string, func: Function): void;
48
- /**
49
- * Registers a test function.
50
- */
51
- addTest(name: string, func: Function): void;
52
- /**
53
- * Enables python compatibility.
54
- */
55
- enablePyCompat(): void;
56
60
  /**
57
61
  * Registers a value as global.
58
62
  */
59
63
  addGlobal(name: string, value: any): void;
60
64
  /**
61
- * Removes a global again.
65
+ * Renders a string template with the given context.
66
+ *
67
+ * This is useful for one-off template rendering without registering the template. The
68
+ * template is parsed and rendered immediately.
62
69
  */
63
- removeGlobal(name: string): void;
70
+ renderStr(source: string, ctx: any): string;
64
71
  /**
65
- * Enables or disables debug mode.
72
+ * Registers a synchronous template loader callback.
73
+ *
74
+ * The provided function is called with a template name and must return a
75
+ * string with the template source or `null`/`undefined` if the template
76
+ * does not exist. Errors thrown are propagated as MiniJinja errors.
66
77
  */
67
- debug: boolean;
78
+ setLoader(func: Function): void;
68
79
  /**
69
80
  * Enables or disables block trimming.
70
81
  */
@@ -73,19 +84,23 @@ export class Environment {
73
84
  * Enables or disables the lstrip blocks feature.
74
85
  */
75
86
  lstripBlocks: boolean;
76
- /**
77
- * Enables or disables keeping of the final newline.
78
- */
79
- keepTrailingNewline: boolean;
80
87
  /**
81
88
  * Reconfigures the behavior of undefined variables.
82
89
  */
83
90
  undefinedBehavior: UndefinedBehavior;
91
+ /**
92
+ * Enables or disables keeping of the final newline.
93
+ */
94
+ keepTrailingNewline: boolean;
84
95
  /**
85
96
  * Configures the max-fuel for template evaluation.
86
97
  */
87
98
  get fuel(): number | undefined;
88
99
  set fuel(value: number | null | undefined);
100
+ /**
101
+ * Enables or disables debug mode.
102
+ */
103
+ debug: boolean;
89
104
  }
90
105
 
91
106
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -93,31 +108,33 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
93
108
  export interface InitOutput {
94
109
  readonly memory: WebAssembly.Memory;
95
110
  readonly __wbg_environment_free: (a: number, b: number) => void;
96
- readonly environment_new: () => number;
97
- readonly environment_addTemplate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
98
- readonly environment_removeTemplate: (a: number, b: number, c: number) => void;
99
- readonly environment_clearTemplates: (a: number) => void;
100
- readonly environment_renderTemplate: (a: number, b: number, c: number, d: number, e: number) => void;
101
- readonly environment_renderStr: (a: number, b: number, c: number, d: number, e: number) => void;
102
- readonly environment_renderNamedStr: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
103
- readonly environment_evalExpr: (a: number, b: number, c: number, d: number, e: number) => void;
104
111
  readonly environment_addFilter: (a: number, b: number, c: number, d: number) => void;
112
+ readonly environment_addGlobal: (a: number, b: number, c: number, d: number, e: number) => void;
113
+ readonly environment_addTemplate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
105
114
  readonly environment_addTest: (a: number, b: number, c: number, d: number) => void;
106
- readonly environment_enablePyCompat: (a: number) => void;
115
+ readonly environment_clearTemplates: (a: number) => void;
107
116
  readonly environment_debug: (a: number) => number;
108
- readonly environment_set_debug: (a: number, b: number) => void;
109
- readonly environment_trimBlocks: (a: number) => number;
110
- readonly environment_set_trimBlocks: (a: number, b: number) => void;
111
- readonly environment_lstripBlocks: (a: number) => number;
112
- readonly environment_set_lstripBlocks: (a: number, b: number) => void;
117
+ readonly environment_enablePyCompat: (a: number) => void;
118
+ readonly environment_evalExpr: (a: number, b: number, c: number, d: number, e: number) => void;
119
+ readonly environment_fuel: (a: number) => number;
113
120
  readonly environment_keepTrailingNewline: (a: number) => number;
121
+ readonly environment_lstripBlocks: (a: number) => number;
122
+ readonly environment_new: () => number;
123
+ readonly environment_removeGlobal: (a: number, b: number, c: number) => void;
124
+ readonly environment_removeTemplate: (a: number, b: number, c: number) => void;
125
+ readonly environment_renderNamedStr: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
126
+ readonly environment_renderStr: (a: number, b: number, c: number, d: number, e: number) => void;
127
+ readonly environment_renderTemplate: (a: number, b: number, c: number, d: number, e: number) => void;
128
+ readonly environment_setLoader: (a: number, b: number) => void;
129
+ readonly environment_setPathJoinCallback: (a: number, b: number) => void;
130
+ readonly environment_set_debug: (a: number, b: number) => void;
131
+ readonly environment_set_fuel: (a: number, b: number) => void;
114
132
  readonly environment_set_keepTrailingNewline: (a: number, b: number) => void;
115
- readonly environment_undefinedBehavior: (a: number) => number;
133
+ readonly environment_set_lstripBlocks: (a: number, b: number) => void;
134
+ readonly environment_set_trimBlocks: (a: number, b: number) => void;
116
135
  readonly environment_set_undefinedBehavior: (a: number, b: number, c: number) => void;
117
- readonly environment_fuel: (a: number) => number;
118
- readonly environment_set_fuel: (a: number, b: number) => void;
119
- readonly environment_addGlobal: (a: number, b: number, c: number, d: number, e: number) => void;
120
- readonly environment_removeGlobal: (a: number, b: number, c: number) => void;
136
+ readonly environment_trimBlocks: (a: number) => number;
137
+ readonly environment_undefinedBehavior: (a: number) => number;
121
138
  readonly __wbindgen_export_0: (a: number, b: number) => number;
122
139
  readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
123
140
  readonly __wbindgen_export_2: (a: number) => void;
@@ -210,11 +210,13 @@ export class Environment {
210
210
  const ptr = this.__destroy_into_raw();
211
211
  wasm.__wbg_environment_free(ptr, 0);
212
212
  }
213
- constructor() {
214
- const ret = wasm.environment_new();
215
- this.__wbg_ptr = ret >>> 0;
216
- EnvironmentFinalization.register(this, this.__wbg_ptr, this);
217
- return this;
213
+ /**
214
+ * Enables or disables block trimming.
215
+ * @returns {boolean}
216
+ */
217
+ get trimBlocks() {
218
+ const ret = wasm.environment_trimBlocks(this.__wbg_ptr);
219
+ return ret !== 0;
218
220
  }
219
221
  /**
220
222
  * Registers a new template by name and source.
@@ -239,13 +241,21 @@ export class Environment {
239
241
  }
240
242
  }
241
243
  /**
242
- * Removes a template by name.
244
+ * Enables or disables the lstrip blocks feature.
245
+ * @returns {boolean}
246
+ */
247
+ get lstripBlocks() {
248
+ const ret = wasm.environment_lstripBlocks(this.__wbg_ptr);
249
+ return ret !== 0;
250
+ }
251
+ /**
252
+ * Removes a global again.
243
253
  * @param {string} name
244
254
  */
245
- removeTemplate(name) {
255
+ removeGlobal(name) {
246
256
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
247
257
  const len0 = WASM_VECTOR_LEN;
248
- wasm.environment_removeTemplate(this.__wbg_ptr, ptr0, len0);
258
+ wasm.environment_removeGlobal(this.__wbg_ptr, ptr0, len0);
249
259
  }
250
260
  /**
251
261
  * Clears all templates from the environment.
@@ -254,71 +264,19 @@ export class Environment {
254
264
  wasm.environment_clearTemplates(this.__wbg_ptr);
255
265
  }
256
266
  /**
257
- * Renders a registered template by name with the given context.
258
- * @param {string} name
259
- * @param {any} ctx
260
- * @returns {string}
267
+ * Enables python compatibility.
261
268
  */
262
- renderTemplate(name, ctx) {
263
- let deferred3_0;
264
- let deferred3_1;
265
- try {
266
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
267
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
268
- const len0 = WASM_VECTOR_LEN;
269
- wasm.environment_renderTemplate(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
270
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
271
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
272
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
273
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
274
- var ptr2 = r0;
275
- var len2 = r1;
276
- if (r3) {
277
- ptr2 = 0; len2 = 0;
278
- throw takeObject(r2);
279
- }
280
- deferred3_0 = ptr2;
281
- deferred3_1 = len2;
282
- return getStringFromWasm0(ptr2, len2);
283
- } finally {
284
- wasm.__wbindgen_add_to_stack_pointer(16);
285
- wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
286
- }
269
+ enablePyCompat() {
270
+ wasm.environment_enablePyCompat(this.__wbg_ptr);
287
271
  }
288
272
  /**
289
- * Renders a string template with the given context.
290
- *
291
- * This is useful for one-off template rendering without registering the template. The
292
- * template is parsed and rendered immediately.
293
- * @param {string} source
294
- * @param {any} ctx
295
- * @returns {string}
273
+ * Removes a template by name.
274
+ * @param {string} name
296
275
  */
297
- renderStr(source, ctx) {
298
- let deferred3_0;
299
- let deferred3_1;
300
- try {
301
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
302
- const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
303
- const len0 = WASM_VECTOR_LEN;
304
- wasm.environment_renderStr(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
305
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
306
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
307
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
308
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
309
- var ptr2 = r0;
310
- var len2 = r1;
311
- if (r3) {
312
- ptr2 = 0; len2 = 0;
313
- throw takeObject(r2);
314
- }
315
- deferred3_0 = ptr2;
316
- deferred3_1 = len2;
317
- return getStringFromWasm0(ptr2, len2);
318
- } finally {
319
- wasm.__wbindgen_add_to_stack_pointer(16);
320
- wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
321
- }
276
+ removeTemplate(name) {
277
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ wasm.environment_removeTemplate(this.__wbg_ptr, ptr0, len0);
322
280
  }
323
281
  /**
324
282
  * Like `renderStr` but with a named template for auto escape detection.
@@ -356,99 +314,57 @@ export class Environment {
356
314
  }
357
315
  }
358
316
  /**
359
- * Evaluates an expression with the given context.
360
- *
361
- * This is useful for evaluating expressions outside of templates. The expression is
362
- * parsed and evaluated immediately.
363
- * @param {string} expr
317
+ * Renders a registered template by name with the given context.
318
+ * @param {string} name
364
319
  * @param {any} ctx
365
- * @returns {any}
320
+ * @returns {string}
366
321
  */
367
- evalExpr(expr, ctx) {
322
+ renderTemplate(name, ctx) {
323
+ let deferred3_0;
324
+ let deferred3_1;
368
325
  try {
369
326
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
370
- const ptr0 = passStringToWasm0(expr, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
327
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
371
328
  const len0 = WASM_VECTOR_LEN;
372
- wasm.environment_evalExpr(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
329
+ wasm.environment_renderTemplate(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
373
330
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
374
331
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
375
332
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
376
- if (r2) {
377
- throw takeObject(r1);
333
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
334
+ var ptr2 = r0;
335
+ var len2 = r1;
336
+ if (r3) {
337
+ ptr2 = 0; len2 = 0;
338
+ throw takeObject(r2);
378
339
  }
379
- return takeObject(r0);
340
+ deferred3_0 = ptr2;
341
+ deferred3_1 = len2;
342
+ return getStringFromWasm0(ptr2, len2);
380
343
  } finally {
381
344
  wasm.__wbindgen_add_to_stack_pointer(16);
345
+ wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
382
346
  }
383
347
  }
384
- /**
385
- * Registers a filter function.
386
- * @param {string} name
387
- * @param {Function} func
388
- */
389
- addFilter(name, func) {
390
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
391
- const len0 = WASM_VECTOR_LEN;
392
- wasm.environment_addFilter(this.__wbg_ptr, ptr0, len0, addHeapObject(func));
393
- }
394
- /**
395
- * Registers a test function.
396
- * @param {string} name
397
- * @param {Function} func
398
- */
399
- addTest(name, func) {
400
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
401
- const len0 = WASM_VECTOR_LEN;
402
- wasm.environment_addTest(this.__wbg_ptr, ptr0, len0, addHeapObject(func));
403
- }
404
- /**
405
- * Enables python compatibility.
406
- */
407
- enablePyCompat() {
408
- wasm.environment_enablePyCompat(this.__wbg_ptr);
409
- }
410
- /**
411
- * Enables or disables debug mode.
412
- * @returns {boolean}
413
- */
414
- get debug() {
415
- const ret = wasm.environment_debug(this.__wbg_ptr);
416
- return ret !== 0;
417
- }
418
- /**
419
- * @param {boolean} yes
420
- */
421
- set debug(yes) {
422
- wasm.environment_set_debug(this.__wbg_ptr, yes);
423
- }
424
- /**
425
- * Enables or disables block trimming.
426
- * @returns {boolean}
427
- */
428
- get trimBlocks() {
429
- const ret = wasm.environment_trimBlocks(this.__wbg_ptr);
430
- return ret !== 0;
431
- }
432
348
  /**
433
349
  * @param {boolean} yes
434
350
  */
435
351
  set trimBlocks(yes) {
436
352
  wasm.environment_set_trimBlocks(this.__wbg_ptr, yes);
437
353
  }
438
- /**
439
- * Enables or disables the lstrip blocks feature.
440
- * @returns {boolean}
441
- */
442
- get lstripBlocks() {
443
- const ret = wasm.environment_lstripBlocks(this.__wbg_ptr);
444
- return ret !== 0;
445
- }
446
354
  /**
447
355
  * @param {boolean} yes
448
356
  */
449
357
  set lstripBlocks(yes) {
450
358
  wasm.environment_set_lstripBlocks(this.__wbg_ptr, yes);
451
359
  }
360
+ /**
361
+ * Reconfigures the behavior of undefined variables.
362
+ * @returns {UndefinedBehavior}
363
+ */
364
+ get undefinedBehavior() {
365
+ const ret = wasm.environment_undefinedBehavior(this.__wbg_ptr);
366
+ return __wbindgen_enum_UndefinedBehavior[ret];
367
+ }
452
368
  /**
453
369
  * Enables or disables keeping of the final newline.
454
370
  * @returns {boolean}
@@ -458,18 +374,14 @@ export class Environment {
458
374
  return ret !== 0;
459
375
  }
460
376
  /**
461
- * @param {boolean} yes
462
- */
463
- set keepTrailingNewline(yes) {
464
- wasm.environment_set_keepTrailingNewline(this.__wbg_ptr, yes);
465
- }
466
- /**
467
- * Reconfigures the behavior of undefined variables.
468
- * @returns {UndefinedBehavior}
377
+ * Sets a callback to join template paths (for relative includes/extends).
378
+ *
379
+ * The callback receives `(name, parent)` and should return a joined path string.
380
+ * If it throws or returns a non-string, the original `name` is used.
381
+ * @param {Function} func
469
382
  */
470
- get undefinedBehavior() {
471
- const ret = wasm.environment_undefinedBehavior(this.__wbg_ptr);
472
- return __wbindgen_enum_UndefinedBehavior[ret];
383
+ setPathJoinCallback(func) {
384
+ wasm.environment_setPathJoinCallback(this.__wbg_ptr, addHeapObject(func));
473
385
  }
474
386
  /**
475
387
  * @param {UndefinedBehavior} value
@@ -487,6 +399,18 @@ export class Environment {
487
399
  wasm.__wbindgen_add_to_stack_pointer(16);
488
400
  }
489
401
  }
402
+ /**
403
+ * @param {boolean} yes
404
+ */
405
+ set keepTrailingNewline(yes) {
406
+ wasm.environment_set_keepTrailingNewline(this.__wbg_ptr, yes);
407
+ }
408
+ constructor() {
409
+ const ret = wasm.environment_new();
410
+ this.__wbg_ptr = ret >>> 0;
411
+ EnvironmentFinalization.register(this, this.__wbg_ptr, this);
412
+ return this;
413
+ }
490
414
  /**
491
415
  * Configures the max-fuel for template evaluation.
492
416
  * @returns {number | undefined}
@@ -495,12 +419,66 @@ export class Environment {
495
419
  const ret = wasm.environment_fuel(this.__wbg_ptr);
496
420
  return ret === 0x100000001 ? undefined : ret;
497
421
  }
422
+ /**
423
+ * Enables or disables debug mode.
424
+ * @returns {boolean}
425
+ */
426
+ get debug() {
427
+ const ret = wasm.environment_debug(this.__wbg_ptr);
428
+ return ret !== 0;
429
+ }
430
+ /**
431
+ * Registers a test function.
432
+ * @param {string} name
433
+ * @param {Function} func
434
+ */
435
+ addTest(name, func) {
436
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ wasm.environment_addTest(this.__wbg_ptr, ptr0, len0, addHeapObject(func));
439
+ }
440
+ /**
441
+ * Evaluates an expression with the given context.
442
+ *
443
+ * This is useful for evaluating expressions outside of templates. The expression is
444
+ * parsed and evaluated immediately.
445
+ * @param {string} expr
446
+ * @param {any} ctx
447
+ * @returns {any}
448
+ */
449
+ evalExpr(expr, ctx) {
450
+ try {
451
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
452
+ const ptr0 = passStringToWasm0(expr, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
453
+ const len0 = WASM_VECTOR_LEN;
454
+ wasm.environment_evalExpr(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
455
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
456
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
457
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
458
+ if (r2) {
459
+ throw takeObject(r1);
460
+ }
461
+ return takeObject(r0);
462
+ } finally {
463
+ wasm.__wbindgen_add_to_stack_pointer(16);
464
+ }
465
+ }
498
466
  /**
499
467
  * @param {number | null} [value]
500
468
  */
501
469
  set fuel(value) {
502
470
  wasm.environment_set_fuel(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
503
471
  }
472
+ /**
473
+ * Registers a filter function.
474
+ * @param {string} name
475
+ * @param {Function} func
476
+ */
477
+ addFilter(name, func) {
478
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
479
+ const len0 = WASM_VECTOR_LEN;
480
+ wasm.environment_addFilter(this.__wbg_ptr, ptr0, len0, addHeapObject(func));
481
+ }
504
482
  /**
505
483
  * Registers a value as global.
506
484
  * @param {string} name
@@ -522,13 +500,56 @@ export class Environment {
522
500
  }
523
501
  }
524
502
  /**
525
- * Removes a global again.
526
- * @param {string} name
503
+ * Renders a string template with the given context.
504
+ *
505
+ * This is useful for one-off template rendering without registering the template. The
506
+ * template is parsed and rendered immediately.
507
+ * @param {string} source
508
+ * @param {any} ctx
509
+ * @returns {string}
527
510
  */
528
- removeGlobal(name) {
529
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
530
- const len0 = WASM_VECTOR_LEN;
531
- wasm.environment_removeGlobal(this.__wbg_ptr, ptr0, len0);
511
+ renderStr(source, ctx) {
512
+ let deferred3_0;
513
+ let deferred3_1;
514
+ try {
515
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
516
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
517
+ const len0 = WASM_VECTOR_LEN;
518
+ wasm.environment_renderStr(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
519
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
520
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
521
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
522
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
523
+ var ptr2 = r0;
524
+ var len2 = r1;
525
+ if (r3) {
526
+ ptr2 = 0; len2 = 0;
527
+ throw takeObject(r2);
528
+ }
529
+ deferred3_0 = ptr2;
530
+ deferred3_1 = len2;
531
+ return getStringFromWasm0(ptr2, len2);
532
+ } finally {
533
+ wasm.__wbindgen_add_to_stack_pointer(16);
534
+ wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
535
+ }
536
+ }
537
+ /**
538
+ * Registers a synchronous template loader callback.
539
+ *
540
+ * The provided function is called with a template name and must return a
541
+ * string with the template source or `null`/`undefined` if the template
542
+ * does not exist. Errors thrown are propagated as MiniJinja errors.
543
+ * @param {Function} func
544
+ */
545
+ setLoader(func) {
546
+ wasm.environment_setLoader(this.__wbg_ptr, addHeapObject(func));
547
+ }
548
+ /**
549
+ * @param {boolean} yes
550
+ */
551
+ set debug(yes) {
552
+ wasm.environment_set_debug(this.__wbg_ptr, yes);
532
553
  }
533
554
  }
534
555
 
@@ -585,6 +606,14 @@ function __wbg_get_imports() {
585
606
  const ret = getObject(arg0).call(getObject(arg1));
586
607
  return addHeapObject(ret);
587
608
  }, arguments) };
609
+ imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
610
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
611
+ return addHeapObject(ret);
612
+ }, arguments) };
613
+ imports.wbg.__wbg_call_833bed5770ea2041 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
614
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
615
+ return addHeapObject(ret);
616
+ }, arguments) };
588
617
  imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
589
618
  const ret = getObject(arg0).done;
590
619
  return ret;
@@ -780,6 +809,10 @@ function __wbg_get_imports() {
780
809
  const ret = typeof(getObject(arg0)) === 'function';
781
810
  return ret;
782
811
  };
812
+ imports.wbg.__wbindgen_is_null = function(arg0) {
813
+ const ret = getObject(arg0) === null;
814
+ return ret;
815
+ };
783
816
  imports.wbg.__wbindgen_is_object = function(arg0) {
784
817
  const val = getObject(arg0);
785
818
  const ret = typeof(val) === 'object' && val !== null;
@@ -789,6 +822,10 @@ function __wbg_get_imports() {
789
822
  const ret = typeof(getObject(arg0)) === 'string';
790
823
  return ret;
791
824
  };
825
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
826
+ const ret = getObject(arg0) === undefined;
827
+ return ret;
828
+ };
792
829
  imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
793
830
  const ret = getObject(arg0) === getObject(arg1);
794
831
  return ret;
Binary file