@dxgjs/templates 0.0.0-stage → 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DXG Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,27 @@
1
- # Temporary Holding Version
1
+ # @dxgjs/templates
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Template engine for DXG.
4
+
5
+ > Internal package of the [DXG](https://github.com/dxgjs/dxg) monorepo. If you want to use DXG, install the CLI instead: `npx @dxgjs/cli`.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm i @dxgjs/templates
11
+ # or
12
+ pnpm add @dxgjs/templates
13
+ ```
14
+
15
+ ## Requirements
16
+
17
+ - Node.js >= 22.13
18
+ - ESM only
19
+
20
+ ## Links
21
+
22
+ - Repository: https://github.com/dxgjs/dxg
23
+ - Issues: https://github.com/dxgjs/dxg/issues
24
+
25
+ ## License
26
+
27
+ MIT
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Simple template rendering: replace {{key}} with value from data.
3
+ * If value is undefined, placeholder is left unchanged.
4
+ */
5
+ declare function render(template: string, data: Record<string, unknown>): string;
6
+
7
+ export { render };
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ // src/index.ts
2
+ function render(template, data) {
3
+ return template.replace(/{{([^}]+)}}/g, (_, key) => {
4
+ const cleanKey = key.trim();
5
+ const value = data[cleanKey];
6
+ return value === null || value === void 0 ? `{{${key}}}` : String(value);
7
+ });
8
+ }
9
+ export {
10
+ render
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Simple template rendering: replace {{key}} with value from data.\n * If value is undefined, placeholder is left unchanged.\n */\nexport function render(template: string, data: Record<string, unknown>): string {\n return template.replace(/{{([^}]+)}}/g, (_, key: string) => {\n // Trim spaces inside key\n const cleanKey = key.trim();\n const value = data[cleanKey];\n return value === null || value === undefined ? `{{${key}}}` : String(value);\n });\n}"],"mappings":";AAIO,SAAS,OAAO,UAAkB,MAAuC;AAC9E,SAAO,SAAS,QAAQ,gBAAgB,CAAC,GAAG,QAAgB;AAE1D,UAAM,WAAW,IAAI,KAAK;AAC1B,UAAM,QAAQ,KAAK,QAAQ;AAC3B,WAAO,UAAU,QAAQ,UAAU,SAAY,KAAK,GAAG,OAAO,OAAO,KAAK;AAAA,EAC5E,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@dxgjs/templates",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Template engine for DXG",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/dxgjs/dxg.git",
9
+ "directory": "packages/templates"
10
+ },
11
+ "homepage": "https://github.com/dxgjs/dxg/tree/main/packages/templates#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/dxgjs/dxg/issues"
14
+ },
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "engines": {
26
+ "node": ">=22.13"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "main": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "dependencies": {
34
+ "@dxgjs/fs": "0.1.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^26.2.0",
38
+ "eslint": "^10.8.1",
39
+ "tsup": "^8.5.1",
40
+ "typescript": "^5.9.3",
41
+ "vitest": "^4.1.10",
42
+ "@dxgjs/eslint-config": "0.0.0",
43
+ "@dxgjs/typescript-config": "0.0.0"
44
+ },
45
+ "scripts": {
46
+ "build": "tsup",
47
+ "lint": "eslint .",
48
+ "test": "vitest run",
49
+ "test:watch": "vitest",
50
+ "typecheck": "tsc --noEmit",
51
+ "check": "pnpm lint && pnpm typecheck && pnpm test"
52
+ }
6
53
  }