@hyperspan/framework 0.1.1 → 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/dist/assets.d.ts +14 -2
- package/dist/assets.js +13 -14
- package/dist/index.d.ts +12 -1
- package/dist/index.js +62 -69
- package/dist/server.d.ts +12 -1
- package/dist/server.js +62 -69
- package/package.json +1 -1
- package/src/assets.ts +11 -11
- package/src/clientjs/hyperspan-client.ts +4 -4
- package/src/server.ts +27 -18
package/dist/assets.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
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
|
+
}
|
|
3
15
|
/**
|
|
4
16
|
* Build client JS for end users (minimal JS for Hyperspan to work)
|
|
5
17
|
*/
|
|
@@ -17,12 +29,12 @@ export declare function buildClientCSS(): Promise<string | undefined>;
|
|
|
17
29
|
/**
|
|
18
30
|
* Output HTML style tag for Hyperspan app
|
|
19
31
|
*/
|
|
20
|
-
export declare function hyperspanStyleTags():
|
|
32
|
+
export declare function hyperspanStyleTags(): TmplHtml;
|
|
21
33
|
/**
|
|
22
34
|
* Output HTML script tag for Hyperspan app
|
|
23
35
|
* Required for functioning streaming so content can pop into place properly once ready
|
|
24
36
|
*/
|
|
25
|
-
export declare function hyperspanScriptTags():
|
|
37
|
+
export declare function hyperspanScriptTags(): TmplHtml;
|
|
26
38
|
/**
|
|
27
39
|
* Return a Preact component, mounted as an island in a <script> tag so it can be embedded into the page response.
|
|
28
40
|
*/
|
package/dist/assets.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ../html/dist/html.js
|
|
2
2
|
/*!
|
|
3
3
|
* escape-html
|
|
4
4
|
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
@@ -47,6 +47,7 @@ function escapeHtml(string) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
class TmplHtml {
|
|
50
|
+
_kind = "hstmpl";
|
|
50
51
|
content = "";
|
|
51
52
|
asyncContent;
|
|
52
53
|
constructor(props) {
|
|
@@ -59,15 +60,9 @@ function html(strings, ...values) {
|
|
|
59
60
|
const asyncContent = [];
|
|
60
61
|
let content = "";
|
|
61
62
|
for (let i = 0;i < strings.length; i++) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let id = `async_loading_${htmlId++}`;
|
|
66
|
-
let kind = _typeOf(value);
|
|
67
|
-
if (!renderValue) {
|
|
68
|
-
renderValue = _renderValue(value, { id, kind, asyncContent }) || "";
|
|
69
|
-
}
|
|
70
|
-
}
|
|
63
|
+
const value = values[i];
|
|
64
|
+
const kind = _typeOf(value);
|
|
65
|
+
const renderValue = _renderValue(value, { kind, asyncContent }) || "";
|
|
71
66
|
content += strings[i] + (renderValue ? renderValue : "");
|
|
72
67
|
}
|
|
73
68
|
return new TmplHtml({ content, asyncContent });
|
|
@@ -82,12 +77,13 @@ function _renderValue(value, opts = {
|
|
|
82
77
|
return "";
|
|
83
78
|
}
|
|
84
79
|
const kind = opts.kind || _typeOf(value);
|
|
85
|
-
|
|
80
|
+
let id = opts.id;
|
|
86
81
|
switch (kind) {
|
|
87
82
|
case "array":
|
|
88
83
|
return value.map((v) => _renderValue(v, { id, asyncContent: opts.asyncContent })).join("");
|
|
89
84
|
case "object":
|
|
90
|
-
|
|
85
|
+
id = `async_loading_${htmlId++}`;
|
|
86
|
+
if (value instanceof TmplHtml || value.constructor.name === "TmplHtml" || value?._kind === "hstmpl") {
|
|
91
87
|
opts.asyncContent.push(...value.asyncContent);
|
|
92
88
|
return value.content;
|
|
93
89
|
}
|
|
@@ -109,6 +105,7 @@ function _renderValue(value, opts = {
|
|
|
109
105
|
}
|
|
110
106
|
return JSON.stringify(value);
|
|
111
107
|
case "promise":
|
|
108
|
+
id = `async_loading_${htmlId++}`;
|
|
112
109
|
opts.asyncContent.push({
|
|
113
110
|
id,
|
|
114
111
|
promise: value.then((result) => ({
|
|
@@ -120,6 +117,8 @@ function _renderValue(value, opts = {
|
|
|
120
117
|
return render(_htmlPlaceholder(id));
|
|
121
118
|
case "generator":
|
|
122
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);
|
|
123
122
|
}
|
|
124
123
|
return escapeHtml(String(value));
|
|
125
124
|
}
|
|
@@ -299,7 +298,7 @@ var IS_PROD = false;
|
|
|
299
298
|
var PWD = import.meta.dir;
|
|
300
299
|
var clientJSFiles = new Map;
|
|
301
300
|
async function buildClientJS() {
|
|
302
|
-
const sourceFile = resolve(PWD, "../", "./
|
|
301
|
+
const sourceFile = resolve(PWD, "../", "./src/clientjs/hyperspan-client.ts");
|
|
303
302
|
const output = await Bun.build({
|
|
304
303
|
entrypoints: [sourceFile],
|
|
305
304
|
outdir: `./public/_hs/js`,
|
|
@@ -332,7 +331,7 @@ async function buildClientCSS() {
|
|
|
332
331
|
}
|
|
333
332
|
function hyperspanStyleTags() {
|
|
334
333
|
const cssFiles = Array.from(clientCSSFiles.entries());
|
|
335
|
-
return html`${cssFiles.map(([
|
|
334
|
+
return html`${cssFiles.map(([_, file]) => html`<link rel="stylesheet" href="/_hs/css/${file}" />`)}`;
|
|
336
335
|
}
|
|
337
336
|
function hyperspanScriptTags() {
|
|
338
337
|
const jsFiles = Array.from(clientJSFiles.entries());
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
import { TmplHtml } from '@hyperspan/html';
|
|
4
3
|
import { Context, Handler, Hono } from 'hono';
|
|
5
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
|
+
}
|
|
6
17
|
export declare const IS_PROD: boolean;
|
|
7
18
|
/**
|
|
8
19
|
* Route
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { readdir as readdir2 } from "node:fs/promises";
|
|
3
3
|
import { basename, extname, join } from "node:path";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// ../html/dist/html.js
|
|
6
6
|
/*!
|
|
7
7
|
* escape-html
|
|
8
8
|
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
@@ -51,6 +51,7 @@ function escapeHtml(string) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
class TmplHtml {
|
|
54
|
+
_kind = "hstmpl";
|
|
54
55
|
content = "";
|
|
55
56
|
asyncContent;
|
|
56
57
|
constructor(props) {
|
|
@@ -63,15 +64,9 @@ function html(strings, ...values) {
|
|
|
63
64
|
const asyncContent = [];
|
|
64
65
|
let content = "";
|
|
65
66
|
for (let i = 0;i < strings.length; i++) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
let id = `async_loading_${htmlId++}`;
|
|
70
|
-
let kind = _typeOf(value);
|
|
71
|
-
if (!renderValue) {
|
|
72
|
-
renderValue = _renderValue(value, { id, kind, asyncContent }) || "";
|
|
73
|
-
}
|
|
74
|
-
}
|
|
67
|
+
const value = values[i];
|
|
68
|
+
const kind = _typeOf(value);
|
|
69
|
+
const renderValue = _renderValue(value, { kind, asyncContent }) || "";
|
|
75
70
|
content += strings[i] + (renderValue ? renderValue : "");
|
|
76
71
|
}
|
|
77
72
|
return new TmplHtml({ content, asyncContent });
|
|
@@ -86,12 +81,13 @@ function _renderValue(value, opts = {
|
|
|
86
81
|
return "";
|
|
87
82
|
}
|
|
88
83
|
const kind = opts.kind || _typeOf(value);
|
|
89
|
-
|
|
84
|
+
let id = opts.id;
|
|
90
85
|
switch (kind) {
|
|
91
86
|
case "array":
|
|
92
87
|
return value.map((v) => _renderValue(v, { id, asyncContent: opts.asyncContent })).join("");
|
|
93
88
|
case "object":
|
|
94
|
-
|
|
89
|
+
id = `async_loading_${htmlId++}`;
|
|
90
|
+
if (value instanceof TmplHtml || value.constructor.name === "TmplHtml" || value?._kind === "hstmpl") {
|
|
95
91
|
opts.asyncContent.push(...value.asyncContent);
|
|
96
92
|
return value.content;
|
|
97
93
|
}
|
|
@@ -113,6 +109,7 @@ function _renderValue(value, opts = {
|
|
|
113
109
|
}
|
|
114
110
|
return JSON.stringify(value);
|
|
115
111
|
case "promise":
|
|
112
|
+
id = `async_loading_${htmlId++}`;
|
|
116
113
|
opts.asyncContent.push({
|
|
117
114
|
id,
|
|
118
115
|
promise: value.then((result) => ({
|
|
@@ -124,6 +121,8 @@ function _renderValue(value, opts = {
|
|
|
124
121
|
return render(_htmlPlaceholder(id));
|
|
125
122
|
case "generator":
|
|
126
123
|
throw new Error("Generators are not supported as a template value at this time. Sorry :(");
|
|
124
|
+
default:
|
|
125
|
+
console.log("_renderValue kind =", kind, value);
|
|
127
126
|
}
|
|
128
127
|
return escapeHtml(String(value));
|
|
129
128
|
}
|
|
@@ -158,7 +157,7 @@ async function* renderStream(tmpl) {
|
|
|
158
157
|
const content = _renderValue(nextContent.value, {
|
|
159
158
|
asyncContent
|
|
160
159
|
});
|
|
161
|
-
const script = html`<template id="${id}_content">${html.raw(content)}
|
|
160
|
+
const script = html`<template id="${id}_content">${html.raw(content)}<!--end--></template>`;
|
|
162
161
|
yield render(script);
|
|
163
162
|
}
|
|
164
163
|
}
|
|
@@ -191,7 +190,7 @@ function isGenerator(obj) {
|
|
|
191
190
|
return obj && typeof obj.next == "function" && typeof obj.throw == "function";
|
|
192
191
|
}
|
|
193
192
|
|
|
194
|
-
//
|
|
193
|
+
// node_modules/isbot/index.mjs
|
|
195
194
|
var fullPattern = " daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adscanner/|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|cookiehubscan|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab";
|
|
196
195
|
var naivePattern = /bot|crawl|http|lighthouse|scan|search|spider/i;
|
|
197
196
|
var pattern;
|
|
@@ -220,7 +219,7 @@ var IS_PROD = false;
|
|
|
220
219
|
var PWD = import.meta.dir;
|
|
221
220
|
var clientJSFiles = new Map;
|
|
222
221
|
async function buildClientJS() {
|
|
223
|
-
const sourceFile = resolve(PWD, "../", "./
|
|
222
|
+
const sourceFile = resolve(PWD, "../", "./src/clientjs/hyperspan-client.ts");
|
|
224
223
|
const output = await Bun.build({
|
|
225
224
|
entrypoints: [sourceFile],
|
|
226
225
|
outdir: `./public/_hs/js`,
|
|
@@ -252,7 +251,7 @@ async function buildClientCSS() {
|
|
|
252
251
|
}
|
|
253
252
|
}
|
|
254
253
|
|
|
255
|
-
//
|
|
254
|
+
// node_modules/hono/dist/compose.js
|
|
256
255
|
var compose = (middleware, onError, onNotFound) => {
|
|
257
256
|
return (context, next) => {
|
|
258
257
|
let index = -1;
|
|
@@ -296,7 +295,7 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
296
295
|
};
|
|
297
296
|
};
|
|
298
297
|
|
|
299
|
-
//
|
|
298
|
+
// node_modules/hono/dist/utils/body.js
|
|
300
299
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
301
300
|
const { all = false, dot = false } = options;
|
|
302
301
|
const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
|
|
@@ -360,7 +359,7 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
360
359
|
});
|
|
361
360
|
};
|
|
362
361
|
|
|
363
|
-
//
|
|
362
|
+
// node_modules/hono/dist/utils/url.js
|
|
364
363
|
var splitPath = (path) => {
|
|
365
364
|
const paths = path.split("/");
|
|
366
365
|
if (paths[0] === "") {
|
|
@@ -555,7 +554,7 @@ var getQueryParams = (url, key) => {
|
|
|
555
554
|
};
|
|
556
555
|
var decodeURIComponent_ = decodeURIComponent;
|
|
557
556
|
|
|
558
|
-
//
|
|
557
|
+
// node_modules/hono/dist/request.js
|
|
559
558
|
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
560
559
|
var HonoRequest = class {
|
|
561
560
|
raw;
|
|
@@ -663,7 +662,7 @@ var HonoRequest = class {
|
|
|
663
662
|
}
|
|
664
663
|
};
|
|
665
664
|
|
|
666
|
-
//
|
|
665
|
+
// node_modules/hono/dist/utils/html.js
|
|
667
666
|
var HtmlEscapedCallbackPhase = {
|
|
668
667
|
Stringify: 1,
|
|
669
668
|
BeforeStream: 2,
|
|
@@ -701,7 +700,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
701
700
|
}
|
|
702
701
|
};
|
|
703
702
|
|
|
704
|
-
//
|
|
703
|
+
// node_modules/hono/dist/context.js
|
|
705
704
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
706
705
|
var setHeaders = (headers, map = {}) => {
|
|
707
706
|
for (const key of Object.keys(map)) {
|
|
@@ -762,30 +761,19 @@ var Context = class {
|
|
|
762
761
|
set res(_res) {
|
|
763
762
|
this.#isFresh = false;
|
|
764
763
|
if (this.#res && _res) {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
if (k === "set-cookie") {
|
|
771
|
-
const cookies = this.#res.headers.getSetCookie();
|
|
772
|
-
_res.headers.delete("set-cookie");
|
|
773
|
-
for (const cookie of cookies) {
|
|
774
|
-
_res.headers.append("set-cookie", cookie);
|
|
775
|
-
}
|
|
776
|
-
} else {
|
|
777
|
-
_res.headers.set(k, v);
|
|
778
|
-
}
|
|
764
|
+
_res = new Response(_res.body, _res);
|
|
765
|
+
for (const [k, v] of this.#res.headers.entries()) {
|
|
766
|
+
if (k === "content-type") {
|
|
767
|
+
continue;
|
|
779
768
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
return;
|
|
769
|
+
if (k === "set-cookie") {
|
|
770
|
+
const cookies = this.#res.headers.getSetCookie();
|
|
771
|
+
_res.headers.delete("set-cookie");
|
|
772
|
+
for (const cookie of cookies) {
|
|
773
|
+
_res.headers.append("set-cookie", cookie);
|
|
774
|
+
}
|
|
787
775
|
} else {
|
|
788
|
-
|
|
776
|
+
_res.headers.set(k, v);
|
|
789
777
|
}
|
|
790
778
|
}
|
|
791
779
|
}
|
|
@@ -802,6 +790,9 @@ var Context = class {
|
|
|
802
790
|
this.#renderer = renderer;
|
|
803
791
|
};
|
|
804
792
|
header = (name, value, options) => {
|
|
793
|
+
if (this.finalized) {
|
|
794
|
+
this.#res = new Response(this.#res.body, this.#res);
|
|
795
|
+
}
|
|
805
796
|
if (value === undefined) {
|
|
806
797
|
if (this.#headers) {
|
|
807
798
|
this.#headers.delete(name);
|
|
@@ -950,7 +941,7 @@ var Context = class {
|
|
|
950
941
|
};
|
|
951
942
|
};
|
|
952
943
|
|
|
953
|
-
//
|
|
944
|
+
// node_modules/hono/dist/router.js
|
|
954
945
|
var METHOD_NAME_ALL = "ALL";
|
|
955
946
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
956
947
|
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
@@ -958,10 +949,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
958
949
|
var UnsupportedPathError = class extends Error {
|
|
959
950
|
};
|
|
960
951
|
|
|
961
|
-
//
|
|
952
|
+
// node_modules/hono/dist/utils/constants.js
|
|
962
953
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
963
954
|
|
|
964
|
-
//
|
|
955
|
+
// node_modules/hono/dist/hono-base.js
|
|
965
956
|
var notFoundHandler = (c) => {
|
|
966
957
|
return c.text("404 Not Found", 404);
|
|
967
958
|
};
|
|
@@ -1173,7 +1164,7 @@ var Hono = class {
|
|
|
1173
1164
|
};
|
|
1174
1165
|
};
|
|
1175
1166
|
|
|
1176
|
-
//
|
|
1167
|
+
// node_modules/hono/dist/router/reg-exp-router/node.js
|
|
1177
1168
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
1178
1169
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
1179
1170
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -1274,7 +1265,7 @@ var Node = class {
|
|
|
1274
1265
|
}
|
|
1275
1266
|
};
|
|
1276
1267
|
|
|
1277
|
-
//
|
|
1268
|
+
// node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
1278
1269
|
var Trie = class {
|
|
1279
1270
|
#context = { varIndex: 0 };
|
|
1280
1271
|
#root = new Node;
|
|
@@ -1330,7 +1321,7 @@ var Trie = class {
|
|
|
1330
1321
|
}
|
|
1331
1322
|
};
|
|
1332
1323
|
|
|
1333
|
-
//
|
|
1324
|
+
// node_modules/hono/dist/router/reg-exp-router/router.js
|
|
1334
1325
|
var emptyParam = [];
|
|
1335
1326
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
1336
1327
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
@@ -1512,7 +1503,7 @@ var RegExpRouter = class {
|
|
|
1512
1503
|
}
|
|
1513
1504
|
};
|
|
1514
1505
|
|
|
1515
|
-
//
|
|
1506
|
+
// node_modules/hono/dist/router/smart-router/router.js
|
|
1516
1507
|
var SmartRouter = class {
|
|
1517
1508
|
name = "SmartRouter";
|
|
1518
1509
|
#routers = [];
|
|
@@ -1567,7 +1558,7 @@ var SmartRouter = class {
|
|
|
1567
1558
|
}
|
|
1568
1559
|
};
|
|
1569
1560
|
|
|
1570
|
-
//
|
|
1561
|
+
// node_modules/hono/dist/router/trie-router/node.js
|
|
1571
1562
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
1572
1563
|
var Node2 = class {
|
|
1573
1564
|
#methods;
|
|
@@ -1723,7 +1714,7 @@ var Node2 = class {
|
|
|
1723
1714
|
}
|
|
1724
1715
|
};
|
|
1725
1716
|
|
|
1726
|
-
//
|
|
1717
|
+
// node_modules/hono/dist/router/trie-router/router.js
|
|
1727
1718
|
var TrieRouter = class {
|
|
1728
1719
|
name = "TrieRouter";
|
|
1729
1720
|
#node;
|
|
@@ -1745,7 +1736,7 @@ var TrieRouter = class {
|
|
|
1745
1736
|
}
|
|
1746
1737
|
};
|
|
1747
1738
|
|
|
1748
|
-
//
|
|
1739
|
+
// node_modules/hono/dist/hono.js
|
|
1749
1740
|
var Hono2 = class extends Hono {
|
|
1750
1741
|
constructor(options = {}) {
|
|
1751
1742
|
super(options);
|
|
@@ -1755,13 +1746,13 @@ var Hono2 = class extends Hono {
|
|
|
1755
1746
|
}
|
|
1756
1747
|
};
|
|
1757
1748
|
|
|
1758
|
-
//
|
|
1749
|
+
// node_modules/hono/dist/adapter/bun/serve-static.js
|
|
1759
1750
|
import { stat } from "node:fs/promises";
|
|
1760
1751
|
|
|
1761
|
-
//
|
|
1752
|
+
// node_modules/hono/dist/utils/compress.js
|
|
1762
1753
|
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/(?!event-stream(?:[;\s]|$))[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
1763
1754
|
|
|
1764
|
-
//
|
|
1755
|
+
// node_modules/hono/dist/utils/filepath.js
|
|
1765
1756
|
var getFilePath = (options) => {
|
|
1766
1757
|
let filename = options.filename;
|
|
1767
1758
|
const defaultDocument = options.defaultDocument || "index.html";
|
|
@@ -1793,7 +1784,7 @@ var getFilePathWithoutDefaultDocument = (options) => {
|
|
|
1793
1784
|
return path;
|
|
1794
1785
|
};
|
|
1795
1786
|
|
|
1796
|
-
//
|
|
1787
|
+
// node_modules/hono/dist/utils/mime.js
|
|
1797
1788
|
var getMimeType = (filename, mimes = baseMimes) => {
|
|
1798
1789
|
const regexp = /\.([a-zA-Z0-9]+?)$/;
|
|
1799
1790
|
const match = filename.match(regexp);
|
|
@@ -1865,7 +1856,7 @@ var _baseMimes = {
|
|
|
1865
1856
|
};
|
|
1866
1857
|
var baseMimes = _baseMimes;
|
|
1867
1858
|
|
|
1868
|
-
//
|
|
1859
|
+
// node_modules/hono/dist/middleware/serve-static/index.js
|
|
1869
1860
|
var ENCODINGS = {
|
|
1870
1861
|
br: ".br",
|
|
1871
1862
|
zstd: ".zst",
|
|
@@ -1962,7 +1953,7 @@ var serveStatic = (options) => {
|
|
|
1962
1953
|
};
|
|
1963
1954
|
};
|
|
1964
1955
|
|
|
1965
|
-
//
|
|
1956
|
+
// node_modules/hono/dist/adapter/bun/serve-static.js
|
|
1966
1957
|
var serveStatic2 = (options) => {
|
|
1967
1958
|
return async function serveStatic2(c, next) {
|
|
1968
1959
|
const getContent = async (path) => {
|
|
@@ -1990,7 +1981,7 @@ var serveStatic2 = (options) => {
|
|
|
1990
1981
|
};
|
|
1991
1982
|
};
|
|
1992
1983
|
|
|
1993
|
-
//
|
|
1984
|
+
// node_modules/hono/dist/helper/ssg/middleware.js
|
|
1994
1985
|
var X_HONO_DISABLE_SSG_HEADER_KEY = "x-hono-disable-ssg";
|
|
1995
1986
|
var SSG_DISABLED_RESPONSE = (() => {
|
|
1996
1987
|
try {
|
|
@@ -2002,10 +1993,10 @@ var SSG_DISABLED_RESPONSE = (() => {
|
|
|
2002
1993
|
return null;
|
|
2003
1994
|
}
|
|
2004
1995
|
})();
|
|
2005
|
-
//
|
|
1996
|
+
// node_modules/hono/dist/adapter/bun/ssg.js
|
|
2006
1997
|
var { write } = Bun;
|
|
2007
1998
|
|
|
2008
|
-
//
|
|
1999
|
+
// node_modules/hono/dist/helper/websocket/index.js
|
|
2009
2000
|
var WSContext = class {
|
|
2010
2001
|
#init;
|
|
2011
2002
|
constructor(init) {
|
|
@@ -2029,7 +2020,7 @@ var WSContext = class {
|
|
|
2029
2020
|
}
|
|
2030
2021
|
};
|
|
2031
2022
|
|
|
2032
|
-
//
|
|
2023
|
+
// node_modules/@zod/core/dist/esm/core.js
|
|
2033
2024
|
var $brand = Symbol("zod_brand");
|
|
2034
2025
|
|
|
2035
2026
|
class $ZodAsyncError extends Error {
|
|
@@ -2044,7 +2035,7 @@ function config(config2) {
|
|
|
2044
2035
|
return globalConfig;
|
|
2045
2036
|
}
|
|
2046
2037
|
|
|
2047
|
-
//
|
|
2038
|
+
// node_modules/@zod/core/dist/esm/util.js
|
|
2048
2039
|
function jsonStringifyReplacer(_, value) {
|
|
2049
2040
|
if (typeof value === "bigint")
|
|
2050
2041
|
return value.toString();
|
|
@@ -2097,7 +2088,7 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
2097
2088
|
return full;
|
|
2098
2089
|
}
|
|
2099
2090
|
|
|
2100
|
-
//
|
|
2091
|
+
// node_modules/@zod/core/dist/esm/errors.js
|
|
2101
2092
|
var ZOD_ERROR = Symbol.for("{{zod.error}}");
|
|
2102
2093
|
|
|
2103
2094
|
class $ZodError {
|
|
@@ -2163,7 +2154,7 @@ function formatError(error, _mapper) {
|
|
|
2163
2154
|
return fieldErrors;
|
|
2164
2155
|
}
|
|
2165
2156
|
|
|
2166
|
-
//
|
|
2157
|
+
// node_modules/@zod/core/dist/esm/parse.js
|
|
2167
2158
|
function _parse(schema, value, _ctx) {
|
|
2168
2159
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
2169
2160
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -2176,7 +2167,7 @@ function _parse(schema, value, _ctx) {
|
|
|
2176
2167
|
return result.value;
|
|
2177
2168
|
}
|
|
2178
2169
|
|
|
2179
|
-
//
|
|
2170
|
+
// node_modules/zod/dist/esm/errors.js
|
|
2180
2171
|
class ZodError extends $ZodError {
|
|
2181
2172
|
format(mapper) {
|
|
2182
2173
|
return formatError(this, mapper);
|
|
@@ -2195,7 +2186,7 @@ class ZodError extends $ZodError {
|
|
|
2195
2186
|
}
|
|
2196
2187
|
}
|
|
2197
2188
|
|
|
2198
|
-
//
|
|
2189
|
+
// node_modules/zod/dist/esm/parse.js
|
|
2199
2190
|
var parse = /* @__PURE__ */ _parse.bind({ Error: ZodError });
|
|
2200
2191
|
|
|
2201
2192
|
// src/server.ts
|
|
@@ -2313,7 +2304,8 @@ async function runFileRoute(RouteModule, context) {
|
|
|
2313
2304
|
if (routeContent instanceof Response) {
|
|
2314
2305
|
return routeContent;
|
|
2315
2306
|
}
|
|
2316
|
-
|
|
2307
|
+
let routeKind = typeof routeContent;
|
|
2308
|
+
if (routeKind === "object" && (routeContent instanceof TmplHtml || routeContent.constructor.name === "TmplHtml" || routeContent?._kind === "TmplHtml")) {
|
|
2317
2309
|
if (streamingEnabled) {
|
|
2318
2310
|
return new StreamResponse(renderStream(routeContent));
|
|
2319
2311
|
} else {
|
|
@@ -2321,6 +2313,7 @@ async function runFileRoute(RouteModule, context) {
|
|
|
2321
2313
|
return context.html(output);
|
|
2322
2314
|
}
|
|
2323
2315
|
}
|
|
2316
|
+
console.log("Returning unknown type... ", routeContent);
|
|
2324
2317
|
return routeContent;
|
|
2325
2318
|
} catch (e) {
|
|
2326
2319
|
console.error(e);
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
import { TmplHtml } from '@hyperspan/html';
|
|
4
3
|
import { Context, Handler, Hono } from 'hono';
|
|
5
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
|
+
}
|
|
6
17
|
export declare const IS_PROD: boolean;
|
|
7
18
|
/**
|
|
8
19
|
* Route
|
package/dist/server.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { readdir as readdir2 } from "node:fs/promises";
|
|
3
3
|
import { basename, extname, join } from "node:path";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// ../html/dist/html.js
|
|
6
6
|
/*!
|
|
7
7
|
* escape-html
|
|
8
8
|
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
@@ -51,6 +51,7 @@ function escapeHtml(string) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
class TmplHtml {
|
|
54
|
+
_kind = "hstmpl";
|
|
54
55
|
content = "";
|
|
55
56
|
asyncContent;
|
|
56
57
|
constructor(props) {
|
|
@@ -63,15 +64,9 @@ function html(strings, ...values) {
|
|
|
63
64
|
const asyncContent = [];
|
|
64
65
|
let content = "";
|
|
65
66
|
for (let i = 0;i < strings.length; i++) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
let id = `async_loading_${htmlId++}`;
|
|
70
|
-
let kind = _typeOf(value);
|
|
71
|
-
if (!renderValue) {
|
|
72
|
-
renderValue = _renderValue(value, { id, kind, asyncContent }) || "";
|
|
73
|
-
}
|
|
74
|
-
}
|
|
67
|
+
const value = values[i];
|
|
68
|
+
const kind = _typeOf(value);
|
|
69
|
+
const renderValue = _renderValue(value, { kind, asyncContent }) || "";
|
|
75
70
|
content += strings[i] + (renderValue ? renderValue : "");
|
|
76
71
|
}
|
|
77
72
|
return new TmplHtml({ content, asyncContent });
|
|
@@ -86,12 +81,13 @@ function _renderValue(value, opts = {
|
|
|
86
81
|
return "";
|
|
87
82
|
}
|
|
88
83
|
const kind = opts.kind || _typeOf(value);
|
|
89
|
-
|
|
84
|
+
let id = opts.id;
|
|
90
85
|
switch (kind) {
|
|
91
86
|
case "array":
|
|
92
87
|
return value.map((v) => _renderValue(v, { id, asyncContent: opts.asyncContent })).join("");
|
|
93
88
|
case "object":
|
|
94
|
-
|
|
89
|
+
id = `async_loading_${htmlId++}`;
|
|
90
|
+
if (value instanceof TmplHtml || value.constructor.name === "TmplHtml" || value?._kind === "hstmpl") {
|
|
95
91
|
opts.asyncContent.push(...value.asyncContent);
|
|
96
92
|
return value.content;
|
|
97
93
|
}
|
|
@@ -113,6 +109,7 @@ function _renderValue(value, opts = {
|
|
|
113
109
|
}
|
|
114
110
|
return JSON.stringify(value);
|
|
115
111
|
case "promise":
|
|
112
|
+
id = `async_loading_${htmlId++}`;
|
|
116
113
|
opts.asyncContent.push({
|
|
117
114
|
id,
|
|
118
115
|
promise: value.then((result) => ({
|
|
@@ -124,6 +121,8 @@ function _renderValue(value, opts = {
|
|
|
124
121
|
return render(_htmlPlaceholder(id));
|
|
125
122
|
case "generator":
|
|
126
123
|
throw new Error("Generators are not supported as a template value at this time. Sorry :(");
|
|
124
|
+
default:
|
|
125
|
+
console.log("_renderValue kind =", kind, value);
|
|
127
126
|
}
|
|
128
127
|
return escapeHtml(String(value));
|
|
129
128
|
}
|
|
@@ -158,7 +157,7 @@ async function* renderStream(tmpl) {
|
|
|
158
157
|
const content = _renderValue(nextContent.value, {
|
|
159
158
|
asyncContent
|
|
160
159
|
});
|
|
161
|
-
const script = html`<template id="${id}_content">${html.raw(content)}
|
|
160
|
+
const script = html`<template id="${id}_content">${html.raw(content)}<!--end--></template>`;
|
|
162
161
|
yield render(script);
|
|
163
162
|
}
|
|
164
163
|
}
|
|
@@ -191,7 +190,7 @@ function isGenerator(obj) {
|
|
|
191
190
|
return obj && typeof obj.next == "function" && typeof obj.throw == "function";
|
|
192
191
|
}
|
|
193
192
|
|
|
194
|
-
//
|
|
193
|
+
// node_modules/isbot/index.mjs
|
|
195
194
|
var fullPattern = " daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adscanner/|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|cookiehubscan|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab";
|
|
196
195
|
var naivePattern = /bot|crawl|http|lighthouse|scan|search|spider/i;
|
|
197
196
|
var pattern;
|
|
@@ -220,7 +219,7 @@ var IS_PROD = false;
|
|
|
220
219
|
var PWD = import.meta.dir;
|
|
221
220
|
var clientJSFiles = new Map;
|
|
222
221
|
async function buildClientJS() {
|
|
223
|
-
const sourceFile = resolve(PWD, "../", "./
|
|
222
|
+
const sourceFile = resolve(PWD, "../", "./src/clientjs/hyperspan-client.ts");
|
|
224
223
|
const output = await Bun.build({
|
|
225
224
|
entrypoints: [sourceFile],
|
|
226
225
|
outdir: `./public/_hs/js`,
|
|
@@ -252,7 +251,7 @@ async function buildClientCSS() {
|
|
|
252
251
|
}
|
|
253
252
|
}
|
|
254
253
|
|
|
255
|
-
//
|
|
254
|
+
// node_modules/hono/dist/compose.js
|
|
256
255
|
var compose = (middleware, onError, onNotFound) => {
|
|
257
256
|
return (context, next) => {
|
|
258
257
|
let index = -1;
|
|
@@ -296,7 +295,7 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
296
295
|
};
|
|
297
296
|
};
|
|
298
297
|
|
|
299
|
-
//
|
|
298
|
+
// node_modules/hono/dist/utils/body.js
|
|
300
299
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
301
300
|
const { all = false, dot = false } = options;
|
|
302
301
|
const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
|
|
@@ -360,7 +359,7 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
360
359
|
});
|
|
361
360
|
};
|
|
362
361
|
|
|
363
|
-
//
|
|
362
|
+
// node_modules/hono/dist/utils/url.js
|
|
364
363
|
var splitPath = (path) => {
|
|
365
364
|
const paths = path.split("/");
|
|
366
365
|
if (paths[0] === "") {
|
|
@@ -555,7 +554,7 @@ var getQueryParams = (url, key) => {
|
|
|
555
554
|
};
|
|
556
555
|
var decodeURIComponent_ = decodeURIComponent;
|
|
557
556
|
|
|
558
|
-
//
|
|
557
|
+
// node_modules/hono/dist/request.js
|
|
559
558
|
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
560
559
|
var HonoRequest = class {
|
|
561
560
|
raw;
|
|
@@ -663,7 +662,7 @@ var HonoRequest = class {
|
|
|
663
662
|
}
|
|
664
663
|
};
|
|
665
664
|
|
|
666
|
-
//
|
|
665
|
+
// node_modules/hono/dist/utils/html.js
|
|
667
666
|
var HtmlEscapedCallbackPhase = {
|
|
668
667
|
Stringify: 1,
|
|
669
668
|
BeforeStream: 2,
|
|
@@ -701,7 +700,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
701
700
|
}
|
|
702
701
|
};
|
|
703
702
|
|
|
704
|
-
//
|
|
703
|
+
// node_modules/hono/dist/context.js
|
|
705
704
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
706
705
|
var setHeaders = (headers, map = {}) => {
|
|
707
706
|
for (const key of Object.keys(map)) {
|
|
@@ -762,30 +761,19 @@ var Context = class {
|
|
|
762
761
|
set res(_res) {
|
|
763
762
|
this.#isFresh = false;
|
|
764
763
|
if (this.#res && _res) {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
if (k === "set-cookie") {
|
|
771
|
-
const cookies = this.#res.headers.getSetCookie();
|
|
772
|
-
_res.headers.delete("set-cookie");
|
|
773
|
-
for (const cookie of cookies) {
|
|
774
|
-
_res.headers.append("set-cookie", cookie);
|
|
775
|
-
}
|
|
776
|
-
} else {
|
|
777
|
-
_res.headers.set(k, v);
|
|
778
|
-
}
|
|
764
|
+
_res = new Response(_res.body, _res);
|
|
765
|
+
for (const [k, v] of this.#res.headers.entries()) {
|
|
766
|
+
if (k === "content-type") {
|
|
767
|
+
continue;
|
|
779
768
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
return;
|
|
769
|
+
if (k === "set-cookie") {
|
|
770
|
+
const cookies = this.#res.headers.getSetCookie();
|
|
771
|
+
_res.headers.delete("set-cookie");
|
|
772
|
+
for (const cookie of cookies) {
|
|
773
|
+
_res.headers.append("set-cookie", cookie);
|
|
774
|
+
}
|
|
787
775
|
} else {
|
|
788
|
-
|
|
776
|
+
_res.headers.set(k, v);
|
|
789
777
|
}
|
|
790
778
|
}
|
|
791
779
|
}
|
|
@@ -802,6 +790,9 @@ var Context = class {
|
|
|
802
790
|
this.#renderer = renderer;
|
|
803
791
|
};
|
|
804
792
|
header = (name, value, options) => {
|
|
793
|
+
if (this.finalized) {
|
|
794
|
+
this.#res = new Response(this.#res.body, this.#res);
|
|
795
|
+
}
|
|
805
796
|
if (value === undefined) {
|
|
806
797
|
if (this.#headers) {
|
|
807
798
|
this.#headers.delete(name);
|
|
@@ -950,7 +941,7 @@ var Context = class {
|
|
|
950
941
|
};
|
|
951
942
|
};
|
|
952
943
|
|
|
953
|
-
//
|
|
944
|
+
// node_modules/hono/dist/router.js
|
|
954
945
|
var METHOD_NAME_ALL = "ALL";
|
|
955
946
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
956
947
|
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
@@ -958,10 +949,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
958
949
|
var UnsupportedPathError = class extends Error {
|
|
959
950
|
};
|
|
960
951
|
|
|
961
|
-
//
|
|
952
|
+
// node_modules/hono/dist/utils/constants.js
|
|
962
953
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
963
954
|
|
|
964
|
-
//
|
|
955
|
+
// node_modules/hono/dist/hono-base.js
|
|
965
956
|
var notFoundHandler = (c) => {
|
|
966
957
|
return c.text("404 Not Found", 404);
|
|
967
958
|
};
|
|
@@ -1173,7 +1164,7 @@ var Hono = class {
|
|
|
1173
1164
|
};
|
|
1174
1165
|
};
|
|
1175
1166
|
|
|
1176
|
-
//
|
|
1167
|
+
// node_modules/hono/dist/router/reg-exp-router/node.js
|
|
1177
1168
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
1178
1169
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
1179
1170
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -1274,7 +1265,7 @@ var Node = class {
|
|
|
1274
1265
|
}
|
|
1275
1266
|
};
|
|
1276
1267
|
|
|
1277
|
-
//
|
|
1268
|
+
// node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
1278
1269
|
var Trie = class {
|
|
1279
1270
|
#context = { varIndex: 0 };
|
|
1280
1271
|
#root = new Node;
|
|
@@ -1330,7 +1321,7 @@ var Trie = class {
|
|
|
1330
1321
|
}
|
|
1331
1322
|
};
|
|
1332
1323
|
|
|
1333
|
-
//
|
|
1324
|
+
// node_modules/hono/dist/router/reg-exp-router/router.js
|
|
1334
1325
|
var emptyParam = [];
|
|
1335
1326
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
1336
1327
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
@@ -1512,7 +1503,7 @@ var RegExpRouter = class {
|
|
|
1512
1503
|
}
|
|
1513
1504
|
};
|
|
1514
1505
|
|
|
1515
|
-
//
|
|
1506
|
+
// node_modules/hono/dist/router/smart-router/router.js
|
|
1516
1507
|
var SmartRouter = class {
|
|
1517
1508
|
name = "SmartRouter";
|
|
1518
1509
|
#routers = [];
|
|
@@ -1567,7 +1558,7 @@ var SmartRouter = class {
|
|
|
1567
1558
|
}
|
|
1568
1559
|
};
|
|
1569
1560
|
|
|
1570
|
-
//
|
|
1561
|
+
// node_modules/hono/dist/router/trie-router/node.js
|
|
1571
1562
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
1572
1563
|
var Node2 = class {
|
|
1573
1564
|
#methods;
|
|
@@ -1723,7 +1714,7 @@ var Node2 = class {
|
|
|
1723
1714
|
}
|
|
1724
1715
|
};
|
|
1725
1716
|
|
|
1726
|
-
//
|
|
1717
|
+
// node_modules/hono/dist/router/trie-router/router.js
|
|
1727
1718
|
var TrieRouter = class {
|
|
1728
1719
|
name = "TrieRouter";
|
|
1729
1720
|
#node;
|
|
@@ -1745,7 +1736,7 @@ var TrieRouter = class {
|
|
|
1745
1736
|
}
|
|
1746
1737
|
};
|
|
1747
1738
|
|
|
1748
|
-
//
|
|
1739
|
+
// node_modules/hono/dist/hono.js
|
|
1749
1740
|
var Hono2 = class extends Hono {
|
|
1750
1741
|
constructor(options = {}) {
|
|
1751
1742
|
super(options);
|
|
@@ -1755,13 +1746,13 @@ var Hono2 = class extends Hono {
|
|
|
1755
1746
|
}
|
|
1756
1747
|
};
|
|
1757
1748
|
|
|
1758
|
-
//
|
|
1749
|
+
// node_modules/hono/dist/adapter/bun/serve-static.js
|
|
1759
1750
|
import { stat } from "node:fs/promises";
|
|
1760
1751
|
|
|
1761
|
-
//
|
|
1752
|
+
// node_modules/hono/dist/utils/compress.js
|
|
1762
1753
|
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/(?!event-stream(?:[;\s]|$))[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
1763
1754
|
|
|
1764
|
-
//
|
|
1755
|
+
// node_modules/hono/dist/utils/filepath.js
|
|
1765
1756
|
var getFilePath = (options) => {
|
|
1766
1757
|
let filename = options.filename;
|
|
1767
1758
|
const defaultDocument = options.defaultDocument || "index.html";
|
|
@@ -1793,7 +1784,7 @@ var getFilePathWithoutDefaultDocument = (options) => {
|
|
|
1793
1784
|
return path;
|
|
1794
1785
|
};
|
|
1795
1786
|
|
|
1796
|
-
//
|
|
1787
|
+
// node_modules/hono/dist/utils/mime.js
|
|
1797
1788
|
var getMimeType = (filename, mimes = baseMimes) => {
|
|
1798
1789
|
const regexp = /\.([a-zA-Z0-9]+?)$/;
|
|
1799
1790
|
const match = filename.match(regexp);
|
|
@@ -1865,7 +1856,7 @@ var _baseMimes = {
|
|
|
1865
1856
|
};
|
|
1866
1857
|
var baseMimes = _baseMimes;
|
|
1867
1858
|
|
|
1868
|
-
//
|
|
1859
|
+
// node_modules/hono/dist/middleware/serve-static/index.js
|
|
1869
1860
|
var ENCODINGS = {
|
|
1870
1861
|
br: ".br",
|
|
1871
1862
|
zstd: ".zst",
|
|
@@ -1962,7 +1953,7 @@ var serveStatic = (options) => {
|
|
|
1962
1953
|
};
|
|
1963
1954
|
};
|
|
1964
1955
|
|
|
1965
|
-
//
|
|
1956
|
+
// node_modules/hono/dist/adapter/bun/serve-static.js
|
|
1966
1957
|
var serveStatic2 = (options) => {
|
|
1967
1958
|
return async function serveStatic2(c, next) {
|
|
1968
1959
|
const getContent = async (path) => {
|
|
@@ -1990,7 +1981,7 @@ var serveStatic2 = (options) => {
|
|
|
1990
1981
|
};
|
|
1991
1982
|
};
|
|
1992
1983
|
|
|
1993
|
-
//
|
|
1984
|
+
// node_modules/hono/dist/helper/ssg/middleware.js
|
|
1994
1985
|
var X_HONO_DISABLE_SSG_HEADER_KEY = "x-hono-disable-ssg";
|
|
1995
1986
|
var SSG_DISABLED_RESPONSE = (() => {
|
|
1996
1987
|
try {
|
|
@@ -2002,10 +1993,10 @@ var SSG_DISABLED_RESPONSE = (() => {
|
|
|
2002
1993
|
return null;
|
|
2003
1994
|
}
|
|
2004
1995
|
})();
|
|
2005
|
-
//
|
|
1996
|
+
// node_modules/hono/dist/adapter/bun/ssg.js
|
|
2006
1997
|
var { write } = Bun;
|
|
2007
1998
|
|
|
2008
|
-
//
|
|
1999
|
+
// node_modules/hono/dist/helper/websocket/index.js
|
|
2009
2000
|
var WSContext = class {
|
|
2010
2001
|
#init;
|
|
2011
2002
|
constructor(init) {
|
|
@@ -2029,7 +2020,7 @@ var WSContext = class {
|
|
|
2029
2020
|
}
|
|
2030
2021
|
};
|
|
2031
2022
|
|
|
2032
|
-
//
|
|
2023
|
+
// node_modules/@zod/core/dist/esm/core.js
|
|
2033
2024
|
var $brand = Symbol("zod_brand");
|
|
2034
2025
|
|
|
2035
2026
|
class $ZodAsyncError extends Error {
|
|
@@ -2044,7 +2035,7 @@ function config(config2) {
|
|
|
2044
2035
|
return globalConfig;
|
|
2045
2036
|
}
|
|
2046
2037
|
|
|
2047
|
-
//
|
|
2038
|
+
// node_modules/@zod/core/dist/esm/util.js
|
|
2048
2039
|
function jsonStringifyReplacer(_, value) {
|
|
2049
2040
|
if (typeof value === "bigint")
|
|
2050
2041
|
return value.toString();
|
|
@@ -2097,7 +2088,7 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
2097
2088
|
return full;
|
|
2098
2089
|
}
|
|
2099
2090
|
|
|
2100
|
-
//
|
|
2091
|
+
// node_modules/@zod/core/dist/esm/errors.js
|
|
2101
2092
|
var ZOD_ERROR = Symbol.for("{{zod.error}}");
|
|
2102
2093
|
|
|
2103
2094
|
class $ZodError {
|
|
@@ -2163,7 +2154,7 @@ function formatError(error, _mapper) {
|
|
|
2163
2154
|
return fieldErrors;
|
|
2164
2155
|
}
|
|
2165
2156
|
|
|
2166
|
-
//
|
|
2157
|
+
// node_modules/@zod/core/dist/esm/parse.js
|
|
2167
2158
|
function _parse(schema, value, _ctx) {
|
|
2168
2159
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
2169
2160
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -2176,7 +2167,7 @@ function _parse(schema, value, _ctx) {
|
|
|
2176
2167
|
return result.value;
|
|
2177
2168
|
}
|
|
2178
2169
|
|
|
2179
|
-
//
|
|
2170
|
+
// node_modules/zod/dist/esm/errors.js
|
|
2180
2171
|
class ZodError extends $ZodError {
|
|
2181
2172
|
format(mapper) {
|
|
2182
2173
|
return formatError(this, mapper);
|
|
@@ -2195,7 +2186,7 @@ class ZodError extends $ZodError {
|
|
|
2195
2186
|
}
|
|
2196
2187
|
}
|
|
2197
2188
|
|
|
2198
|
-
//
|
|
2189
|
+
// node_modules/zod/dist/esm/parse.js
|
|
2199
2190
|
var parse = /* @__PURE__ */ _parse.bind({ Error: ZodError });
|
|
2200
2191
|
|
|
2201
2192
|
// src/server.ts
|
|
@@ -2313,7 +2304,8 @@ async function runFileRoute(RouteModule, context) {
|
|
|
2313
2304
|
if (routeContent instanceof Response) {
|
|
2314
2305
|
return routeContent;
|
|
2315
2306
|
}
|
|
2316
|
-
|
|
2307
|
+
let routeKind = typeof routeContent;
|
|
2308
|
+
if (routeKind === "object" && (routeContent instanceof TmplHtml || routeContent.constructor.name === "TmplHtml" || routeContent?._kind === "TmplHtml")) {
|
|
2317
2309
|
if (streamingEnabled) {
|
|
2318
2310
|
return new StreamResponse(renderStream(routeContent));
|
|
2319
2311
|
} else {
|
|
@@ -2321,6 +2313,7 @@ async function runFileRoute(RouteModule, context) {
|
|
|
2321
2313
|
return context.html(output);
|
|
2322
2314
|
}
|
|
2323
2315
|
}
|
|
2316
|
+
console.log("Returning unknown type... ", routeContent);
|
|
2324
2317
|
return routeContent;
|
|
2325
2318
|
} catch (e) {
|
|
2326
2319
|
console.error(e);
|
package/package.json
CHANGED
package/src/assets.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import {html} from '@hyperspan/html';
|
|
2
|
+
import {md5} from './clientjs/md5';
|
|
3
|
+
import {readdir} from 'node:fs/promises';
|
|
4
|
+
import {resolve} from 'node:path';
|
|
5
5
|
|
|
6
6
|
const IS_PROD = process.env.NODE_ENV === 'production';
|
|
7
7
|
const PWD = import.meta.dir;
|
|
@@ -9,9 +9,9 @@ const PWD = import.meta.dir;
|
|
|
9
9
|
/**
|
|
10
10
|
* Build client JS for end users (minimal JS for Hyperspan to work)
|
|
11
11
|
*/
|
|
12
|
-
export const clientJSFiles = new Map<string, {
|
|
12
|
+
export const clientJSFiles = new Map<string, {src: string; type?: string}>();
|
|
13
13
|
export async function buildClientJS() {
|
|
14
|
-
const sourceFile = resolve(PWD, '../', './
|
|
14
|
+
const sourceFile = resolve(PWD, '../', './src/clientjs/hyperspan-client.ts');
|
|
15
15
|
const output = await Bun.build({
|
|
16
16
|
entrypoints: [sourceFile],
|
|
17
17
|
outdir: `./public/_hs/js`,
|
|
@@ -20,7 +20,7 @@ export async function buildClientJS() {
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const jsFile = output.outputs[0].path.split('/').reverse()[0];
|
|
23
|
-
clientJSFiles.set('_hs', {
|
|
23
|
+
clientJSFiles.set('_hs', {src: '/_hs/js/' + jsFile});
|
|
24
24
|
return jsFile;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -61,7 +61,7 @@ export async function buildClientCSS() {
|
|
|
61
61
|
export function hyperspanStyleTags() {
|
|
62
62
|
const cssFiles = Array.from(clientCSSFiles.entries());
|
|
63
63
|
return html`${cssFiles.map(
|
|
64
|
-
([
|
|
64
|
+
([_, file]) => html`<link rel="stylesheet" href="/_hs/css/${file}" />`
|
|
65
65
|
)}`;
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -84,13 +84,13 @@ export function hyperspanScriptTags() {
|
|
|
84
84
|
}
|
|
85
85
|
</script>
|
|
86
86
|
${jsFiles.map(
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
([key, file]) =>
|
|
88
|
+
html`<script
|
|
89
89
|
id="js-${key}"
|
|
90
90
|
type="${file.type || 'text/javascript'}"
|
|
91
91
|
src="${file.src}"
|
|
92
92
|
></script>`
|
|
93
|
-
|
|
93
|
+
)}
|
|
94
94
|
`;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {html} from '@hyperspan/html';
|
|
2
|
+
import {Idiomorph} from './idiomorph.esm';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Used for streaming content from the server to the client.
|
|
@@ -20,7 +20,7 @@ function htmlAsyncContentObserver() {
|
|
|
20
20
|
asyncContent.forEach((el: any) => {
|
|
21
21
|
try {
|
|
22
22
|
// Also observe child nodes for nested async content
|
|
23
|
-
asyncContentObserver.observe(el.content, {
|
|
23
|
+
asyncContentObserver.observe(el.content, {childList: true, subtree: true});
|
|
24
24
|
|
|
25
25
|
const slotId = el.id.replace('_content', '');
|
|
26
26
|
const slotEl = document.getElementById(slotId);
|
|
@@ -41,7 +41,7 @@ function htmlAsyncContentObserver() {
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
asyncContentObserver.observe(document.body, {
|
|
44
|
+
asyncContentObserver.observe(document.body, {childList: true, subtree: true});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
htmlAsyncContentObserver();
|
package/src/server.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {readdir} from 'node:fs/promises';
|
|
2
|
-
import {basename, extname, join} from 'node:path';
|
|
3
|
-
import {TmplHtml, html, renderStream, renderAsync, render} from '@hyperspan/html';
|
|
4
|
-
import {isbot} from 'isbot';
|
|
5
|
-
import {buildClientJS, buildClientCSS} from './assets';
|
|
6
|
-
import {Hono} from 'hono';
|
|
7
|
-
import {serveStatic} from 'hono/bun';
|
|
1
|
+
import { readdir } from 'node:fs/promises';
|
|
2
|
+
import { basename, extname, join } from 'node:path';
|
|
3
|
+
import { TmplHtml, html, renderStream, renderAsync, render } from '@hyperspan/html';
|
|
4
|
+
import { isbot } from 'isbot';
|
|
5
|
+
import { buildClientJS, buildClientCSS } from './assets';
|
|
6
|
+
import { Hono } from 'hono';
|
|
7
|
+
import { serveStatic } from 'hono/bun';
|
|
8
8
|
import * as z from 'zod';
|
|
9
|
-
import type {Context, Handler} from 'hono';
|
|
9
|
+
import type { Context, Handler } from 'hono';
|
|
10
10
|
|
|
11
11
|
export const IS_PROD = process.env.NODE_ENV === 'production';
|
|
12
12
|
const CWD = process.cwd();
|
|
@@ -193,7 +193,7 @@ export async function runFileRoute(RouteModule: any, context: Context): Promise<
|
|
|
193
193
|
if (!routeMethodHandler) {
|
|
194
194
|
return new Response('Method Not Allowed', {
|
|
195
195
|
status: 405,
|
|
196
|
-
headers: {'content-type': 'text/plain'},
|
|
196
|
+
headers: { 'content-type': 'text/plain' },
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -206,8 +206,15 @@ export async function runFileRoute(RouteModule: any, context: Context): Promise<
|
|
|
206
206
|
return routeContent;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
let routeKind = typeof routeContent;
|
|
210
|
+
|
|
209
211
|
// Render TmplHtml if returned from route handler
|
|
210
|
-
if (
|
|
212
|
+
if (
|
|
213
|
+
routeKind === 'object' &&
|
|
214
|
+
(routeContent instanceof TmplHtml ||
|
|
215
|
+
routeContent.constructor.name === 'TmplHtml' ||
|
|
216
|
+
routeContent?._kind === 'TmplHtml')
|
|
217
|
+
) {
|
|
211
218
|
if (streamingEnabled) {
|
|
212
219
|
return new StreamResponse(renderStream(routeContent)) as Response;
|
|
213
220
|
} else {
|
|
@@ -216,6 +223,8 @@ export async function runFileRoute(RouteModule: any, context: Context): Promise<
|
|
|
216
223
|
}
|
|
217
224
|
}
|
|
218
225
|
|
|
226
|
+
console.log('Returning unknown type... ', routeContent);
|
|
227
|
+
|
|
219
228
|
return routeContent;
|
|
220
229
|
} catch (e) {
|
|
221
230
|
console.error(e);
|
|
@@ -235,13 +244,13 @@ async function runAPIRoute(routeFn: any, context: Context, middlewareResult?: an
|
|
|
235
244
|
|
|
236
245
|
return context.json(
|
|
237
246
|
{
|
|
238
|
-
meta: {success: false},
|
|
247
|
+
meta: { success: false },
|
|
239
248
|
data: {
|
|
240
249
|
message: e.message,
|
|
241
250
|
stack: IS_PROD ? undefined : e.stack?.split('\n'),
|
|
242
251
|
},
|
|
243
252
|
},
|
|
244
|
-
{status: 500}
|
|
253
|
+
{ status: 500 }
|
|
245
254
|
);
|
|
246
255
|
}
|
|
247
256
|
}
|
|
@@ -267,7 +276,7 @@ async function showErrorReponse(context: Context, err: Error) {
|
|
|
267
276
|
export type THSServerConfig = {
|
|
268
277
|
appDir: string;
|
|
269
278
|
staticFileRoot: string;
|
|
270
|
-
rewrites?: Array<{source: string; destination: string}>;
|
|
279
|
+
rewrites?: Array<{ source: string; destination: string }>;
|
|
271
280
|
// For customizing the routes and adding your own...
|
|
272
281
|
beforeRoutesAdded?: (app: Hono) => void;
|
|
273
282
|
afterRoutesAdded?: (app: Hono) => void;
|
|
@@ -287,7 +296,7 @@ export async function buildRoutes(config: THSServerConfig): Promise<THSRouteMap[
|
|
|
287
296
|
// Walk all pages and add them as routes
|
|
288
297
|
const routesDir = join(config.appDir, 'routes');
|
|
289
298
|
console.log(routesDir);
|
|
290
|
-
const files = await readdir(routesDir, {recursive: true});
|
|
299
|
+
const files = await readdir(routesDir, { recursive: true });
|
|
291
300
|
const routes: THSRouteMap[] = [];
|
|
292
301
|
|
|
293
302
|
for (const file of files) {
|
|
@@ -353,7 +362,7 @@ export async function createServer(config: THSServerConfig): Promise<Hono> {
|
|
|
353
362
|
const fullRouteFile = join(CWD, route.file);
|
|
354
363
|
const routePattern = normalizePath(route.route);
|
|
355
364
|
|
|
356
|
-
routeMap.push({route: routePattern, file: route.file});
|
|
365
|
+
routeMap.push({ route: routePattern, file: route.file });
|
|
357
366
|
|
|
358
367
|
// Import route
|
|
359
368
|
const routeModule = await import(fullRouteFile);
|
|
@@ -373,7 +382,7 @@ export async function createServer(config: THSServerConfig): Promise<Hono> {
|
|
|
373
382
|
app.get('/', (context) => {
|
|
374
383
|
return context.text(
|
|
375
384
|
'No routes found. Add routes to app/routes. Example: `app/routes/index.ts`',
|
|
376
|
-
{status: 404}
|
|
385
|
+
{ status: 404 }
|
|
377
386
|
);
|
|
378
387
|
});
|
|
379
388
|
}
|
|
@@ -396,7 +405,7 @@ export async function createServer(config: THSServerConfig): Promise<Hono> {
|
|
|
396
405
|
);
|
|
397
406
|
|
|
398
407
|
app.notFound((context) => {
|
|
399
|
-
return context.text('Not... found?', {status: 404});
|
|
408
|
+
return context.text('Not... found?', { status: 404 });
|
|
400
409
|
});
|
|
401
410
|
|
|
402
411
|
return app;
|
|
@@ -431,7 +440,7 @@ export function createReadableStreamFromAsyncGenerator(output: AsyncGenerator) {
|
|
|
431
440
|
return new ReadableStream({
|
|
432
441
|
async start(controller) {
|
|
433
442
|
while (true) {
|
|
434
|
-
const {done, value} = await output.next();
|
|
443
|
+
const { done, value } = await output.next();
|
|
435
444
|
|
|
436
445
|
if (done) {
|
|
437
446
|
controller.close();
|