miki-template 2.0.0 → 2.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.
@@ -10,8 +10,59 @@
10
10
  "dependencies": {
11
11
  "express": "^5.2.1",
12
12
  "miki-template": "file:../miki-template-2.0.0.tgz"
13
+ },
14
+ "devDependencies": {
15
+ "elysia": "^1.4.30",
16
+ "hono": "^4.13.7"
13
17
  }
14
18
  },
19
+ "node_modules/@borewit/text-codec": {
20
+ "version": "0.2.2",
21
+ "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.2.tgz",
22
+ "integrity": "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==",
23
+ "dev": true,
24
+ "license": "MIT",
25
+ "peer": true,
26
+ "funding": {
27
+ "type": "github",
28
+ "url": "https://github.com/sponsors/Borewit"
29
+ }
30
+ },
31
+ "node_modules/@sinclair/typebox": {
32
+ "version": "0.34.52",
33
+ "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.52.tgz",
34
+ "integrity": "sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw==",
35
+ "dev": true,
36
+ "license": "MIT",
37
+ "peer": true
38
+ },
39
+ "node_modules/@tokenizer/inflate": {
40
+ "version": "0.4.1",
41
+ "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz",
42
+ "integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==",
43
+ "dev": true,
44
+ "license": "MIT",
45
+ "peer": true,
46
+ "dependencies": {
47
+ "debug": "^4.4.3",
48
+ "token-types": "^6.1.1"
49
+ },
50
+ "engines": {
51
+ "node": ">=18"
52
+ },
53
+ "funding": {
54
+ "type": "github",
55
+ "url": "https://github.com/sponsors/Borewit"
56
+ }
57
+ },
58
+ "node_modules/@tokenizer/token": {
59
+ "version": "0.3.0",
60
+ "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz",
61
+ "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==",
62
+ "dev": true,
63
+ "license": "MIT",
64
+ "peer": true
65
+ },
15
66
  "node_modules/accepts": {
16
67
  "version": "2.0.0",
17
68
  "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
@@ -196,6 +247,49 @@
196
247
  "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
197
248
  "license": "MIT"
198
249
  },
250
+ "node_modules/elysia": {
251
+ "version": "1.4.30",
252
+ "resolved": "https://registry.npmjs.org/elysia/-/elysia-1.4.30.tgz",
253
+ "integrity": "sha512-S2qqV0CbM4faB1hQQ5IYoeYnAUinjHlzRduxaBc4OoNqh0GjOc8k6tt3hv5ozWcG6Svr6hugw6JL4zNke4jwfA==",
254
+ "dev": true,
255
+ "license": "MIT",
256
+ "dependencies": {
257
+ "cookie": "^1.1.1",
258
+ "exact-mirror": "^0.2.7",
259
+ "fast-decode-uri-component": "^1.0.1",
260
+ "memoirist": "^0.4.0"
261
+ },
262
+ "peerDependencies": {
263
+ "@sinclair/typebox": ">= 0.34.0 < 1",
264
+ "@types/bun": ">= 1.2.0",
265
+ "exact-mirror": ">= 0.0.9",
266
+ "file-type": ">= 20.0.0",
267
+ "openapi-types": ">= 12.0.0",
268
+ "typescript": ">= 5.0.0"
269
+ },
270
+ "peerDependenciesMeta": {
271
+ "@types/bun": {
272
+ "optional": true
273
+ },
274
+ "typescript": {
275
+ "optional": true
276
+ }
277
+ }
278
+ },
279
+ "node_modules/elysia/node_modules/cookie": {
280
+ "version": "1.1.1",
281
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",
282
+ "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",
283
+ "dev": true,
284
+ "license": "MIT",
285
+ "engines": {
286
+ "node": ">=18"
287
+ },
288
+ "funding": {
289
+ "type": "opencollective",
290
+ "url": "https://opencollective.com/express"
291
+ }
292
+ },
199
293
  "node_modules/encodeurl": {
200
294
  "version": "2.0.0",
201
295
  "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
@@ -250,6 +344,21 @@
250
344
  "node": ">= 0.6"
251
345
  }
252
346
  },
347
+ "node_modules/exact-mirror": {
348
+ "version": "0.2.7",
349
+ "resolved": "https://registry.npmjs.org/exact-mirror/-/exact-mirror-0.2.7.tgz",
350
+ "integrity": "sha512-+MeEmDcLA4o/vjK2zujgk+1VTxPR4hdp23qLqkWfStbECtAq9gmsvQa3LW6z/0GXZyHJobrCnmy1cdeE7BjsYg==",
351
+ "dev": true,
352
+ "license": "MIT",
353
+ "peerDependencies": {
354
+ "@sinclair/typebox": "^0.34.15"
355
+ },
356
+ "peerDependenciesMeta": {
357
+ "@sinclair/typebox": {
358
+ "optional": true
359
+ }
360
+ }
361
+ },
253
362
  "node_modules/express": {
254
363
  "version": "5.2.1",
255
364
  "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
@@ -293,6 +402,33 @@
293
402
  "url": "https://opencollective.com/express"
294
403
  }
