ecto 4.0.0 → 4.1.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- ![Ecto](ecto_logo.png "Ecto")
1
+ ![Ecto](site/logo.svg "Ecto")
2
2
 
3
3
  ## Modern Template Consolidation Engine for EJS, Markdown, Pug, Nunjucks, Mustache, and Handlebars
4
4
 
5
- [![Build Status](https://github.com/jaredwray/ecto/workflows/build/badge.svg)](https://github.com/jaredwray/ecto/actions)
5
+ [![tests](https://github.com/jaredwray/ecto/actions/workflows/tests.yml/badge.svg)](https://github.com/jaredwray/ecto/actions/workflows/tests.yml)
6
6
  [![Release Status](https://github.com/jaredwray/ecto/workflows/release/badge.svg)](https://github.com/jaredwray/ecto/actions)
7
7
  [![GitHub license](https://img.shields.io/github/license/jaredwray/ecto)](https://github.com/jaredwray/ecto/blob/master/LICENSE)
8
8
  [![codecov](https://codecov.io/gh/jaredwray/ecto/branch/main/graph/badge.svg?token=dpbFqSW5Kh)](https://codecov.io/gh/jaredwray/ecto)
@@ -20,6 +20,10 @@ Ecto is a modern template consolidation engine that enables the best template en
20
20
  * [Only the Top Template Engines](#only-the-top-template-engines-and-their-extensions): EJS, Markdown, Pug, Nunjucks, Mustache, Liquid, and Handlebars.
21
21
  * Maintained with Monthly Updates!
22
22
 
23
+ ## ESM and Node Version Support
24
+
25
+ This package is ESM only and tested on the current lts version and its previous. Please don't open issues for questions regarding CommonJS / ESM or previous Nodejs versions. To learn more about using ESM please read this from `sindresorhus`: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
26
+
23
27
  -----
24
28
 
25
29
  ## Getting Started
package/dist/ecto.d.ts CHANGED
@@ -1,12 +1,72 @@
1
- import { EngineMap } from './engine-map.js';
2
- import { Markdown } from './engines/markdown.js';
3
- import { Handlebars } from './engines/handlebars.js';
4
- import { EJS } from './engines/ejs.js';
5
- import { Pug } from './engines/pug.js';
6
- import { Nunjucks } from './engines/nunjucks.js';
7
- import { Liquid } from './engines/liquid.js';
8
- import type { EngineInterface } from './engine-interface.js';
9
- export declare class Ecto {
1
+ declare class EngineMap {
2
+ private readonly _mappings;
3
+ set(name: string, extensions: string[]): void;
4
+ delete(name: string): void;
5
+ deleteExtension(name: string, extension: string): void;
6
+ get(name: string): string[] | undefined;
7
+ getName(extension: string): string | undefined;
8
+ }
9
+
10
+ declare class BaseEngine {
11
+ names: string[];
12
+ opts?: any;
13
+ engine: any;
14
+ rootTemplatePath?: string;
15
+ private __extensions;
16
+ getExtensions(): string[];
17
+ setExtensions(extensions: string[]): void;
18
+ deleteExtension(name: string): void;
19
+ }
20
+
21
+ type EngineInterface = {
22
+ names: string[];
23
+ engine: any;
24
+ opts?: any;
25
+ rootTemplatePath?: string;
26
+ render(source: string, data?: Record<string, unknown>): Promise<string>;
27
+ renderSync(source: string, data?: Record<string, unknown>): string;
28
+ };
29
+
30
+ declare class Markdown extends BaseEngine implements EngineInterface {
31
+ constructor(options?: any);
32
+ render(source: string, data?: Record<string, unknown>): Promise<string>;
33
+ renderSync(source: string, data?: Record<string, unknown>): string;
34
+ }
35
+
36
+ declare class Handlebars extends BaseEngine implements EngineInterface {
37
+ partialsPath: string[];
38
+ constructor(options?: Record<string, unknown>);
39
+ render(source: string, data?: Record<string, unknown>): Promise<string>;
40
+ renderSync(source: string, data?: Record<string, unknown>): string;
41
+ initPartials(): void;
42
+ registerPartials(partialsPath: string): boolean;
43
+ }
44
+
45
+ declare class EJS extends BaseEngine implements EngineInterface {
46
+ constructor(options?: Record<string, unknown>);
47
+ render(source: string, data?: Record<string, unknown>): Promise<string>;
48
+ renderSync(source: string, data?: Record<string, unknown>): string;
49
+ }
50
+
51
+ declare class Pug extends BaseEngine implements EngineInterface {
52
+ constructor(options?: Record<string, unknown>);
53
+ render(source: string, data?: Record<string, unknown>): Promise<string>;
54
+ renderSync(source: string, data?: Record<string, unknown>): string;
55
+ }
56
+
57
+ declare class Nunjucks extends BaseEngine implements EngineInterface {
58
+ constructor(options?: Record<string, unknown>);
59
+ render(source: string, data?: Record<string, unknown>): Promise<string>;
60
+ renderSync(source: string, data?: Record<string, unknown>): string;
61
+ }
62
+
63
+ declare class Liquid extends BaseEngine implements EngineInterface {
64
+ constructor(options?: Record<string, unknown>);
65
+ render(source: string, data?: Record<string, unknown>): Promise<string>;
66
+ renderSync(source: string, data?: Record<string, unknown>): string;
67
+ }
68
+
69
+ declare class Ecto {
10
70
  private readonly __mapping;
11
71
  private readonly __engines;
12
72
  private __defaultEngine;
@@ -41,3 +101,5 @@ export declare class Ecto {
41
101
  private writeFile;
42
102
  private writeFileSync;
43
103
  }
104
+
105
+ export { Ecto };