hono 3.1.6 → 3.1.8
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/adapter.js +3 -17
- package/dist/cjs/adapter.js +3 -9
- package/dist/cjs/context.js +2 -9
- package/dist/cjs/request.js +1 -1
- package/dist/context.js +2 -17
- package/dist/request.js +1 -1
- package/package.json +1 -1
package/dist/adapter.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
1
|
// src/adapter.ts
|
|
10
2
|
var env = (c) => {
|
|
11
3
|
const global = globalThis;
|
|
@@ -15,18 +7,12 @@ var env = (c) => {
|
|
|
15
7
|
if (c.runtime === "deno") {
|
|
16
8
|
return Deno.env.toObject();
|
|
17
9
|
}
|
|
18
|
-
if (c.runtime === "fastly") {
|
|
19
|
-
let env2 = {};
|
|
20
|
-
try {
|
|
21
|
-
const data = __require("fastly:env");
|
|
22
|
-
env2 = data.env;
|
|
23
|
-
} catch {
|
|
24
|
-
}
|
|
25
|
-
return env2;
|
|
26
|
-
}
|
|
27
10
|
if (c.runtime === "workerd") {
|
|
28
11
|
return c.env;
|
|
29
12
|
}
|
|
13
|
+
if (c.runtime === "fastly") {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
30
16
|
return {};
|
|
31
17
|
};
|
|
32
18
|
export {
|
package/dist/cjs/adapter.js
CHANGED
|
@@ -29,18 +29,12 @@ const env = (c) => {
|
|
|
29
29
|
if (c.runtime === "deno") {
|
|
30
30
|
return Deno.env.toObject();
|
|
31
31
|
}
|
|
32
|
-
if (c.runtime === "fastly") {
|
|
33
|
-
let env2 = {};
|
|
34
|
-
try {
|
|
35
|
-
const data = require("fastly:env");
|
|
36
|
-
env2 = data.env;
|
|
37
|
-
} catch {
|
|
38
|
-
}
|
|
39
|
-
return env2;
|
|
40
|
-
}
|
|
41
32
|
if (c.runtime === "workerd") {
|
|
42
33
|
return c.env;
|
|
43
34
|
}
|
|
35
|
+
if (c.runtime === "fastly") {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
44
38
|
return {};
|
|
45
39
|
};
|
|
46
40
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/cjs/context.js
CHANGED
|
@@ -127,7 +127,7 @@ class Context {
|
|
|
127
127
|
this._preparedHeaders = {};
|
|
128
128
|
}
|
|
129
129
|
if (this._preparedHeaders["content-type"]) {
|
|
130
|
-
this._preparedHeaders["content-type"] = "text/plain; charset=
|
|
130
|
+
this._preparedHeaders["content-type"] = "text/plain; charset=UTF-8";
|
|
131
131
|
}
|
|
132
132
|
return typeof arg === "number" ? this.newResponse(text, arg, headers) : this.newResponse(text, arg);
|
|
133
133
|
};
|
|
@@ -223,14 +223,7 @@ class Context {
|
|
|
223
223
|
if (typeof global?.EdgeRuntime === "string") {
|
|
224
224
|
return "edge-light";
|
|
225
225
|
}
|
|
226
|
-
|
|
227
|
-
try {
|
|
228
|
-
const { env } = require("fastly:env");
|
|
229
|
-
if (env instanceof Function)
|
|
230
|
-
onFastly = true;
|
|
231
|
-
} catch {
|
|
232
|
-
}
|
|
233
|
-
if (onFastly) {
|
|
226
|
+
if (global?.fastly !== void 0) {
|
|
234
227
|
return "fastly";
|
|
235
228
|
}
|
|
236
229
|
if (global?.__lagon__ !== void 0) {
|
package/dist/cjs/request.js
CHANGED
package/dist/context.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
1
|
// src/context.ts
|
|
10
2
|
import { HonoRequest } from "./request.js";
|
|
11
3
|
import { serialize } from "./utils/cookie.js";
|
|
@@ -113,7 +105,7 @@ var Context = class {
|
|
|
113
105
|
this._preparedHeaders = {};
|
|
114
106
|
}
|
|
115
107
|
if (this._preparedHeaders["content-type"]) {
|
|
116
|
-
this._preparedHeaders["content-type"] = "text/plain; charset=
|
|
108
|
+
this._preparedHeaders["content-type"] = "text/plain; charset=UTF-8";
|
|
117
109
|
}
|
|
118
110
|
return typeof arg === "number" ? this.newResponse(text, arg, headers) : this.newResponse(text, arg);
|
|
119
111
|
};
|
|
@@ -209,14 +201,7 @@ var Context = class {
|
|
|
209
201
|
if (typeof global?.EdgeRuntime === "string") {
|
|
210
202
|
return "edge-light";
|
|
211
203
|
}
|
|
212
|
-
|
|
213
|
-
try {
|
|
214
|
-
const { env } = __require("fastly:env");
|
|
215
|
-
if (env instanceof Function)
|
|
216
|
-
onFastly = true;
|
|
217
|
-
} catch {
|
|
218
|
-
}
|
|
219
|
-
if (onFastly) {
|
|
204
|
+
if (global?.fastly !== void 0) {
|
|
220
205
|
return "fastly";
|
|
221
206
|
}
|
|
222
207
|
if (global?.__lagon__ !== void 0) {
|
package/dist/request.js
CHANGED