295
404
  },
405
+ "node_modules/fast-decode-uri-component": {
406
+ "version": "1.0.1",
407
+ "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz",
408
+ "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==",
409
+ "dev": true,
410
+ "license": "MIT"
411
+ },
412
+ "node_modules/file-type": {
413
+ "version": "22.0.2",
414
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-22.0.2.tgz",
415
+ "integrity": "sha512-0H8TsCUGBLx+V5adH3EY52hTAcyLKbV1D4gq5cIOJ6DnQAHeV9Z2Hhuc5CoBX4YmvB2oL+JIC84z0qO7JsCoNw==",
416
+ "dev": true,
417
+ "license": "MIT",
418
+ "peer": true,
419
+ "dependencies": {
420
+ "@tokenizer/inflate": "^0.4.1",
421
+ "strtok3": "^10.3.5",
422
+ "token-types": "^6.1.2",
423
+ "uint8array-extras": "^1.5.0"
424
+ },
425
+ "engines": {
426
+ "node": ">=22"
427
+ },
428
+ "funding": {
429
+ "url": "https://github.com/sindresorhus/file-type?sponsor=1"
430
+ }
431
+ },
296
432
  "node_modules/finalhandler": {
297
433
  "version": "2.1.1",
298
434
  "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
@@ -423,6 +559,16 @@
423
559
  "he": "bin/he"
424
560
  }
425
561
  },
562
+ "node_modules/hono": {
563
+ "version": "4.13.7",
564
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.7.tgz",
565
+ "integrity": "sha512-c8/gF9ac8Y78/agExVocyLevgR+JlpNB444Py0FSX8pJoPdYUfUzRcXtYEYGwt6l19qIlVZPN5Mfsw9jFShmQQ==",
566
+ "dev": true,
567
+ "license": "MIT",
568
+ "engines": {
569
+ "node": ">=16.9.0"
570
+ }
571
+ },
426
572
  "node_modules/http-errors": {
427
573
  "version": "2.0.1",
428
574
  "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
@@ -459,6 +605,28 @@
459
605
  "url": "https://opencollective.com/express"
460
606
  }
461
607
  },
608
+ "node_modules/ieee754": {
609
+ "version": "1.2.1",
610
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
611
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
612
+ "dev": true,
613
+ "funding": [
614
+ {
615
+ "type": "github",
616
+ "url": "https://github.com/sponsors/feross"
617
+ },
618
+ {
619
+ "type": "patreon",
620
+ "url": "https://www.patreon.com/feross"
621
+ },
622
+ {
623
+ "type": "consulting",
624
+ "url": "https://feross.org/support"
625
+ }
626
+ ],
627
+ "license": "BSD-3-Clause",
628
+ "peer": true
629
+ },
462
630
  "node_modules/inherits": {
463
631
  "version": "2.0.4",
464
632
  "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@@ -502,6 +670,13 @@
502
670
  "url": "https://opencollective.com/express"
503
671
  }
504
672
  },
673
+ "node_modules/memoirist": {
674
+ "version": "0.4.0",
675
+ "resolved": "https://registry.npmjs.org/memoirist/-/memoirist-0.4.0.tgz",
676
+ "integrity": "sha512-zxTgA0mSYELa66DimuNQDvyLq36AwDlTuVRbnQtB+VuTcKWm5Qc4z3WkSpgsFWHNhexqkIooqpv4hdcqrX5Nmg==",
677
+ "dev": true,
678
+ "license": "MIT"
679
+ },
505
680
  "node_modules/merge-descriptors": {
506
681
  "version": "2.0.0",
507
682
  "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
@@ -617,6 +792,14 @@
617
792
  "wrappy": "1"
618
793
  }
619
794
  },
795
+ "node_modules/openapi-types": {
796
+ "version": "12.1.3",
797
+ "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz",
798
+ "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==",
799
+ "dev": true,
800
+ "license": "MIT",
801
+ "peer": true
802
+ },
620
803
  "node_modules/parseurl": {
621
804
  "version": "1.3.3",
622
805
  "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -847,6 +1030,24 @@
847
1030
  "node": ">= 0.8"
848
1031
  }
849
1032
  },
1033
+ "node_modules/strtok3": {
1034
+ "version": "10.3.5",
1035
+ "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.5.tgz",
1036
+ "integrity": "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==",
1037
+ "dev": true,
1038
+ "license": "MIT",
1039
+ "peer": true,
1040
+ "dependencies": {
1041
+ "@tokenizer/token": "^0.3.0"
1042
+ },
1043
+ "engines": {
1044
+ "node": ">=18"
1045
+ },
1046
+ "funding": {
1047
+ "type": "github",
1048
+ "url": "https://github.com/sponsors/Borewit"
1049
+ }
1050
+ },
850
1051
  "node_modules/toidentifier": {
851
1052
  "version": "1.0.1",
852
1053
  "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@@ -856,6 +1057,26 @@
856
1057
  "node": ">=0.6"
857
1058
  }
