@molecule/api-templating-handlebars 1.0.0 → 1.0.1
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 +119 -0
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:49:38.088Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/api-templating-handlebars
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
Handlebars template provider for molecule.dev.
|
|
16
|
+
|
|
17
|
+
Implements the `TemplateProvider` interface using the Handlebars template
|
|
18
|
+
engine. Supports Mustache-compatible syntax with helpers, partials, and
|
|
19
|
+
pre-compiled templates for fast rendering.
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { setProvider } from '@molecule/api-templating'
|
|
25
|
+
import { provider } from '@molecule/api-templating-handlebars'
|
|
26
|
+
|
|
27
|
+
setProvider(provider)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Type
|
|
31
|
+
|
|
32
|
+
`provider`
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @molecule/api-templating-handlebars @molecule/api-templating handlebars
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API
|
|
41
|
+
|
|
42
|
+
### Interfaces
|
|
43
|
+
|
|
44
|
+
#### `HandlebarsTemplateConfig`
|
|
45
|
+
|
|
46
|
+
Configuration options for the Handlebars template provider.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
interface HandlebarsTemplateConfig {
|
|
50
|
+
/** Whether to HTML-escape output by default. Defaults to `true`. */
|
|
51
|
+
escape?: boolean
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Built-in helpers to register on creation.
|
|
55
|
+
* Keys are helper names, values are helper functions.
|
|
56
|
+
*/
|
|
57
|
+
helpers?: Record<string, (...args: unknown[]) => string>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Built-in partials to register on creation.
|
|
61
|
+
* Keys are partial names, values are partial template strings.
|
|
62
|
+
*/
|
|
63
|
+
partials?: Record<string, string>
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Functions
|
|
68
|
+
|
|
69
|
+
#### `createProvider(config)`
|
|
70
|
+
|
|
71
|
+
Creates a Handlebars template provider.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
function createProvider(config?: HandlebarsTemplateConfig): TemplateProvider
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- `config` — Provider configuration.
|
|
78
|
+
|
|
79
|
+
**Returns:** A `TemplateProvider` backed by Handlebars.
|
|
80
|
+
|
|
81
|
+
### Constants
|
|
82
|
+
|
|
83
|
+
#### `provider`
|
|
84
|
+
|
|
85
|
+
The provider implementation with default configuration.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const provider: TemplateProvider
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Core Interface
|
|
92
|
+
|
|
93
|
+
Implements `@molecule/api-templating` interface.
|
|
94
|
+
|
|
95
|
+
## Bond Wiring
|
|
96
|
+
|
|
97
|
+
Setup function to register this provider with the core interface:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { setProvider } from '@molecule/api-templating'
|
|
101
|
+
import { provider } from '@molecule/api-templating-handlebars'
|
|
102
|
+
|
|
103
|
+
export function setupTemplatingHandlebars(): void {
|
|
104
|
+
setProvider(provider)
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Injection Notes
|
|
109
|
+
|
|
110
|
+
### Requirements
|
|
111
|
+
|
|
112
|
+
Peer dependencies:
|
|
113
|
+
|
|
114
|
+
- `@molecule/api-templating` ^1.0.1
|
|
115
|
+
|
|
116
|
+
### Runtime Dependencies
|
|
117
|
+
|
|
118
|
+
- `@molecule/api-templating`
|
|
119
|
+
- `handlebars`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-templating-handlebars",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Handlebars template provider for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
21
22
|
],
|
|
22
23
|
"keywords": [
|
|
23
24
|
"molecule",
|
|
@@ -30,10 +31,10 @@
|
|
|
30
31
|
"handlebars": "4.7.9"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
|
-
"@molecule/api-templating": "^1.0.
|
|
34
|
+
"@molecule/api-templating": "^1.0.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@molecule/api-templating": "1.0.
|
|
37
|
+
"@molecule/api-templating": "1.0.1",
|
|
37
38
|
"@types/node": "26.1.2",
|
|
38
39
|
"typescript": "6.0.3",
|
|
39
40
|
"vitest": "4.1.10"
|