@tsed/engines 8.25.1 → 8.25.3

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.
@@ -5,17 +5,19 @@ import { Engine } from "./Engine.js";
5
5
  let TwingEngine = class TwingEngine extends Engine {
6
6
  $compile(template, options) {
7
7
  const engine = this.engine;
8
- if (!this.instance) {
9
- let loader = new engine.TwingLoaderNull();
10
- if (options.settings && options.settings.views && existsSync(options.settings.views)) {
11
- loader = new engine.TwingLoaderFilesystem(options.settings.views);
12
- }
13
- this.instance = new engine.TwingEnvironment(loader);
8
+ if (options.settings && options.settings.views && existsSync(options.settings.views)) {
9
+ const loader = engine.createFilesystemLoader(options.settings.views);
10
+ const environment = engine.createEnvironment(loader);
11
+ return async (options) => {
12
+ return environment.render(template, options);
13
+ };
14
14
  }
15
- const $cmp = this.instance.createTemplate(template);
16
15
  return async (options) => {
17
- const compile = await $cmp;
18
- return compile.render(options);
16
+ const loader = engine.createArrayLoader({
17
+ "index.twig": template
18
+ });
19
+ const environment = engine.createEnvironment(loader);
20
+ return environment.render("index.twig", options);
19
21
  };
20
22
  }
21
23
  };
@@ -1,5 +1,4 @@
1
1
  import { Engine } from "./Engine.js";
2
2
  export declare class TwingEngine extends Engine {
3
- private instance;
4
3
  protected $compile(template: string, options: any): (options: any) => Promise<string>;
5
4
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsed/engines",
3
3
  "description": "Template engines library. Provide an API to adding custom engines from decorators.",
4
4
  "type": "module",
5
- "version": "8.25.1",
5
+ "version": "8.25.3",
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
@@ -42,8 +42,8 @@
42
42
  "@babel/plugin-transform-runtime": "7.25.7",
43
43
  "@babel/preset-env": "7.27.2",
44
44
  "@babel/preset-react": "7.25.7",
45
- "@tsed/barrels": "8.25.1",
46
- "@tsed/typescript": "8.25.1",
45
+ "@tsed/barrels": "8.25.3",
46
+ "@tsed/typescript": "8.25.3",
47
47
  "@types/semver": "^7.5.8",
48
48
  "atpl": "0.9.3",
49
49
  "bracket-template": "^1.1.5",
@@ -88,7 +88,7 @@
88
88
  "tinyliquid": "^0.2.34",
89
89
  "ts-node": "10.9.2",
90
90
  "twig": "^1.17.1",
91
- "twing": "^5.2.2",
91
+ "twing": "^7.3.1",
92
92
  "typescript": "5.9.3",
93
93
  "underscore": "^1.13.7",
94
94
  "vash": "^0.13.0",