858
1059
  },
1060
+ "node_modules/token-types": {
1061
+ "version": "6.1.2",
1062
+ "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.2.tgz",
1063
+ "integrity": "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==",
1064
+ "dev": true,
1065
+ "license": "MIT",
1066
+ "peer": true,
1067
+ "dependencies": {
1068
+ "@borewit/text-codec": "^0.2.1",
1069
+ "@tokenizer/token": "^0.3.0",
1070
+ "ieee754": "^1.2.1"
1071
+ },
1072
+ "engines": {
1073
+ "node": ">=14.16"
1074
+ },
1075
+ "funding": {
1076
+ "type": "github",
1077
+ "url": "https://github.com/sponsors/Borewit"
1078
+ }
1079
+ },
859
1080
  "node_modules/type-is": {
860
1081
  "version": "2.1.0",
861
1082
  "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
@@ -887,6 +1108,20 @@
887
1108
  "url": "https://opencollective.com/express"
888
1109
  }
889
1110
  },
1111
+ "node_modules/uint8array-extras": {
1112
+ "version": "1.5.0",
1113
+ "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz",
1114
+ "integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==",
1115
+ "dev": true,
1116
+ "license": "MIT",
1117
+ "peer": true,
1118
+ "engines": {
1119
+ "node": ">=18"
1120
+ },
1121
+ "funding": {
1122
+ "url": "https://github.com/sponsors/sindresorhus"
1123
+ }
1124
+ },
890
1125
  "node_modules/unpipe": {
891
1126
  "version": "1.0.0",
892
1127
  "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@@ -5,5 +5,9 @@
5
5
  "dependencies": {
6
6
  "express": "^5.2.1",
7
7
  "miki-template": "file:../miki-template-2.0.0.tgz"
8
+ },
9
+ "devDependencies": {
10
+ "elysia": "^1.4.30",
11
+ "hono": "^4.13.7"
8
12
  }
9
13
  }
@@ -0,0 +1,17 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>Home</title>
5
+ </head>
6
+ <body>
7
+ <h1>Welcome, {{ user }}</h1>
8
+
9
+ {% partialdef card %}
10
+ <div class="card">Card: {{ title }}</div>
11
+ {% endpartialdef %}
12
+
13
+ <div id="content">
14
+ {% partial card %}
15
+ </div>
16
+ </body>
17
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miki-template",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Django-Style template engine for Node.js and Express",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -16,7 +16,11 @@
16
16
  "engine",
17
17
  "express",
18
18
  "nodejs",
19
- "esm"
19
+ "bun",
20
+ "esm",
21
+ "koa",
22
+ "fastify",
23
+ "nestjs"
20
24
  ],
21
25
  "author": "",
22
26
  "license": "MIT",
@@ -25,10 +29,14 @@
25
29
  "he": "^1.2.0"
26
30
  },
27
31
  "devDependencies": {
32
+ "koa": "^3.2.1",
33
+ "fastify": "^5.12.3",
34
+ "ejs": "^6.0.1",
35
+ "eslint": "^8.50.0",
28
36
  "express": "^5.2.1",
29
- "eslint": "^8.50.0"
30
- }
31
- ,
37
+ "handlebars": "^4.7.9",
38
+ "pug": "^3.0.4"
39
+ },
32
40
  "scripts": {
33
41
  "test": "node -e \"const fs=require('fs');const path=require('path');function walk(d){const out=[];for(const e of fs.readdirSync(d,{withFileTypes:true})){const p=path.join(d,e.name);if(e.isDirectory())out.push(...walk(p));else if(/\\\\.test\\\\.(cjs|mjs|js)$/.test(e.name))out.push(p);}return out;}const files=walk('tests');require('child_process').execSync('node --test '+files.join(' '),{stdio:'inherit'})\"",
34
42
  "lint": "eslint . -f unix",
@@ -0,0 +1,13 @@
1
+ const test = require('node:test');
2
+ const assert = require('assert');
3
+ const path = require('path');
4
+ const miki = require('../../src/index.js');
5
+
6
+ test('engine partial render via render() and asyncRender()', async () => {
7
+ const views = path.resolve(__dirname, '..', '..', 'live-test', 'views');
8
+ const sync = miki.render('home#card', { user: 'Tester', title: 'T' }, { views });
9
+ assert.ok(sync.includes('Card'), 'sync partial should contain Card');
10
+
11
+ const asyncRes = await miki.asyncRender('home#card', { user: 'Tester', title: 'T' }, { views });
12
+ assert.ok(asyncRes.includes('Card'), 'async partial should contain Card');
13
+ });