h3 1.5.0 → 1.6.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.
- package/README.md +26 -8
- package/dist/index.cjs +32 -11
- package/dist/index.d.ts +21 -6
- package/dist/index.mjs +29 -12
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
[](https://npmjs.com/package/h3)
|
|
3
|
-
[](https://bundlephobia.com/result?p=h3)
|
|
4
|
-
[](https://github.com/unjs/h3/actions)
|
|
5
|
-
[](https://codecov.io/gh/unjs/h3)
|
|
6
|
-
[](https://www.jsdocs.io/package/h3)
|
|
1
|
+
# H3
|
|
7
2
|
|
|
8
|
-
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![bundle][bundle-src]][bundle-href]
|
|
6
|
+
[![Codecov][codecov-src]][codecov-href]
|
|
7
|
+
[![License][license-src]][license-href]
|
|
8
|
+
[![JSDocs][jsdocs-src]][jsdocs-href]
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
H3 is a minimal h(ttp) framework built for high performance and portability.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
@@ -179,6 +179,9 @@ H3 has a concept of composable utilities that accept `event` (from `eventHandler
|
|
|
179
179
|
- `isCorsOriginAllowed(event)`
|
|
180
180
|
- `appendCorsHeaders(event, options)` (see [h3-cors](https://github.com/NozomuIkuta/h3-cors) for more detail about options)
|
|
181
181
|
- `appendCorsPreflightHeaders(event, options)` (see [h3-cors](https://github.com/NozomuIkuta/h3-cors) for more detail about options)
|
|
182
|
+
- `getRequestHost(event)`
|
|
183
|
+
- `getRequestProtocol(event)`
|
|
184
|
+
- `getRequestURL(event)`
|
|
182
185
|
|
|
183
186
|
👉 You can learn more about usage in [JSDocs Documentation](https://www.jsdocs.io/package/h3#package-functions).
|
|
184
187
|
|
|
@@ -200,3 +203,18 @@ PRs are welcome to add your packages.
|
|
|
200
203
|
## License
|
|
201
204
|
|
|
202
205
|
MIT
|
|
206
|
+
|
|
207
|
+
<!-- Badges -->
|
|
208
|
+
|
|
209
|
+
[npm-version-src]: https://img.shields.io/npm/v/h3?style=flat&colorA=18181B&colorB=F0DB4F
|
|
210
|
+
[npm-version-href]: https://npmjs.com/package/h3
|
|
211
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/h3?style=flat&colorA=18181B&colorB=F0DB4F
|
|
212
|
+
[npm-downloads-href]: https://npmjs.com/package/h3
|
|
213
|
+
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/h3/main?style=flat&colorA=18181B&colorB=F0DB4F
|
|
214
|
+
[codecov-href]: https://codecov.io/gh/unjs/h3
|
|
215
|
+
[bundle-src]: https://img.shields.io/bundlephobia/minzip/h3?style=flat&colorA=18181B&colorB=F0DB4F
|
|
216
|
+
[bundle-href]: https://bundlephobia.com/result?p=h3
|
|
217
|
+
[license-src]: https://img.shields.io/github/license/unjs/h3.svg?style=flat&colorA=18181B&colorB=F0DB4F
|
|
218
|
+
[license-href]: https://github.com/unjs/h3/blob/main/LICENSE
|
|
219
|
+
[jsdocs-src]: https://img.shields.io/badge/jsDocs.io-reference-18181B?style=flat&colorA=18181B&colorB=F0DB4F
|
|
220
|
+
[jsdocs-href]: https://www.jsdocs.io/package/h3
|
package/dist/index.cjs
CHANGED
|
@@ -185,12 +185,7 @@ function sendError(event, error, debug) {
|
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
187
|
const _code = Number.parseInt(h3Error.statusCode);
|
|
188
|
-
|
|
189
|
-
event.node.res.statusCode = _code;
|
|
190
|
-
}
|
|
191
|
-
if (h3Error.statusMessage) {
|
|
192
|
-
event.node.res.statusMessage = h3Error.statusMessage;
|
|
193
|
-
}
|
|
188
|
+
setResponseStatus(event, _code, h3Error.statusMessage);
|
|
194
189
|
event.node.res.setHeader("content-type", MIMES.json);
|
|
195
190
|
event.node.res.end(JSON.stringify(responseBody, void 0, 2));
|
|
196
191
|
}
|
|
@@ -248,6 +243,24 @@ function getRequestHeader(event, name) {
|
|
|
248
243
|
return value;
|
|
249
244
|
}
|
|
250
245
|
const getHeader = getRequestHeader;
|
|
246
|
+
function getRequestHost(event) {
|
|
247
|
+
const xForwardedHost = event.node.req.headers["x-forwarded-host"];
|
|
248
|
+
if (xForwardedHost) {
|
|
249
|
+
return xForwardedHost;
|
|
250
|
+
}
|
|
251
|
+
return event.node.req.headers.host || "localhost";
|
|
252
|
+
}
|
|
253
|
+
function getRequestProtocol(event) {
|
|
254
|
+
if (event.node.req.headers["x-forwarded-proto"] === "https") {
|
|
255
|
+
return "https";
|
|
256
|
+
}
|
|
257
|
+
return event.node.req.connection.encrypted ? "https" : "http";
|
|
258
|
+
}
|
|
259
|
+
function getRequestURL(event) {
|
|
260
|
+
const host = getRequestHost(event);
|
|
261
|
+
const protocol = getRequestProtocol(event);
|
|
262
|
+
return new URL(event.path || "/", `${protocol}://${host}`);
|
|
263
|
+
}
|
|
251
264
|
|
|
252
265
|
const RawBodySymbol = Symbol.for("h3RawBody");
|
|
253
266
|
const ParsedBodySymbol = Symbol.for("h3ParsedBody");
|
|
@@ -380,7 +393,6 @@ function deleteCookie(event, name, serializeOptions) {
|
|
|
380
393
|
maxAge: 0
|
|
381
394
|
});
|
|
382
395
|
}
|
|
383
|
-
|
|
384
396
|
function splitCookiesString(cookiesString) {
|
|
385
397
|
if (typeof cookiesString !== "string") {
|
|
386
398
|
return [];
|
|
@@ -528,8 +540,7 @@ function getProxyRequestHeaders(event) {
|
|
|
528
540
|
function fetchWithEvent(event, req, init, options) {
|
|
529
541
|
return _getFetch(options?.fetch)(req, {
|
|
530
542
|
...init,
|
|
531
|
-
|
|
532
|
-
context: init.context || event.context,
|
|
543
|
+
context: init?.context || event.context,
|
|
533
544
|
headers: {
|
|
534
545
|
...getProxyRequestHeaders(event),
|
|
535
546
|
...init?.headers
|
|
@@ -585,9 +596,15 @@ function sendNoContent(event, code = 204) {
|
|
|
585
596
|
event.node.res.end();
|
|
586
597
|
}
|
|
587
598
|
function setResponseStatus(event, code, text) {
|
|
588
|
-
|
|
599
|
+
if (code) {
|
|
600
|
+
event.node.res.statusCode = code;
|
|
601
|
+
}
|
|
589
602
|
if (text) {
|
|
590
|
-
event.node.res.statusMessage = text
|
|
603
|
+
event.node.res.statusMessage = text.replace(
|
|
604
|
+
// eslint-disable-next-line no-control-regex
|
|
605
|
+
/[^\u0009\u0020-\u007E]/g,
|
|
606
|
+
""
|
|
607
|
+
);
|
|
591
608
|
}
|
|
592
609
|
}
|
|
593
610
|
function getResponseStatus(event) {
|
|
@@ -1422,6 +1439,9 @@ exports.getProxyRequestHeaders = getProxyRequestHeaders;
|
|
|
1422
1439
|
exports.getQuery = getQuery;
|
|
1423
1440
|
exports.getRequestHeader = getRequestHeader;
|
|
1424
1441
|
exports.getRequestHeaders = getRequestHeaders;
|
|
1442
|
+
exports.getRequestHost = getRequestHost;
|
|
1443
|
+
exports.getRequestProtocol = getRequestProtocol;
|
|
1444
|
+
exports.getRequestURL = getRequestURL;
|
|
1425
1445
|
exports.getResponseHeader = getResponseHeader;
|
|
1426
1446
|
exports.getResponseHeaders = getResponseHeaders;
|
|
1427
1447
|
exports.getResponseStatus = getResponseStatus;
|
|
@@ -1458,6 +1478,7 @@ exports.setHeaders = setHeaders;
|
|
|
1458
1478
|
exports.setResponseHeader = setResponseHeader;
|
|
1459
1479
|
exports.setResponseHeaders = setResponseHeaders;
|
|
1460
1480
|
exports.setResponseStatus = setResponseStatus;
|
|
1481
|
+
exports.splitCookiesString = splitCookiesString;
|
|
1461
1482
|
exports.toEventHandler = toEventHandler;
|
|
1462
1483
|
exports.toNodeListener = toNodeListener;
|
|
1463
1484
|
exports.unsealSession = unsealSession;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface SessionConfig {
|
|
|
27
27
|
}
|
|
28
28
|
declare function useSession<T extends SessionDataT = SessionDataT>(event: H3Event, config: SessionConfig): Promise<{
|
|
29
29
|
readonly id: string | undefined;
|
|
30
|
-
readonly data:
|
|
30
|
+
readonly data: T;
|
|
31
31
|
update: (update: SessionUpdate<T>) => Promise<any>;
|
|
32
32
|
clear: () => Promise<any>;
|
|
33
33
|
}>;
|
|
@@ -36,7 +36,7 @@ type SessionUpdate<T extends SessionDataT = SessionDataT> = Partial<SessionData<
|
|
|
36
36
|
declare function updateSession<T extends SessionDataT = SessionDataT>(event: H3Event, config: SessionConfig, update?: SessionUpdate<T>): Promise<Session<T>>;
|
|
37
37
|
declare function sealSession<T extends SessionDataT = SessionDataT>(event: H3Event, config: SessionConfig): Promise<string>;
|
|
38
38
|
declare function unsealSession(_event: H3Event, config: SessionConfig, sealed: string): Promise<Partial<Session<SessionDataT>>>;
|
|
39
|
-
declare function clearSession(event: H3Event, config: SessionConfig): Promise<void>;
|
|
39
|
+
declare function clearSession(event: H3Event, config: Partial<SessionConfig>): Promise<void>;
|
|
40
40
|
|
|
41
41
|
type HTTPMethod = "GET" | "HEAD" | "PATCH" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE";
|
|
42
42
|
type Encoding = false | "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
|
|
@@ -231,7 +231,7 @@ declare function readRawBody<E extends Encoding = "utf8">(event: H3Event, encodi
|
|
|
231
231
|
* @return {*} The `Object`, `Array`, `String`, `Number`, `Boolean`, or `null` value corresponding to the request JSON body
|
|
232
232
|
*
|
|
233
233
|
* ```ts
|
|
234
|
-
* const body = await
|
|
234
|
+
* const body = await readBody(req)
|
|
235
235
|
* ```
|
|
236
236
|
*/
|
|
237
237
|
declare function readBody<T = any>(event: H3Event): Promise<T>;
|
|
@@ -270,7 +270,7 @@ declare function parseCookies(event: H3Event): Record<string, string>;
|
|
|
270
270
|
* @param name Name of the cookie to get
|
|
271
271
|
* @returns {*} Value of the cookie (String or undefined)
|
|
272
272
|
* ```ts
|
|
273
|
-
* const authorization =
|
|
273
|
+
* const authorization = getCookie(request, 'Authorization')
|
|
274
274
|
* ```
|
|
275
275
|
*/
|
|
276
276
|
declare function getCookie(event: H3Event, name: string): string | undefined;
|
|
@@ -295,6 +295,16 @@ declare function setCookie(event: H3Event, name: string, value: string, serializ
|
|
|
295
295
|
* ```
|
|
296
296
|
*/
|
|
297
297
|
declare function deleteCookie(event: H3Event, name: string, serializeOptions?: CookieSerializeOptions): void;
|
|
298
|
+
/**
|
|
299
|
+
* Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
|
|
300
|
+
* that are within a single set-cookie field-value, such as in the Expires portion.
|
|
301
|
+
* This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
|
|
302
|
+
* Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
|
|
303
|
+
* Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
|
|
304
|
+
* Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
|
|
305
|
+
* @source https://github.com/nfriedly/set-cookie-parser/blob/3eab8b7d5d12c8ed87832532861c1a35520cf5b3/lib/set-cookie.js#L144
|
|
306
|
+
*/
|
|
307
|
+
declare function splitCookiesString(cookiesString: string): string[];
|
|
298
308
|
|
|
299
309
|
interface ProxyOptions {
|
|
300
310
|
headers?: RequestHeaders | HeadersInit;
|
|
@@ -307,7 +317,9 @@ interface ProxyOptions {
|
|
|
307
317
|
declare function proxyRequest(event: H3Event, target: string, opts?: ProxyOptions): Promise<any>;
|
|
308
318
|
declare function sendProxy(event: H3Event, target: string, opts?: ProxyOptions): Promise<any>;
|
|
309
319
|
declare function getProxyRequestHeaders(event: H3Event): any;
|
|
310
|
-
declare function fetchWithEvent(event: H3Event, req: RequestInfo | URL, init?: RequestInit
|
|
320
|
+
declare function fetchWithEvent(event: H3Event, req: RequestInfo | URL, init?: RequestInit & {
|
|
321
|
+
context?: H3EventContext;
|
|
322
|
+
}, options?: {
|
|
311
323
|
fetch: typeof fetch;
|
|
312
324
|
}): Promise<Response>;
|
|
313
325
|
|
|
@@ -321,6 +333,9 @@ declare function getRequestHeaders(event: H3Event): RequestHeaders;
|
|
|
321
333
|
declare const getHeaders: typeof getRequestHeaders;
|
|
322
334
|
declare function getRequestHeader(event: H3Event, name: string): RequestHeaders[string];
|
|
323
335
|
declare const getHeader: typeof getRequestHeader;
|
|
336
|
+
declare function getRequestHost(event: H3Event): string;
|
|
337
|
+
declare function getRequestProtocol(event: H3Event): "https" | "http";
|
|
338
|
+
declare function getRequestURL(event: H3Event): URL;
|
|
324
339
|
|
|
325
340
|
declare function send(event: H3Event, data?: any, type?: string): Promise<void>;
|
|
326
341
|
/**
|
|
@@ -384,4 +399,4 @@ interface CreateRouterOptions {
|
|
|
384
399
|
}
|
|
385
400
|
declare function createRouter(opts?: CreateRouterOptions): Router;
|
|
386
401
|
|
|
387
|
-
export { AddRouteShortcuts, App, AppOptions, AppUse, CacheConditions, CreateRouterOptions, DynamicEventHandler, Encoding, EventHandler, EventHandlerResponse, H3CorsOptions, H3Error, H3Event, H3EventContext, H3Headers, H3Response, HTTPMethod, InputLayer, InputStack, Layer, LazyEventHandler, MIMES, Matcher, MultiPartData, NodeEventContext, NodeListener, NodeMiddleware, NodePromisifiedHandler, ProxyOptions, RequestHeaders, Router, RouterMethod, RouterUse, Session, SessionConfig, SessionData, Stack, appendCorsHeaders, appendCorsPreflightHeaders, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearSession, createApp, createAppEventHandler, createError, createEvent, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestHeader, getRequestHeaders, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, handleCacheHeaders, handleCors, isCorsOriginAllowed, isError, isEvent, isEventHandler, isMethod, isPreflightRequest, isStream, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readMultipartFormData, readRawBody, sealSession, send, sendError, sendNoContent, sendProxy, sendRedirect, sendStream, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, toEventHandler, toNodeListener, unsealSession, updateSession, use, useBase, useSession, writeEarlyHints };
|
|
402
|
+
export { AddRouteShortcuts, App, AppOptions, AppUse, CacheConditions, CreateRouterOptions, DynamicEventHandler, Encoding, EventHandler, EventHandlerResponse, H3CorsOptions, H3Error, H3Event, H3EventContext, H3Headers, H3Response, HTTPMethod, InputLayer, InputStack, Layer, LazyEventHandler, MIMES, Matcher, MultiPartData, NodeEventContext, NodeListener, NodeMiddleware, NodePromisifiedHandler, ProxyOptions, RequestHeaders, Router, RouterMethod, RouterUse, Session, SessionConfig, SessionData, Stack, appendCorsHeaders, appendCorsPreflightHeaders, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearSession, createApp, createAppEventHandler, createError, createEvent, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestHeader, getRequestHeaders, getRequestHost, getRequestProtocol, getRequestURL, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, handleCacheHeaders, handleCors, isCorsOriginAllowed, isError, isEvent, isEventHandler, isMethod, isPreflightRequest, isStream, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readMultipartFormData, readRawBody, sealSession, send, sendError, sendNoContent, sendProxy, sendRedirect, sendStream, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, splitCookiesString, toEventHandler, toNodeListener, unsealSession, updateSession, use, useBase, useSession, writeEarlyHints };
|
package/dist/index.mjs
CHANGED
|
@@ -183,12 +183,7 @@ function sendError(event, error, debug) {
|
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
const _code = Number.parseInt(h3Error.statusCode);
|
|
186
|
-
|
|
187
|
-
event.node.res.statusCode = _code;
|
|
188
|
-
}
|
|
189
|
-
if (h3Error.statusMessage) {
|
|
190
|
-
event.node.res.statusMessage = h3Error.statusMessage;
|
|
191
|
-
}
|
|
186
|
+
setResponseStatus(event, _code, h3Error.statusMessage);
|
|
192
187
|
event.node.res.setHeader("content-type", MIMES.json);
|
|
193
188
|
event.node.res.end(JSON.stringify(responseBody, void 0, 2));
|
|
194
189
|
}
|
|
@@ -246,6 +241,24 @@ function getRequestHeader(event, name) {
|
|
|
246
241
|
return value;
|
|
247
242
|
}
|
|
248
243
|
const getHeader = getRequestHeader;
|
|
244
|
+
function getRequestHost(event) {
|
|
245
|
+
const xForwardedHost = event.node.req.headers["x-forwarded-host"];
|
|
246
|
+
if (xForwardedHost) {
|
|
247
|
+
return xForwardedHost;
|
|
248
|
+
}
|
|
249
|
+
return event.node.req.headers.host || "localhost";
|
|
250
|
+
}
|
|
251
|
+
function getRequestProtocol(event) {
|
|
252
|
+
if (event.node.req.headers["x-forwarded-proto"] === "https") {
|
|
253
|
+
return "https";
|
|
254
|
+
}
|
|
255
|
+
return event.node.req.connection.encrypted ? "https" : "http";
|
|
256
|
+
}
|
|
257
|
+
function getRequestURL(event) {
|
|
258
|
+
const host = getRequestHost(event);
|
|
259
|
+
const protocol = getRequestProtocol(event);
|
|
260
|
+
return new URL(event.path || "/", `${protocol}://${host}`);
|
|
261
|
+
}
|
|
249
262
|
|
|
250
263
|
const RawBodySymbol = Symbol.for("h3RawBody");
|
|
251
264
|
const ParsedBodySymbol = Symbol.for("h3ParsedBody");
|
|
@@ -378,7 +391,6 @@ function deleteCookie(event, name, serializeOptions) {
|
|
|
378
391
|
maxAge: 0
|
|
379
392
|
});
|
|
380
393
|
}
|
|
381
|
-
|
|
382
394
|
function splitCookiesString(cookiesString) {
|
|
383
395
|
if (typeof cookiesString !== "string") {
|
|
384
396
|
return [];
|
|
@@ -526,8 +538,7 @@ function getProxyRequestHeaders(event) {
|
|
|
526
538
|
function fetchWithEvent(event, req, init, options) {
|
|
527
539
|
return _getFetch(options?.fetch)(req, {
|
|
528
540
|
...init,
|
|
529
|
-
|
|
530
|
-
context: init.context || event.context,
|
|
541
|
+
context: init?.context || event.context,
|
|
531
542
|
headers: {
|
|
532
543
|
...getProxyRequestHeaders(event),
|
|
533
544
|
...init?.headers
|
|
@@ -583,9 +594,15 @@ function sendNoContent(event, code = 204) {
|
|
|
583
594
|
event.node.res.end();
|
|
584
595
|
}
|
|
585
596
|
function setResponseStatus(event, code, text) {
|
|
586
|
-
|
|
597
|
+
if (code) {
|
|
598
|
+
event.node.res.statusCode = code;
|
|
599
|
+
}
|
|
587
600
|
if (text) {
|
|
588
|
-
event.node.res.statusMessage = text
|
|
601
|
+
event.node.res.statusMessage = text.replace(
|
|
602
|
+
// eslint-disable-next-line no-control-regex
|
|
603
|
+
/[^\u0009\u0020-\u007E]/g,
|
|
604
|
+
""
|
|
605
|
+
);
|
|
589
606
|
}
|
|
590
607
|
}
|
|
591
608
|
function getResponseStatus(event) {
|
|
@@ -1383,4 +1400,4 @@ function createRouter(opts = {}) {
|
|
|
1383
1400
|
return router;
|
|
1384
1401
|
}
|
|
1385
1402
|
|
|
1386
|
-
export { H3Error, H3Event, H3Headers, H3Response, MIMES, appendCorsHeaders, appendCorsPreflightHeaders, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearSession, createApp, createAppEventHandler, createError, createEvent, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestHeader, getRequestHeaders, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, handleCacheHeaders, handleCors, isCorsOriginAllowed, isError, isEvent, isEventHandler, isMethod, isPreflightRequest, isStream, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readMultipartFormData, readRawBody, sealSession, send, sendError, sendNoContent, sendProxy, sendRedirect, sendStream, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, toEventHandler, toNodeListener, unsealSession, updateSession, use, useBase, useSession, writeEarlyHints };
|
|
1403
|
+
export { H3Error, H3Event, H3Headers, H3Response, MIMES, appendCorsHeaders, appendCorsPreflightHeaders, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearSession, createApp, createAppEventHandler, createError, createEvent, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestHeader, getRequestHeaders, getRequestHost, getRequestProtocol, getRequestURL, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, handleCacheHeaders, handleCors, isCorsOriginAllowed, isError, isEvent, isEventHandler, isMethod, isPreflightRequest, isStream, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readMultipartFormData, readRawBody, sealSession, send, sendError, sendNoContent, sendProxy, sendRedirect, sendStream, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, splitCookiesString, toEventHandler, toNodeListener, unsealSession, updateSession, use, useBase, useSession, writeEarlyHints };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "h3",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Tiny JavaScript Server",
|
|
5
5
|
"repository": "unjs/h3",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,34 +23,34 @@
|
|
|
23
23
|
"cookie-es": "^0.5.0",
|
|
24
24
|
"defu": "^6.1.2",
|
|
25
25
|
"destr": "^1.2.2",
|
|
26
|
-
"iron-webcrypto": "^0.
|
|
26
|
+
"iron-webcrypto": "^0.6.0",
|
|
27
27
|
"radix3": "^1.0.0",
|
|
28
|
-
"ufo": "^1.1.
|
|
28
|
+
"ufo": "^1.1.1",
|
|
29
29
|
"uncrypto": "^0.1.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"0x": "^5.
|
|
32
|
+
"0x": "^5.5.0",
|
|
33
33
|
"@types/express": "^4.17.17",
|
|
34
|
-
"@types/node": "^18.
|
|
34
|
+
"@types/node": "^18.15.3",
|
|
35
35
|
"@types/supertest": "^2.0.12",
|
|
36
|
-
"@vitest/coverage-c8": "^0.
|
|
36
|
+
"@vitest/coverage-c8": "^0.29.2",
|
|
37
37
|
"autocannon": "^7.10.0",
|
|
38
|
-
"changelogen": "^0.
|
|
38
|
+
"changelogen": "^0.5.1",
|
|
39
39
|
"connect": "^3.7.0",
|
|
40
|
-
"eslint": "^8.
|
|
40
|
+
"eslint": "^8.36.0",
|
|
41
41
|
"eslint-config-unjs": "^0.1.0",
|
|
42
42
|
"express": "^4.18.2",
|
|
43
43
|
"get-port": "^6.1.2",
|
|
44
|
-
"jiti": "^1.
|
|
45
|
-
"listhen": "^1.0.
|
|
44
|
+
"jiti": "^1.18.2",
|
|
45
|
+
"listhen": "^1.0.4",
|
|
46
46
|
"node-fetch-native": "^1.0.2",
|
|
47
47
|
"prettier": "^2.8.4",
|
|
48
48
|
"supertest": "^6.3.3",
|
|
49
49
|
"typescript": "^4.9.5",
|
|
50
|
-
"unbuild": "^1.1.
|
|
51
|
-
"vitest": "^0.
|
|
50
|
+
"unbuild": "^1.1.2",
|
|
51
|
+
"vitest": "^0.29.2"
|
|
52
52
|
},
|
|
53
|
-
"packageManager": "pnpm@7.
|
|
53
|
+
"packageManager": "pnpm@7.29.3",
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "unbuild",
|
|
56
56
|
"dev": "vitest",
|