@hyperspan/framework 0.1.0 → 0.1.2

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/build.ts ADDED
@@ -0,0 +1,27 @@
1
+ import {build} from 'bun';
2
+ import dts from 'bun-plugin-dts';
3
+
4
+ const filesToBuild = ['./src/index.ts', './src/server.ts', './src/assets.ts'];
5
+ const outdir = './dist';
6
+ const target = 'node';
7
+
8
+ await Promise.all(
9
+ filesToBuild.map((file) =>
10
+ Promise.all([
11
+ // Build JS
12
+ build({
13
+ entrypoints: [file],
14
+ outdir,
15
+ target,
16
+ }),
17
+
18
+ // Build type files for TypeScript
19
+ build({
20
+ entrypoints: [file],
21
+ outdir,
22
+ target,
23
+ plugins: [dts()],
24
+ }),
25
+ ])
26
+ )
27
+ );
@@ -0,0 +1,46 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ declare class TmplHtml {
4
+ _kind: string;
5
+ content: string;
6
+ asyncContent: Array<{
7
+ id: string;
8
+ promise: Promise<{
9
+ id: string;
10
+ value: unknown;
11
+ }>;
12
+ }>;
13
+ constructor(props: Pick<TmplHtml, "content" | "asyncContent">);
14
+ }
15
+ /**
16
+ * Build client JS for end users (minimal JS for Hyperspan to work)
17
+ */
18
+ export declare const clientJSFiles: Map<string, {
19
+ src: string;
20
+ type?: string;
21
+ }>;
22
+ export declare function buildClientJS(): Promise<string>;
23
+ /**
24
+ * Find client CSS file built for end users
25
+ * @TODO: Build this in code here vs. relying on tailwindcss CLI tool from package scripts
26
+ */
27
+ export declare const clientCSSFiles: Map<string, string>;
28
+ export declare function buildClientCSS(): Promise<string | undefined>;
29
+ /**
30
+ * Output HTML style tag for Hyperspan app
31
+ */
32
+ export declare function hyperspanStyleTags(): TmplHtml;
33
+ /**
34
+ * Output HTML script tag for Hyperspan app
35
+ * Required for functioning streaming so content can pop into place properly once ready
36
+ */
37
+ export declare function hyperspanScriptTags(): TmplHtml;
38
+ /**
39
+ * Return a Preact component, mounted as an island in a <script> tag so it can be embedded into the page response.
40
+ */
41
+ export declare function createPreactIsland(file: string): Promise<(props: any) => {
42
+ _kind: string;
43
+ content: string;
44
+ }>;
45
+
46
+ export {};
package/dist/assets.js ADDED
@@ -0,0 +1,393 @@
1
+ // ../html/dist/html.js
2
+ /*!
3
+ * escape-html
4
+ * Copyright(c) 2012-2013 TJ Holowaychuk
5
+ * Copyright(c) 2015 Andreas Lubbe
6
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
7
+ * MIT Licensed
8
+ */
9
+ var matchHtmlRegExp = /["'&<>]/;
10
+ function escapeHtml(string) {
11
+ const str = "" + string;
12
+ const match = matchHtmlRegExp.exec(str);
13
+ if (!match) {
14
+ return str;
15
+ }
16
+ let escape;
17
+ let html = "";
18
+ let index = 0;
19
+ let lastIndex = 0;
20
+ for (index = match.index;index < str.length; index++) {
21
+ switch (str.charCodeAt(index)) {
22
+ case 34:
23
+ escape = "&quot;";
24
+ break;
25
+ case 38:
26
+ escape = "&amp;";
27
+ break;
28
+ case 39:
29
+ escape = "&#39;";
30
+ break;
31
+ case 60:
32
+ escape = "&lt;";
33
+ break;
34
+ case 62:
35
+ escape = "&gt;";
36
+ break;
37
+ default:
38
+ continue;
39
+ }
40
+ if (lastIndex !== index) {
41
+ html += str.substring(lastIndex, index);
42
+ }
43
+ lastIndex = index + 1;
44
+ html += escape;
45
+ }
46
+ return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
47
+ }
48
+
49
+ class TmplHtml {
50
+ _kind = "hstmpl";
51
+ content = "";
52
+ asyncContent;
53
+ constructor(props) {
54
+ this.content = props.content;
55
+ this.asyncContent = props.asyncContent;
56
+ }
57
+ }
58
+ var htmlId = 0;
59
+ function html(strings, ...values) {
60
+ const asyncContent = [];
61
+ let content = "";
62
+ for (let i = 0;i < strings.length; i++) {
63
+ const value = values[i];
64
+ const kind = _typeOf(value);
65
+ const renderValue = _renderValue(value, { kind, asyncContent }) || "";
66
+ content += strings[i] + (renderValue ? renderValue : "");
67
+ }
68
+ return new TmplHtml({ content, asyncContent });
69
+ }
70
+ html.raw = (content) => ({ _kind: "html_safe", content });
71
+ function _renderValue(value, opts = {
72
+ kind: undefined,
73
+ id: undefined,
74
+ asyncContent: []
75
+ }) {
76
+ if (value === null || value === undefined || Number.isNaN(value)) {
77
+ return "";
78
+ }
79
+ const kind = opts.kind || _typeOf(value);
80
+ let id = opts.id;
81
+ switch (kind) {
82
+ case "array":
83
+ return value.map((v) => _renderValue(v, { id, asyncContent: opts.asyncContent })).join("");
84
+ case "object":
85
+ id = `async_loading_${htmlId++}`;
86
+ if (value instanceof TmplHtml || value.constructor.name === "TmplHtml" || value?._kind === "hstmpl") {
87
+ opts.asyncContent.push(...value.asyncContent);
88
+ return value.content;
89
+ }
90
+ if (value?._kind === "html_safe") {
91
+ return value?.content || "";
92
+ }
93
+ if (typeof value.renderAsync === "function") {
94
+ opts.asyncContent.push({
95
+ id,
96
+ promise: value.renderAsync().then((result) => ({
97
+ id,
98
+ value: result,
99
+ asyncContent: opts.asyncContent
100
+ }))
101
+ });
102
+ }
103
+ if (typeof value.render === "function") {
104
+ return render(_htmlPlaceholder(id, value.render()));
105
+ }
106
+ return JSON.stringify(value);
107
+ case "promise":
108
+ id = `async_loading_${htmlId++}`;
109
+ opts.asyncContent.push({
110
+ id,
111
+ promise: value.then((result) => ({
112
+ id,
113
+ value: result,
114
+ asyncContent: opts.asyncContent
115
+ }))
116
+ });
117
+ return render(_htmlPlaceholder(id));
118
+ case "generator":
119
+ throw new Error("Generators are not supported as a template value at this time. Sorry :(");
120
+ default:
121
+ console.log("_renderValue kind =", kind, value);
122
+ }
123
+ return escapeHtml(String(value));
124
+ }
125
+ function _htmlPlaceholder(id, content = "Loading...") {
126
+ return html`<!--hs:loading:${id}--><slot id="${id}">${content}</slot><!--/hs:loading:${id}-->`;
127
+ }
128
+ function render(tmpl) {
129
+ return tmpl.content;
130
+ }
131
+ function _typeOf(obj) {
132
+ if (obj instanceof Promise)
133
+ return "promise";
134
+ if (obj instanceof Date)
135
+ return "date";
136
+ if (obj instanceof String)
137
+ return "string";
138
+ if (obj instanceof Number)
139
+ return "number";
140
+ if (obj instanceof Boolean)
141
+ return "boolean";
142
+ if (obj instanceof Function)
143
+ return "function";
144
+ if (Array.isArray(obj))
145
+ return "array";
146
+ if (Number.isNaN(obj))
147
+ return "NaN";
148
+ if (obj === undefined)
149
+ return "undefined";
150
+ if (obj === null)
151
+ return "null";
152
+ if (isGenerator(obj))
153
+ return "generator";
154
+ return typeof obj;
155
+ }
156
+ function isGenerator(obj) {
157
+ return obj && typeof obj.next == "function" && typeof obj.throw == "function";
158
+ }
159
+
160
+ // src/clientjs/md5.js
161
+ function md5cycle(x, k) {
162
+ var a = x[0], b = x[1], c = x[2], d = x[3];
163
+ a = ff(a, b, c, d, k[0], 7, -680876936);
164
+ d = ff(d, a, b, c, k[1], 12, -389564586);
165
+ c = ff(c, d, a, b, k[2], 17, 606105819);
166
+ b = ff(b, c, d, a, k[3], 22, -1044525330);
167
+ a = ff(a, b, c, d, k[4], 7, -176418897);
168
+ d = ff(d, a, b, c, k[5], 12, 1200080426);
169
+ c = ff(c, d, a, b, k[6], 17, -1473231341);
170
+ b = ff(b, c, d, a, k[7], 22, -45705983);
171
+ a = ff(a, b, c, d, k[8], 7, 1770035416);
172
+ d = ff(d, a, b, c, k[9], 12, -1958414417);
173
+ c = ff(c, d, a, b, k[10], 17, -42063);
174
+ b = ff(b, c, d, a, k[11], 22, -1990404162);
175
+ a = ff(a, b, c, d, k[12], 7, 1804603682);
176
+ d = ff(d, a, b, c, k[13], 12, -40341101);
177
+ c = ff(c, d, a, b, k[14], 17, -1502002290);
178
+ b = ff(b, c, d, a, k[15], 22, 1236535329);
179
+ a = gg(a, b, c, d, k[1], 5, -165796510);
180
+ d = gg(d, a, b, c, k[6], 9, -1069501632);
181
+ c = gg(c, d, a, b, k[11], 14, 643717713);
182
+ b = gg(b, c, d, a, k[0], 20, -373897302);
183
+ a = gg(a, b, c, d, k[5], 5, -701558691);
184
+ d = gg(d, a, b, c, k[10], 9, 38016083);
185
+ c = gg(c, d, a, b, k[15], 14, -660478335);
186
+ b = gg(b, c, d, a, k[4], 20, -405537848);
187
+ a = gg(a, b, c, d, k[9], 5, 568446438);
188
+ d = gg(d, a, b, c, k[14], 9, -1019803690);
189
+ c = gg(c, d, a, b, k[3], 14, -187363961);
190
+ b = gg(b, c, d, a, k[8], 20, 1163531501);
191
+ a = gg(a, b, c, d, k[13], 5, -1444681467);
192
+ d = gg(d, a, b, c, k[2], 9, -51403784);
193
+ c = gg(c, d, a, b, k[7], 14, 1735328473);
194
+ b = gg(b, c, d, a, k[12], 20, -1926607734);
195
+ a = hh(a, b, c, d, k[5], 4, -378558);
196
+ d = hh(d, a, b, c, k[8], 11, -2022574463);
197
+ c = hh(c, d, a, b, k[11], 16, 1839030562);
198
+ b = hh(b, c, d, a, k[14], 23, -35309556);
199
+ a = hh(a, b, c, d, k[1], 4, -1530992060);
200
+ d = hh(d, a, b, c, k[4], 11, 1272893353);
201
+ c = hh(c, d, a, b, k[7], 16, -155497632);
202
+ b = hh(b, c, d, a, k[10], 23, -1094730640);
203
+ a = hh(a, b, c, d, k[13], 4, 681279174);
204
+ d = hh(d, a, b, c, k[0], 11, -358537222);
205
+ c = hh(c, d, a, b, k[3], 16, -722521979);
206
+ b = hh(b, c, d, a, k[6], 23, 76029189);
207
+ a = hh(a, b, c, d, k[9], 4, -640364487);
208
+ d = hh(d, a, b, c, k[12], 11, -421815835);
209
+ c = hh(c, d, a, b, k[15], 16, 530742520);
210
+ b = hh(b, c, d, a, k[2], 23, -995338651);
211
+ a = ii(a, b, c, d, k[0], 6, -198630844);
212
+ d = ii(d, a, b, c, k[7], 10, 1126891415);
213
+ c = ii(c, d, a, b, k[14], 15, -1416354905);
214
+ b = ii(b, c, d, a, k[5], 21, -57434055);
215
+ a = ii(a, b, c, d, k[12], 6, 1700485571);
216
+ d = ii(d, a, b, c, k[3], 10, -1894986606);
217
+ c = ii(c, d, a, b, k[10], 15, -1051523);
218
+ b = ii(b, c, d, a, k[1], 21, -2054922799);
219
+ a = ii(a, b, c, d, k[8], 6, 1873313359);
220
+ d = ii(d, a, b, c, k[15], 10, -30611744);
221
+ c = ii(c, d, a, b, k[6], 15, -1560198380);
222
+ b = ii(b, c, d, a, k[13], 21, 1309151649);
223
+ a = ii(a, b, c, d, k[4], 6, -145523070);
224
+ d = ii(d, a, b, c, k[11], 10, -1120210379);
225
+ c = ii(c, d, a, b, k[2], 15, 718787259);
226
+ b = ii(b, c, d, a, k[9], 21, -343485551);
227
+ x[0] = add32(a, x[0]);
228
+ x[1] = add32(b, x[1]);
229
+ x[2] = add32(c, x[2]);
230
+ x[3] = add32(d, x[3]);
231
+ }
232
+ function cmn(q, a, b, x, s, t) {
233
+ a = add32(add32(a, q), add32(x, t));
234
+ return add32(a << s | a >>> 32 - s, b);
235
+ }
236
+ function ff(a, b, c, d, x, s, t) {
237
+ return cmn(b & c | ~b & d, a, b, x, s, t);
238
+ }
239
+ function gg(a, b, c, d, x, s, t) {
240
+ return cmn(b & d | c & ~d, a, b, x, s, t);
241
+ }
242
+ function hh(a, b, c, d, x, s, t) {
243
+ return cmn(b ^ c ^ d, a, b, x, s, t);
244
+ }
245
+ function ii(a, b, c, d, x, s, t) {
246
+ return cmn(c ^ (b | ~d), a, b, x, s, t);
247
+ }
248
+ function md51(s) {
249
+ var txt = "";
250
+ var n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i;
251
+ for (i = 64;i <= s.length; i += 64) {
252
+ md5cycle(state, md5blk(s.substring(i - 64, i)));
253
+ }
254
+ s = s.substring(i - 64);
255
+ var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
256
+ for (i = 0;i < s.length; i++)
257
+ tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
258
+ tail[i >> 2] |= 128 << (i % 4 << 3);
259
+ if (i > 55) {
260
+ md5cycle(state, tail);
261
+ for (i = 0;i < 16; i++)
262
+ tail[i] = 0;
263
+ }
264
+ tail[14] = n * 8;
265
+ md5cycle(state, tail);
266
+ return state;
267
+ }
268
+ function md5blk(s) {
269
+ var md5blks = [], i;
270
+ for (i = 0;i < 64; i += 4) {
271
+ md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
272
+ }
273
+ return md5blks;
274
+ }
275
+ var hex_chr = "0123456789abcdef".split("");
276
+ function rhex(n) {
277
+ var s = "", j = 0;
278
+ for (;j < 4; j++)
279
+ s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];
280
+ return s;
281
+ }
282
+ function hex(x) {
283
+ for (var i = 0;i < x.length; i++)
284
+ x[i] = rhex(x[i]);
285
+ return x.join("");
286
+ }
287
+ function add32(a, b) {
288
+ return a + b & 4294967295;
289
+ }
290
+ function md5(s) {
291
+ return hex(md51(s));
292
+ }
293
+
294
+ // src/assets.ts
295
+ import { readdir } from "node:fs/promises";
296
+ import { resolve } from "node:path";
297
+ var IS_PROD = false;
298
+ var PWD = import.meta.dir;
299
+ var clientJSFiles = new Map;
300
+ async function buildClientJS() {
301
+ const sourceFile = resolve(PWD, "../", "./src/clientjs/hyperspan-client.ts");
302
+ const output = await Bun.build({
303
+ entrypoints: [sourceFile],
304
+ outdir: `./public/_hs/js`,
305
+ naming: IS_PROD ? "[dir]/[name]-[hash].[ext]" : undefined,
306
+ minify: IS_PROD
307
+ });
308
+ const jsFile = output.outputs[0].path.split("/").reverse()[0];
309
+ clientJSFiles.set("_hs", { src: "/_hs/js/" + jsFile });
310
+ return jsFile;
311
+ }
312
+ var clientCSSFiles = new Map;
313
+ async function buildClientCSS() {
314
+ if (clientCSSFiles.has("_hs")) {
315
+ return clientCSSFiles.get("_hs");
316
+ }
317
+ const cssDir = "./public/_hs/css/";
318
+ const cssFiles = await readdir(cssDir);
319
+ let foundCSSFile = "";
320
+ for (const file of cssFiles) {
321
+ if (!file.endsWith(".css")) {
322
+ continue;
323
+ }
324
+ foundCSSFile = file.replace(cssDir, "");
325
+ clientCSSFiles.set("_hs", foundCSSFile);
326
+ break;
327
+ }
328
+ if (!foundCSSFile) {
329
+ console.log(`Unable to build CSS files from ${cssDir}`);
330
+ }
331
+ }
332
+ function hyperspanStyleTags() {
333
+ const cssFiles = Array.from(clientCSSFiles.entries());
334
+ return html`${cssFiles.map(([_, file]) => html`<link rel="stylesheet" href="/_hs/css/${file}" />`)}`;
335
+ }
336
+ function hyperspanScriptTags() {
337
+ const jsFiles = Array.from(clientJSFiles.entries());
338
+ return html`
339
+ <script type="importmap">
340
+ {
341
+ "imports": {
342
+ "preact": "https://esm.sh/preact@10.26.4",
343
+ "preact/": "https://esm.sh/preact@10.26.4/",
344
+ "react": "https://esm.sh/preact@10.26.4/compat",
345
+ "react/": "https://esm.sh/preact@10.26.4/compat/",
346
+ "react-dom": "https://esm.sh/preact@10.26.4/compat"
347
+ }
348
+ }
349
+ </script>
350
+ ${jsFiles.map(([key, file]) => html`<script
351
+ id="js-${key}"
352
+ type="${file.type || "text/javascript"}"
353
+ src="${file.src}"
354
+ ></script>`)}
355
+ `;
356
+ }
357
+ async function createPreactIsland(file) {
358
+ let filePath = file.replace("file://", "");
359
+ let resultStr = 'import{h,render}from"preact";';
360
+ const build = await Bun.build({
361
+ entrypoints: [filePath],
362
+ minify: true,
363
+ external: ["react", "preact"],
364
+ env: "APP_PUBLIC_*"
365
+ });
366
+ for (const output of build.outputs) {
367
+ resultStr += await output.text();
368
+ }
369
+ const r = /export\{([a-zA-Z]+) as default\}/g;
370
+ const matchExport = r.exec(resultStr);
371
+ const jsId = md5(resultStr);
372
+ if (!matchExport) {
373
+ throw new Error("File does not have a default export! Ensure a function has export default to use this.");
374
+ }
375
+ const fn = matchExport[1];
376
+ let _mounted = false;
377
+ return (props) => {
378
+ if (!_mounted) {
379
+ _mounted = true;
380
+ resultStr += `render(h(${fn}, ${JSON.stringify(props)}), document.getElementById("${jsId}"));`;
381
+ }
382
+ return html.raw(`<div id="${jsId}"></div><script type="module" data-source-id="${jsId}">${resultStr}</script>`);
383
+ };
384
+ }
385
+ export {
386
+ hyperspanStyleTags,
387
+ hyperspanScriptTags,
388
+ createPreactIsland,
389
+ clientJSFiles,
390
+ clientCSSFiles,
391
+ buildClientJS,
392
+ buildClientCSS
393
+ };
@@ -0,0 +1,132 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { Context, Handler, Hono } from 'hono';
4
+
5
+ declare class TmplHtml {
6
+ _kind: string;
7
+ content: string;
8
+ asyncContent: Array<{
9
+ id: string;
10
+ promise: Promise<{
11
+ id: string;
12
+ value: unknown;
13
+ }>;
14
+ }>;
15
+ constructor(props: Pick<TmplHtml, "content" | "asyncContent">);
16
+ }
17
+ export declare const IS_PROD: boolean;
18
+ /**
19
+ * Route
20
+ * Define a route that can handle a direct HTTP request
21
+ * Route handlers should return a Response or TmplHtml object
22
+ */
23
+ export declare function createRoute(handler: Handler): HSRoute;
24
+ /**
25
+ * Component
26
+ * Define a component or partial with an optional loading placeholder
27
+ * These can be rendered anywhere inside other templates - even if async.
28
+ */
29
+ export declare function createComponent(render: () => THSComponentReturn | Promise<THSComponentReturn>): HSComponent;
30
+ /**
31
+ * Form + route handler
32
+ * Automatically handles and parses form data
33
+ *
34
+ * INITIAL IDEA OF HOW THIS WILL WORK:
35
+ * ---
36
+ * 1. Renders component as initial form markup for GET request
37
+ * 2. Bind form onSubmit function to custom client JS handling
38
+ * 3. Submits form with JavaScript fetch()
39
+ * 4. Replaces form content with content from server
40
+ * 5. All validation and save logic is on the server
41
+ * 6. Handles any Exception thrown on server as error displayed in client
42
+ */
43
+ export declare function createForm(renderForm: (data?: any) => THSResponseTypes, schema?: z.ZodSchema | null): HSFormRoute;
44
+ /**
45
+ * Types
46
+ */
47
+ export type THSComponentReturn = TmplHtml | string | number | null;
48
+ export type THSResponseTypes = TmplHtml | Response | string | null;
49
+ export declare const HS_DEFAULT_LOADING: () => TmplHtml;
50
+ /**
51
+ * Route handler helper
52
+ */
53
+ export declare class HSComponent {
54
+ _kind: string;
55
+ _handlers: Record<string, Handler>;
56
+ _loading?: () => TmplHtml;
57
+ render: () => THSComponentReturn | Promise<THSComponentReturn>;
58
+ constructor(render: () => THSComponentReturn | Promise<THSComponentReturn>);
59
+ loading(fn: () => TmplHtml): this;
60
+ }
61
+ /**
62
+ * Route handler helper
63
+ */
64
+ export declare class HSRoute {
65
+ _kind: string;
66
+ _handlers: Record<string, Handler>;
67
+ _methods: null | string[];
68
+ constructor(handler: Handler);
69
+ }
70
+ /**
71
+ * Form route handler helper
72
+ */
73
+ export type THSFormRenderer = (data?: any) => THSResponseTypes;
74
+ export declare class HSFormRoute {
75
+ _kind: string;
76
+ _handlers: Record<string, Handler>;
77
+ _form: THSFormRenderer;
78
+ _methods: null | string[];
79
+ _schema: null | z.ZodSchema;
80
+ constructor(renderForm: THSFormRenderer, schema?: z.ZodSchema | null);
81
+ getDefaultData(): unknown;
82
+ /**
83
+ * Get form renderer method
84
+ */
85
+ renderForm(data?: any): THSResponseTypes;
86
+ get(handler: Handler): this;
87
+ patch(handler: Handler): this;
88
+ post(handler: Handler): this;
89
+ put(handler: Handler): this;
90
+ delete(handler: Handler): this;
91
+ }
92
+ /**
93
+ * Run route from file
94
+ */
95
+ export declare function runFileRoute(RouteModule: any, context: Context): Promise<Response | false>;
96
+ export type THSServerConfig = {
97
+ appDir: string;
98
+ staticFileRoot: string;
99
+ rewrites?: Array<{
100
+ source: string;
101
+ destination: string;
102
+ }>;
103
+ beforeRoutesAdded?: (app: Hono) => void;
104
+ afterRoutesAdded?: (app: Hono) => void;
105
+ };
106
+ export type THSRouteMap = {
107
+ file: string;
108
+ route: string;
109
+ params: string[];
110
+ };
111
+ export declare function buildRoutes(config: THSServerConfig): Promise<THSRouteMap[]>;
112
+ /**
113
+ * Create and start Bun HTTP server
114
+ */
115
+ export declare function createServer(config: THSServerConfig): Promise<Hono>;
116
+ /**
117
+ * Streaming HTML Response
118
+ */
119
+ export declare class StreamResponse extends Response {
120
+ constructor(iterator: AsyncIterator<unknown>, options?: {});
121
+ }
122
+ /**
123
+ * Does what it says on the tin...
124
+ */
125
+ export declare function createReadableStreamFromAsyncGenerator(output: AsyncGenerator): ReadableStream<any>;
126
+ /**
127
+ * Normalize URL path
128
+ * Removes trailing slash and lowercases path
129
+ */
130
+ export declare function normalizePath(urlPath: string): string;
131
+
132
+ export {};