hono 4.8.4 → 4.8.6
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/cjs/context.js +2 -1
- package/dist/cjs/middleware/serve-static/index.js +12 -2
- package/dist/cjs/utils/url.js +12 -0
- package/dist/context.js +2 -1
- package/dist/middleware/serve-static/index.js +12 -2
- package/dist/types/helper/adapter/index.d.ts +1 -1
- package/dist/types/request.d.ts +5 -0
- package/dist/types/types.d.ts +39 -39
- package/dist/types/utils/url.d.ts +6 -0
- package/dist/utils/url.js +11 -0
- package/package.json +1 -1
package/dist/cjs/context.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(context_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(context_exports);
|
|
25
25
|
var import_request = require("./request");
|
|
26
26
|
var import_html = require("./utils/html");
|
|
27
|
+
var import_url = require("./utils/url");
|
|
27
28
|
const TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
28
29
|
const setDefaultContentType = (contentType, headers) => {
|
|
29
30
|
return {
|
|
@@ -187,7 +188,7 @@ class Context {
|
|
|
187
188
|
return typeof html === "object" ? (0, import_html.resolveCallback)(html, import_html.HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);
|
|
188
189
|
};
|
|
189
190
|
redirect = (location, status) => {
|
|
190
|
-
this.header("Location", String(location));
|
|
191
|
+
this.header("Location", (0, import_url.safeEncodeURI)(String(location)));
|
|
191
192
|
return this.newResponse(null, status ?? 302);
|
|
192
193
|
};
|
|
193
194
|
notFound = () => {
|
|
@@ -32,13 +32,23 @@ const ENCODINGS = {
|
|
|
32
32
|
const ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
33
33
|
const DEFAULT_DOCUMENT = "index.html";
|
|
34
34
|
const defaultPathResolve = (path) => path;
|
|
35
|
+
const isAbsolutePath = (path) => {
|
|
36
|
+
const isUnixAbsolutePath = path.startsWith("/");
|
|
37
|
+
const hasDriveLetter = /^[a-zA-Z]:\\/.test(path);
|
|
38
|
+
const isUncPath = /^\\\\[^\\]+\\[^\\]+/.test(path);
|
|
39
|
+
return isUnixAbsolutePath || hasDriveLetter || isUncPath;
|
|
40
|
+
};
|
|
41
|
+
const windowsPathToUnixPath = (path) => {
|
|
42
|
+
return path.replace(/^[a-zA-Z]:/, "").replace(/\\/g, "/");
|
|
43
|
+
};
|
|
35
44
|
const serveStatic = (options) => {
|
|
36
45
|
let isAbsoluteRoot = false;
|
|
37
46
|
let root;
|
|
38
47
|
if (options.root) {
|
|
39
|
-
if (options.root
|
|
48
|
+
if (isAbsolutePath(options.root)) {
|
|
40
49
|
isAbsoluteRoot = true;
|
|
41
|
-
root =
|
|
50
|
+
root = windowsPathToUnixPath(options.root);
|
|
51
|
+
root = new URL(`file://${root}`).pathname;
|
|
42
52
|
} else {
|
|
43
53
|
root = options.root;
|
|
44
54
|
}
|
package/dist/cjs/utils/url.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(url_exports, {
|
|
|
27
27
|
getQueryParams: () => getQueryParams,
|
|
28
28
|
getQueryStrings: () => getQueryStrings,
|
|
29
29
|
mergePath: () => mergePath,
|
|
30
|
+
safeEncodeURI: () => safeEncodeURI,
|
|
30
31
|
splitPath: () => splitPath,
|
|
31
32
|
splitRoutingPath: () => splitRoutingPath,
|
|
32
33
|
tryDecode: () => tryDecode
|
|
@@ -236,6 +237,16 @@ const getQueryParams = (url, key) => {
|
|
|
236
237
|
return _getQueryParam(url, key, true);
|
|
237
238
|
};
|
|
238
239
|
const decodeURIComponent_ = decodeURIComponent;
|
|
240
|
+
const safeEncodeURI = (str) => {
|
|
241
|
+
try {
|
|
242
|
+
return encodeURI(decodeURI(str));
|
|
243
|
+
} catch (e) {
|
|
244
|
+
if (e instanceof URIError) {
|
|
245
|
+
return encodeURI(str);
|
|
246
|
+
}
|
|
247
|
+
throw e;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
239
250
|
// Annotate the CommonJS export names for ESM import in node:
|
|
240
251
|
0 && (module.exports = {
|
|
241
252
|
checkOptionalParameter,
|
|
@@ -247,6 +258,7 @@ const decodeURIComponent_ = decodeURIComponent;
|
|
|
247
258
|
getQueryParams,
|
|
248
259
|
getQueryStrings,
|
|
249
260
|
mergePath,
|
|
261
|
+
safeEncodeURI,
|
|
250
262
|
splitPath,
|
|
251
263
|
splitRoutingPath,
|
|
252
264
|
tryDecode
|
package/dist/context.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/context.ts
|
|
2
2
|
import { HonoRequest } from "./request.js";
|
|
3
3
|
import { HtmlEscapedCallbackPhase, resolveCallback } from "./utils/html.js";
|
|
4
|
+
import { safeEncodeURI } from "./utils/url.js";
|
|
4
5
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
5
6
|
var setDefaultContentType = (contentType, headers) => {
|
|
6
7
|
return {
|
|
@@ -164,7 +165,7 @@ var Context = class {
|
|
|
164
165
|
return typeof html === "object" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);
|
|
165
166
|
};
|
|
166
167
|
redirect = (location, status) => {
|
|
167
|
-
this.header("Location", String(location));
|
|
168
|
+
this.header("Location", safeEncodeURI(String(location)));
|
|
168
169
|
return this.newResponse(null, status ?? 302);
|
|
169
170
|
};
|
|
170
171
|
notFound = () => {
|
|
@@ -10,13 +10,23 @@ var ENCODINGS = {
|
|
|
10
10
|
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
11
11
|
var DEFAULT_DOCUMENT = "index.html";
|
|
12
12
|
var defaultPathResolve = (path) => path;
|
|
13
|
+
var isAbsolutePath = (path) => {
|
|
14
|
+
const isUnixAbsolutePath = path.startsWith("/");
|
|
15
|
+
const hasDriveLetter = /^[a-zA-Z]:\\/.test(path);
|
|
16
|
+
const isUncPath = /^\\\\[^\\]+\\[^\\]+/.test(path);
|
|
17
|
+
return isUnixAbsolutePath || hasDriveLetter || isUncPath;
|
|
18
|
+
};
|
|
19
|
+
var windowsPathToUnixPath = (path) => {
|
|
20
|
+
return path.replace(/^[a-zA-Z]:/, "").replace(/\\/g, "/");
|
|
21
|
+
};
|
|
13
22
|
var serveStatic = (options) => {
|
|
14
23
|
let isAbsoluteRoot = false;
|
|
15
24
|
let root;
|
|
16
25
|
if (options.root) {
|
|
17
|
-
if (options.root
|
|
26
|
+
if (isAbsolutePath(options.root)) {
|
|
18
27
|
isAbsoluteRoot = true;
|
|
19
|
-
root =
|
|
28
|
+
root = windowsPathToUnixPath(options.root);
|
|
29
|
+
root = new URL(`file://${root}`).pathname;
|
|
20
30
|
} else {
|
|
21
31
|
root = options.root;
|
|
22
32
|
}
|
|
@@ -6,7 +6,7 @@ import type { Context } from '../../context';
|
|
|
6
6
|
export type Runtime = "node" | "deno" | "bun" | "workerd" | "fastly" | "edge-light" | "other";
|
|
7
7
|
export declare const env: <T extends Record<string, unknown>, C extends Context = Context<{
|
|
8
8
|
Bindings: T;
|
|
9
|
-
}
|
|
9
|
+
}>>(c: T extends Record<string, unknown> ? Context : C, runtime?: Runtime) => T & C["env"];
|
|
10
10
|
export declare const knownUserAgents: Partial<Record<Runtime, string>>;
|
|
11
11
|
export declare const getRuntimeKey: () => Runtime;
|
|
12
12
|
export declare const checkUserAgentEquals: (platform: string) => boolean;
|
package/dist/types/request.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GET_MATCH_RESULT } from './request/constants';
|
|
1
2
|
import type { Result } from './router';
|
|
2
3
|
import type { Input, InputToDataByTarget, ParamKeyToRecord, ParamKeys, RemoveQuestion, RouterRoute, ValidationTargets } from './types';
|
|
3
4
|
import type { BodyData, ParseBodyOptions } from './utils/body';
|
|
@@ -14,6 +15,10 @@ type BodyCache = Partial<Body & {
|
|
|
14
15
|
parsedBody: BodyData;
|
|
15
16
|
}>;
|
|
16
17
|
export declare class HonoRequest<P extends string = "/", I extends Input["out"] = {}> {
|
|
18
|
+
[GET_MATCH_RESULT]: Result<[
|
|
19
|
+
unknown,
|
|
20
|
+
RouterRoute
|
|
21
|
+
]>;
|
|
17
22
|
/**
|
|
18
23
|
* `.raw` can get the raw Request object.
|
|
19
24
|
*
|
package/dist/types/types.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
54
54
|
E2,
|
|
55
55
|
E3
|
|
56
56
|
]>, S & ToSchema<M, P, I2, MergeTypedResponse<R>>, BasePath>;
|
|
57
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
57
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(path: P, handler: H<E2, MergedPath, I, R>): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
|
|
58
58
|
<P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
59
59
|
E,
|
|
60
60
|
E2
|
|
@@ -72,7 +72,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
72
72
|
E3,
|
|
73
73
|
E4
|
|
74
74
|
]>, S & ToSchema<M, P, I3, MergeTypedResponse<R>>, BasePath>;
|
|
75
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
75
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
76
76
|
E,
|
|
77
77
|
E2
|
|
78
78
|
]>>(path: P, ...handlers: [
|
|
@@ -103,7 +103,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
103
103
|
E4,
|
|
104
104
|
E5
|
|
105
105
|
]>, S & ToSchema<M, P, I4, MergeTypedResponse<R>>, BasePath>;
|
|
106
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
106
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
107
107
|
E,
|
|
108
108
|
E2
|
|
109
109
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -147,7 +147,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
147
147
|
E5,
|
|
148
148
|
E6
|
|
149
149
|
]>, S & ToSchema<M, P, I5, MergeTypedResponse<R>>, BasePath>;
|
|
150
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
150
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
151
151
|
E,
|
|
152
152
|
E2
|
|
153
153
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -206,7 +206,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
206
206
|
E6,
|
|
207
207
|
E7
|
|
208
208
|
]>, S & ToSchema<M, P, I6, MergeTypedResponse<R>>, BasePath>;
|
|
209
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
209
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
210
210
|
E,
|
|
211
211
|
E2
|
|
212
212
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -282,7 +282,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
282
282
|
E7,
|
|
283
283
|
E8
|
|
284
284
|
]>, S & ToSchema<M, P, I7, MergeTypedResponse<R>>, BasePath>;
|
|
285
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
285
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
286
286
|
E,
|
|
287
287
|
E2
|
|
288
288
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -377,7 +377,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
377
377
|
E8,
|
|
378
378
|
E9
|
|
379
379
|
]>, S & ToSchema<M, P, I8, MergeTypedResponse<R>>, BasePath>;
|
|
380
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
380
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
381
381
|
E,
|
|
382
382
|
E2
|
|
383
383
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -493,7 +493,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
493
493
|
E9,
|
|
494
494
|
E10
|
|
495
495
|
]>, S & ToSchema<M, P, I9, MergeTypedResponse<R>>, BasePath>;
|
|
496
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
496
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
497
497
|
E,
|
|
498
498
|
E2
|
|
499
499
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -632,7 +632,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
632
632
|
E10,
|
|
633
633
|
E11
|
|
634
634
|
]>, S & ToSchema<M, P, I10, MergeTypedResponse<R>>, BasePath>;
|
|
635
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
635
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
636
636
|
E,
|
|
637
637
|
E2
|
|
638
638
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -695,7 +695,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
|
|
|
695
695
|
H<E9, MergedPath, I8>,
|
|
696
696
|
H<E10, MergedPath, I9, R>
|
|
697
697
|
]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I9, MergeTypedResponse<R>>, BasePath>;
|
|
698
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
698
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
699
699
|
E,
|
|
700
700
|
E2
|
|
701
701
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -794,7 +794,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
794
794
|
E2,
|
|
795
795
|
E3
|
|
796
796
|
]>, S, BasePath>;
|
|
797
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
797
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E>(path: P, handler: MiddlewareHandler<E2, MergedPath>): HonoBase<IntersectNonAnyTypes<[
|
|
798
798
|
E,
|
|
799
799
|
E2
|
|
800
800
|
]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
|
|
@@ -815,7 +815,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
815
815
|
E3,
|
|
816
816
|
E4
|
|
817
817
|
]>, S, BasePath>;
|
|
818
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
818
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
819
819
|
E,
|
|
820
820
|
E2
|
|
821
821
|
]>>(path: P, ...handlers: [
|
|
@@ -850,7 +850,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
850
850
|
E4,
|
|
851
851
|
E5
|
|
852
852
|
]>, S, BasePath>;
|
|
853
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
853
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
854
854
|
E,
|
|
855
855
|
E2
|
|
856
856
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -899,7 +899,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
899
899
|
E5,
|
|
900
900
|
E6
|
|
901
901
|
]>, S, BasePath>;
|
|
902
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
902
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
903
903
|
E,
|
|
904
904
|
E2
|
|
905
905
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -964,7 +964,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
964
964
|
E6,
|
|
965
965
|
E7
|
|
966
966
|
]>, S, BasePath>;
|
|
967
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
967
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
968
968
|
E,
|
|
969
969
|
E2
|
|
970
970
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1047,7 +1047,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
1047
1047
|
E7,
|
|
1048
1048
|
E8
|
|
1049
1049
|
]>, S, BasePath>;
|
|
1050
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
1050
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1051
1051
|
E,
|
|
1052
1052
|
E2
|
|
1053
1053
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1150,7 +1150,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
1150
1150
|
E8,
|
|
1151
1151
|
E9
|
|
1152
1152
|
]>, S, BasePath>;
|
|
1153
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
1153
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1154
1154
|
E,
|
|
1155
1155
|
E2
|
|
1156
1156
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1275,7 +1275,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
1275
1275
|
E9,
|
|
1276
1276
|
E10
|
|
1277
1277
|
]>, S, BasePath>;
|
|
1278
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
1278
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1279
1279
|
E,
|
|
1280
1280
|
E2
|
|
1281
1281
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1424,7 +1424,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
1424
1424
|
E10,
|
|
1425
1425
|
E11
|
|
1426
1426
|
]>, S, BasePath>;
|
|
1427
|
-
<P extends string, MergedPath extends MergePath<BasePath, P
|
|
1427
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1428
1428
|
E,
|
|
1429
1429
|
E2
|
|
1430
1430
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1501,11 +1501,11 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
|
|
|
1501
1501
|
<P extends string, E2 extends Env = E>(path: P, ...handlers: MiddlewareHandler<E2, MergePath<BasePath, P>>[]): HonoBase<E, S, BasePath>;
|
|
1502
1502
|
}
|
|
1503
1503
|
export interface OnHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/"> {
|
|
1504
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1504
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(method: M, path: P, handler: H<E2, MergedPath, I, R>): HonoBase<IntersectNonAnyTypes<[
|
|
1505
1505
|
E,
|
|
1506
1506
|
E2
|
|
1507
1507
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
|
|
1508
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1508
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1509
1509
|
E,
|
|
1510
1510
|
E2
|
|
1511
1511
|
]>>(method: M, path: P, ...handlers: [
|
|
@@ -1516,7 +1516,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1516
1516
|
E2,
|
|
1517
1517
|
E3
|
|
1518
1518
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I2, MergeTypedResponse<R>>, BasePath>;
|
|
1519
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1519
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1520
1520
|
E,
|
|
1521
1521
|
E2
|
|
1522
1522
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1533,7 +1533,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1533
1533
|
E3,
|
|
1534
1534
|
E4
|
|
1535
1535
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I3, MergeTypedResponse<R>>, BasePath>;
|
|
1536
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1536
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1537
1537
|
E,
|
|
1538
1538
|
E2
|
|
1539
1539
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1557,7 +1557,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1557
1557
|
E4,
|
|
1558
1558
|
E5
|
|
1559
1559
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I4, MergeTypedResponse<R>>, BasePath>;
|
|
1560
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1560
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1561
1561
|
E,
|
|
1562
1562
|
E2
|
|
1563
1563
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1589,7 +1589,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1589
1589
|
E5,
|
|
1590
1590
|
E6
|
|
1591
1591
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I5, MergeTypedResponse<R>>, BasePath>;
|
|
1592
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1592
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1593
1593
|
E,
|
|
1594
1594
|
E2
|
|
1595
1595
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1630,7 +1630,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1630
1630
|
E6,
|
|
1631
1631
|
E7
|
|
1632
1632
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I6, MergeTypedResponse<R>>, BasePath>;
|
|
1633
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1633
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1634
1634
|
E,
|
|
1635
1635
|
E2
|
|
1636
1636
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1681,7 +1681,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1681
1681
|
E7,
|
|
1682
1682
|
E8
|
|
1683
1683
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I7, MergeTypedResponse<R>>, BasePath>;
|
|
1684
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1684
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1685
1685
|
E,
|
|
1686
1686
|
E2
|
|
1687
1687
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1743,7 +1743,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1743
1743
|
E8,
|
|
1744
1744
|
E9
|
|
1745
1745
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I8, MergeTypedResponse<R>>, BasePath>;
|
|
1746
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1746
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1747
1747
|
E,
|
|
1748
1748
|
E2
|
|
1749
1749
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1817,7 +1817,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1817
1817
|
E9,
|
|
1818
1818
|
E10
|
|
1819
1819
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I9, MergeTypedResponse<R>>, BasePath>;
|
|
1820
|
-
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P
|
|
1820
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1821
1821
|
E,
|
|
1822
1822
|
E2
|
|
1823
1823
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1905,11 +1905,11 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1905
1905
|
E11
|
|
1906
1906
|
]>, S & ToSchema<M, MergePath<BasePath, P>, I10, MergeTypedResponse<HandlerResponse<any>>>, BasePath>;
|
|
1907
1907
|
<M extends string, P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(method: M, path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
|
|
1908
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
1908
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(methods: Ms, path: P, handler: H<E2, MergedPath, I, R>): HonoBase<IntersectNonAnyTypes<[
|
|
1909
1909
|
E,
|
|
1910
1910
|
E2
|
|
1911
1911
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
|
|
1912
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
1912
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1913
1913
|
E,
|
|
1914
1914
|
E2
|
|
1915
1915
|
]>>(methods: Ms, path: P, ...handlers: [
|
|
@@ -1920,7 +1920,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1920
1920
|
E2,
|
|
1921
1921
|
E3
|
|
1922
1922
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I2, MergeTypedResponse<R>>, BasePath>;
|
|
1923
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
1923
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1924
1924
|
E,
|
|
1925
1925
|
E2
|
|
1926
1926
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1937,7 +1937,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1937
1937
|
E3,
|
|
1938
1938
|
E4
|
|
1939
1939
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I3, MergeTypedResponse<R>>, BasePath>;
|
|
1940
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
1940
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1941
1941
|
E,
|
|
1942
1942
|
E2
|
|
1943
1943
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1961,7 +1961,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1961
1961
|
E4,
|
|
1962
1962
|
E5
|
|
1963
1963
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I4, MergeTypedResponse<R>>, BasePath>;
|
|
1964
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
1964
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1965
1965
|
E,
|
|
1966
1966
|
E2
|
|
1967
1967
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -1993,7 +1993,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
1993
1993
|
E5,
|
|
1994
1994
|
E6
|
|
1995
1995
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I5, MergeTypedResponse<R>>, BasePath>;
|
|
1996
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
1996
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
1997
1997
|
E,
|
|
1998
1998
|
E2
|
|
1999
1999
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -2034,7 +2034,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
2034
2034
|
E6,
|
|
2035
2035
|
E7
|
|
2036
2036
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I6, MergeTypedResponse<R>>, BasePath>;
|
|
2037
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
2037
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
2038
2038
|
E,
|
|
2039
2039
|
E2
|
|
2040
2040
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -2085,7 +2085,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
2085
2085
|
E7,
|
|
2086
2086
|
E8
|
|
2087
2087
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I7, MergeTypedResponse<R>>, BasePath>;
|
|
2088
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
2088
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
2089
2089
|
E,
|
|
2090
2090
|
E2
|
|
2091
2091
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -2147,7 +2147,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
2147
2147
|
E8,
|
|
2148
2148
|
E9
|
|
2149
2149
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I8, MergeTypedResponse<R>>, BasePath>;
|
|
2150
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
2150
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
2151
2151
|
E,
|
|
2152
2152
|
E2
|
|
2153
2153
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -2221,7 +2221,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
|
|
|
2221
2221
|
E9,
|
|
2222
2222
|
E10
|
|
2223
2223
|
]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I9, MergeTypedResponse<HandlerResponse<any>>>, BasePath>;
|
|
2224
|
-
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P
|
|
2224
|
+
<Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[
|
|
2225
2225
|
E,
|
|
2226
2226
|
E2
|
|
2227
2227
|
]>, E4 extends Env = IntersectNonAnyTypes<[
|
|
@@ -30,4 +30,10 @@ export declare const checkOptionalParameter: (path: string) => string[] | null;
|
|
|
30
30
|
export declare const getQueryParam: (url: string, key?: string) => string | undefined | Record<string, string>;
|
|
31
31
|
export declare const getQueryParams: (url: string, key?: string) => string[] | undefined | Record<string, string[]>;
|
|
32
32
|
export declare const decodeURIComponent_: typeof decodeURIComponent;
|
|
33
|
+
/**
|
|
34
|
+
* This function ensures that the string is safely encoded,
|
|
35
|
+
* and not double-encoded.
|
|
36
|
+
* The input string may or may not escaped by encodeURI.
|
|
37
|
+
*/
|
|
38
|
+
export declare const safeEncodeURI: (str: string) => string;
|
|
33
39
|
export {};
|
package/dist/utils/url.js
CHANGED
|
@@ -203,6 +203,16 @@ var getQueryParams = (url, key) => {
|
|
|
203
203
|
return _getQueryParam(url, key, true);
|
|
204
204
|
};
|
|
205
205
|
var decodeURIComponent_ = decodeURIComponent;
|
|
206
|
+
var safeEncodeURI = (str) => {
|
|
207
|
+
try {
|
|
208
|
+
return encodeURI(decodeURI(str));
|
|
209
|
+
} catch (e) {
|
|
210
|
+
if (e instanceof URIError) {
|
|
211
|
+
return encodeURI(str);
|
|
212
|
+
}
|
|
213
|
+
throw e;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
206
216
|
export {
|
|
207
217
|
checkOptionalParameter,
|
|
208
218
|
decodeURIComponent_,
|
|
@@ -213,6 +223,7 @@ export {
|
|
|
213
223
|
getQueryParams,
|
|
214
224
|
getQueryStrings,
|
|
215
225
|
mergePath,
|
|
226
|
+
safeEncodeURI,
|
|
216
227
|
splitPath,
|
|
217
228
|
splitRoutingPath,
|
|
218
229
|
tryDecode
|