@suveren/gateway 0.7.4 → 0.8.0
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/content/integrations/mollie.json +103 -28
- package/dist/control-plane/index.mjs +248 -58
- package/dist/mcp-server/http.mjs +577 -124
- package/dist/ui/assets/index-BFnSVa9N.js +110 -0
- package/dist/ui/assets/{index-CkWaRck1.css → index-BYVb_0oG.css} +1 -1
- package/dist/ui/index.html +2 -2
- package/node_modules/@hap/core/dist/index.d.mts +285 -13
- package/node_modules/@hap/core/dist/index.d.ts +285 -13
- package/node_modules/@hap/core/dist/index.js +281 -13
- package/node_modules/@hap/core/dist/index.mjs +266 -12
- package/node_modules/@hap/core/package.json +4 -2
- package/node_modules/@hap/core/src/did-key.ts +126 -0
- package/node_modules/@hap/core/src/frame.ts +115 -14
- package/node_modules/@hap/core/src/gatekeeper.ts +26 -0
- package/node_modules/@hap/core/src/identity.ts +21 -5
- package/node_modules/@hap/core/src/index.ts +3 -0
- package/node_modules/@hap/core/src/mandate.ts +207 -0
- package/node_modules/@hap/core/src/receipt.ts +74 -0
- package/node_modules/@hap/core/src/types.ts +87 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/package.json +16 -10
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.buffer.d.ts +10 -5
- package/node_modules/@types/node/crypto.d.ts +2 -4
- package/node_modules/@types/node/dgram.d.ts +119 -4
- package/node_modules/@types/node/ffi.d.ts +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +61 -65
- package/node_modules/@types/node/fs.d.ts +86 -76
- package/node_modules/@types/node/http.d.ts +17 -1
- package/node_modules/@types/node/http2.d.ts +12 -4
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/inspector.d.ts +2 -1
- package/node_modules/@types/node/net.d.ts +108 -16
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +52 -0
- package/node_modules/@types/node/quic.d.ts +246 -38
- package/node_modules/@types/node/sqlite.d.ts +6 -2
- package/node_modules/@types/node/stream/iter.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +36 -0
- package/node_modules/@types/node/tls.d.ts +24 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/tty.d.ts +4 -3
- package/node_modules/@types/node/vfs.d.ts +210 -0
- package/node_modules/@types/node/vm.d.ts +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +6 -3
- package/node_modules/express-rate-limit/dist/index.d.cts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +11 -0
- package/node_modules/express-rate-limit/dist/index.mjs +6 -3
- package/node_modules/express-rate-limit/{license.md → license} +7 -6
- package/node_modules/express-rate-limit/package.json +5 -5
- package/node_modules/express-rate-limit/readme.md +1 -0
- package/node_modules/fast-uri/index.js +215 -47
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +396 -92
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
- package/node_modules/fast-uri/test/equal.test.js +31 -3
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
- package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
- package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
- package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
- package/node_modules/fast-uri/test/parse.test.js +7 -3
- package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
- package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +101 -0
- package/node_modules/fast-uri/test/security.test.js +75 -3
- package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
- package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
- package/node_modules/hono/dist/cjs/client/client.js +25 -11
- package/node_modules/hono/dist/cjs/client/utils.js +4 -1
- package/node_modules/hono/dist/cjs/context.js +4 -0
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +1 -1
- package/node_modules/hono/dist/cjs/helper/ssg/utils.js +30 -10
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +3 -3
- package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/cjs/request.js +8 -4
- package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +10 -3
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +47 -83
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +46 -69
- package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/cjs/router/utils.js +27 -0
- package/node_modules/hono/dist/cjs/utils/body.js +15 -3
- package/node_modules/hono/dist/cjs/utils/cookie.js +1 -1
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/cjs/utils/stream.js +7 -1
- package/node_modules/hono/dist/cjs/utils/url.js +9 -1
- package/node_modules/hono/dist/client/client.js +25 -11
- package/node_modules/hono/dist/client/utils.js +4 -1
- package/node_modules/hono/dist/context.js +4 -0
- package/node_modules/hono/dist/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/helper/ssg/ssg.js +1 -1
- package/node_modules/hono/dist/helper/ssg/utils.js +30 -10
- package/node_modules/hono/dist/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/middleware/etag/index.js +3 -3
- package/node_modules/hono/dist/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/request.js +8 -4
- package/node_modules/hono/dist/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/router/reg-exp-router/node.js +6 -2
- package/node_modules/hono/dist/router/reg-exp-router/router.js +53 -84
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/router/trie-router/node.js +46 -69
- package/node_modules/hono/dist/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/router/utils.js +5 -0
- package/node_modules/hono/dist/types/context.d.ts +4 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -0
- package/node_modules/hono/dist/types/router/trie-router/node.d.ts +1 -2
- package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -1
- package/node_modules/hono/dist/types/router/utils.d.ts +1 -0
- package/node_modules/hono/dist/types/utils/url.d.ts +4 -0
- package/node_modules/hono/dist/utils/body.js +15 -3
- package/node_modules/hono/dist/utils/cookie.js +1 -1
- package/node_modules/hono/dist/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/utils/stream.js +7 -1
- package/node_modules/hono/dist/utils/url.js +9 -1
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +92 -82
- package/node_modules/ip-address/dist/common.d.ts +20 -0
- package/node_modules/ip-address/dist/common.js +36 -0
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +50 -0
- package/node_modules/ip-address/dist/ipv4.js +75 -0
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +79 -10
- package/node_modules/ip-address/dist/ipv6.js +120 -30
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
- package/node_modules/ip-address/dist/v4/constants.js +40 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +14 -0
- package/node_modules/ip-address/dist/v6/constants.js +47 -1
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/is-plain-object/README.md +39 -95
- package/node_modules/is-plain-object/dist/is-plain-object.js +0 -2
- package/node_modules/is-plain-object/is-plain-object.d.ts +6 -1
- package/node_modules/is-plain-object/package.json +8 -34
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +10 -20
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +16 -38
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +19 -38
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -8
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +5 -5
- package/node_modules/jose/dist/types/jwks/local.d.ts +6 -10
- package/node_modules/jose/dist/types/jwks/remote.d.ts +17 -28
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -10
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +7 -16
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +11 -21
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +12 -21
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +10 -20
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +17 -29
- package/node_modules/jose/dist/types/jwt/sign.d.ts +12 -19
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +17 -28
- package/node_modules/jose/dist/types/jwt/verify.d.ts +9 -19
- package/node_modules/jose/dist/types/key/export.d.ts +4 -4
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +6 -8
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +4 -11
- package/node_modules/jose/dist/types/key/import.d.ts +10 -17
- package/node_modules/jose/dist/types/types.d.ts +48 -86
- package/node_modules/jose/dist/types/util/base64url.d.ts +2 -2
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +3 -10
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -4
- package/node_modules/jose/dist/types/util/errors.d.ts +26 -53
- package/node_modules/jose/dist/webapi/index.js +70 -32
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -8
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +42 -26
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -10
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +53 -71
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +121 -158
- package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -18
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +54 -64
- package/node_modules/jose/dist/webapi/jwks/local.js +49 -74
- package/node_modules/jose/dist/webapi/jwks/remote.js +91 -160
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +21 -20
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +29 -30
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +21 -23
- package/node_modules/jose/dist/webapi/jws/general/sign.js +61 -70
- package/node_modules/jose/dist/webapi/jws/general/verify.js +47 -41
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -22
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +58 -100
- package/node_modules/jose/dist/webapi/jwt/sign.js +18 -50
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +34 -63
- package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
- package/node_modules/jose/dist/webapi/key/export.js +32 -37
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +40 -44
- package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -39
- package/node_modules/jose/dist/webapi/key/import.js +52 -52
- package/node_modules/jose/dist/webapi/lib/asn1.js +130 -164
- package/node_modules/jose/dist/webapi/lib/base64.js +18 -20
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +34 -38
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +79 -123
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +24 -25
- package/node_modules/jose/dist/webapi/lib/deflate.js +46 -40
- package/node_modules/jose/dist/webapi/lib/helpers.js +40 -37
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +10 -24
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -15
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +106 -93
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +210 -176
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +105 -107
- package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +19 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +9 -16
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +58 -72
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +90 -103
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +134 -185
- package/node_modules/jose/dist/webapi/lib/key.js +84 -121
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
- package/node_modules/jose/dist/webapi/lib/key_management.js +200 -225
- package/node_modules/jose/dist/webapi/lib/key_options.js +8 -0
- package/node_modules/jose/dist/webapi/lib/options.js +57 -44
- package/node_modules/jose/dist/webapi/lib/signing.js +18 -22
- package/node_modules/jose/dist/webapi/lib/type_checks.js +28 -33
- package/node_modules/jose/dist/webapi/util/base64url.js +26 -35
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
- package/node_modules/jose/dist/webapi/util/errors.js +94 -84
- package/node_modules/jose/package.json +17 -81
- package/package.json +2 -2
- package/profiles/calendar/0.5.profile.json +190 -0
- package/profiles/charge/0.5.profile.json +210 -0
- package/profiles/customers/0.7.profile.json +157 -0
- package/profiles/deploy/0.9.profile.json +176 -0
- package/profiles/email/0.6.profile.json +208 -0
- package/profiles/index.json +9 -1
- package/profiles/publish/0.5.profile.json +186 -0
- package/profiles/purchase/0.5.profile.json +231 -0
- package/profiles/records/0.5.profile.json +117 -0
- package/dist/ui/assets/index-0Q2eNytX.js +0 -110
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/HISTORY.md +0 -114
|
@@ -33,8 +33,14 @@ const dirname = (path) => {
|
|
|
33
33
|
const normalizePath = (path) => {
|
|
34
34
|
return path.replace(/(\\)/g, "/").replace(/\/$/g, "");
|
|
35
35
|
};
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const getUncRoot = (path) => {
|
|
37
|
+
const uncRoot = path.replace(/\\/g, "/").match(/^\/\/([^/]+)\/([^/]+)/);
|
|
38
|
+
if (uncRoot) {
|
|
39
|
+
return `${uncRoot[1].toLowerCase()}/${uncRoot[2].toLowerCase()}`;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const handleParent = (resultPaths) => {
|
|
43
|
+
if (resultPaths.length === 0 || resultPaths[resultPaths.length - 1] === "..") {
|
|
38
44
|
resultPaths.push("..");
|
|
39
45
|
} else {
|
|
40
46
|
resultPaths.pop();
|
|
@@ -47,22 +53,20 @@ const handleNonDot = (path, resultPaths) => {
|
|
|
47
53
|
}
|
|
48
54
|
};
|
|
49
55
|
const handleSegments = (paths, resultPaths) => {
|
|
50
|
-
let beforeParentFlag = false;
|
|
51
56
|
for (const path of paths) {
|
|
52
57
|
if (path === "..") {
|
|
53
|
-
handleParent(resultPaths
|
|
54
|
-
beforeParentFlag = true;
|
|
58
|
+
handleParent(resultPaths);
|
|
55
59
|
} else {
|
|
56
60
|
handleNonDot(path, resultPaths);
|
|
57
|
-
beforeParentFlag = false;
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
};
|
|
61
64
|
const joinPaths = (...paths) => {
|
|
65
|
+
const hasUncPrefix = getUncRoot(paths[0]) !== void 0;
|
|
62
66
|
paths = paths.map(normalizePath);
|
|
63
67
|
const resultPaths = [];
|
|
64
68
|
handleSegments(paths.join("/").split("/"), resultPaths);
|
|
65
|
-
return (paths[0][0] === "/" ? "/" : "") + resultPaths.join("/");
|
|
69
|
+
return (hasUncPrefix ? "//" : paths[0][0] === "/" ? "/" : "") + resultPaths.join("/");
|
|
66
70
|
};
|
|
67
71
|
const filterStaticGenerateRoutes = (hono) => {
|
|
68
72
|
return hono.routes.reduce((acc, { method, handler, path }) => {
|
|
@@ -76,10 +80,26 @@ const filterStaticGenerateRoutes = (hono) => {
|
|
|
76
80
|
const isDynamicRoute = (path) => {
|
|
77
81
|
return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
|
|
78
82
|
};
|
|
83
|
+
const toSegments = (path) => path === "" ? [] : path.split("/");
|
|
84
|
+
const getPathRoot = (path) => {
|
|
85
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
86
|
+
const uncRoot = getUncRoot(normalizedPath);
|
|
87
|
+
if (uncRoot) {
|
|
88
|
+
return `unc:${uncRoot}`;
|
|
89
|
+
}
|
|
90
|
+
const driveRoot = normalizedPath.match(/^([A-Za-z]):/);
|
|
91
|
+
if (driveRoot) {
|
|
92
|
+
const kind = normalizedPath[2] === "/" ? "drive-absolute" : "drive-relative";
|
|
93
|
+
return `${kind}:${driveRoot[1].toLowerCase()}`;
|
|
94
|
+
}
|
|
95
|
+
return normalizedPath.startsWith("/") ? "absolute" : "relative";
|
|
96
|
+
};
|
|
79
97
|
const ensureWithinOutDir = (outDir, filePath) => {
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
98
|
+
const outDirSegments = toSegments(joinPaths(outDir));
|
|
99
|
+
const filePathSegments = toSegments(joinPaths(filePath));
|
|
100
|
+
const hasMismatchedPathRoot = getPathRoot(outDir) !== getPathRoot(filePath);
|
|
101
|
+
const climbsAboveOutDir = filePathSegments[outDirSegments.length] === "..";
|
|
102
|
+
if (hasMismatchedPathRoot || filePathSegments.length <= outDirSegments.length || !outDirSegments.every((segment, i) => segment === filePathSegments[i]) || climbsAboveOutDir) {
|
|
83
103
|
throw new Error(`Path traversal detected: "${filePath}" is outside the output directory`);
|
|
84
104
|
}
|
|
85
105
|
};
|
|
@@ -101,6 +101,7 @@ const applyProps = (container, attributes, oldAttributes) => {
|
|
|
101
101
|
} else if (key === "dangerouslySetInnerHTML" && value) {
|
|
102
102
|
container.innerHTML = value.__html;
|
|
103
103
|
} else if (key === "ref") {
|
|
104
|
+
refCleanupMap.get(container)?.();
|
|
104
105
|
let cleanup;
|
|
105
106
|
if (typeof value === "function") {
|
|
106
107
|
cleanup = value(container) || (() => value(null));
|
|
@@ -165,6 +166,7 @@ const applyProps = (container, attributes, oldAttributes) => {
|
|
|
165
166
|
container.removeEventListener(eventSpec[0], value, eventSpec[1]);
|
|
166
167
|
} else if (key === "ref") {
|
|
167
168
|
refCleanupMap.get(container)?.();
|
|
169
|
+
refCleanupMap.delete(container);
|
|
168
170
|
} else {
|
|
169
171
|
try {
|
|
170
172
|
container.removeAttribute(toAttributeName(container, key));
|
|
@@ -44,7 +44,7 @@ const parseVaryDirectives = (vary) => {
|
|
|
44
44
|
};
|
|
45
45
|
const createCacheKey = (key, requestUrl, request, varyHeaders) => {
|
|
46
46
|
const url = new URL(cacheKeyPath, requestUrl);
|
|
47
|
-
url.searchParams.append(cacheKeyParameter, key
|
|
47
|
+
url.searchParams.append(cacheKeyParameter, key);
|
|
48
48
|
url.searchParams.append(cacheMethodKeyParameter, request.method);
|
|
49
49
|
if (request.method === "QUERY") {
|
|
50
50
|
url.searchParams.append(queryDigestKeyParameter, request.digest);
|
|
@@ -69,7 +69,7 @@ const cors = (options) => {
|
|
|
69
69
|
}
|
|
70
70
|
if (c.req.method === "OPTIONS") {
|
|
71
71
|
if (opts.origin !== "*") {
|
|
72
|
-
|
|
72
|
+
c.res.headers.append("Vary", "Origin");
|
|
73
73
|
}
|
|
74
74
|
if (opts.maxAge != null) {
|
|
75
75
|
set("Access-Control-Max-Age", opts.maxAge.toString());
|
|
@@ -23,7 +23,7 @@ module.exports = __toCommonJS(csrf_exports);
|
|
|
23
23
|
var import_http_exception = require("../../http-exception");
|
|
24
24
|
const secFetchSiteValues = ["same-origin", "same-site", "none", "cross-site"];
|
|
25
25
|
const isSecFetchSite = (value) => secFetchSiteValues.includes(value);
|
|
26
|
-
const isSafeMethodRe = /^(GET|HEAD)$/;
|
|
26
|
+
const isSafeMethodRe = /^(GET|HEAD|OPTIONS)$/;
|
|
27
27
|
const isRequestedByFormElementRe = /^\b(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)\b/i;
|
|
28
28
|
const csrf = (options) => {
|
|
29
29
|
const originHandler = ((optsOrigin) => {
|
|
@@ -59,7 +59,7 @@ const generateDigest = async (stream, generator) => {
|
|
|
59
59
|
const requiredLength = chunkLength + remaining;
|
|
60
60
|
if (requiredLength < CHUNK_SIZE) {
|
|
61
61
|
if (!chunk) {
|
|
62
|
-
chunk = value.
|
|
62
|
+
chunk = value.slice(offset);
|
|
63
63
|
} else {
|
|
64
64
|
if (chunk.byteLength < requiredLength) {
|
|
65
65
|
const nextChunk = new Uint8Array(
|
|
@@ -32,7 +32,7 @@ const RETAINED_304_HEADERS = [
|
|
|
32
32
|
];
|
|
33
33
|
const stripWeak = (tag) => tag.replace(/^W\//, "");
|
|
34
34
|
function etagMatches(etag2, ifNoneMatch) {
|
|
35
|
-
return ifNoneMatch != null && ifNoneMatch.split(
|
|
35
|
+
return ifNoneMatch != null && ifNoneMatch.split(",").some((t) => stripWeak(t.trim()) === stripWeak(etag2));
|
|
36
36
|
}
|
|
37
37
|
function initializeGenerator(generator) {
|
|
38
38
|
if (!generator) {
|
|
@@ -82,11 +82,11 @@ const etag = (options) => {
|
|
|
82
82
|
ETag: etag3
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
c.res.headers.
|
|
85
|
+
for (const key of Array.from(c.res.headers.keys())) {
|
|
86
86
|
if (retainedHeaders.indexOf(key.toLowerCase()) === -1) {
|
|
87
87
|
c.res.headers.delete(key);
|
|
88
88
|
}
|
|
89
|
-
}
|
|
89
|
+
}
|
|
90
90
|
} else {
|
|
91
91
|
c.res.headers.set("ETag", etag3);
|
|
92
92
|
}
|
|
@@ -20,12 +20,14 @@ __export(pretty_json_exports, {
|
|
|
20
20
|
prettyJSON: () => prettyJSON
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(pretty_json_exports);
|
|
23
|
+
const jsonContentTypeRegex = /^application\/(?:[a-z0-9._-]+\+)?json(?=$|[;\s])/i;
|
|
23
24
|
const prettyJSON = (options) => {
|
|
24
25
|
const targetQuery = options?.query ?? "pretty";
|
|
25
26
|
return async function prettyJSON2(c, next) {
|
|
26
27
|
const pretty = options?.force || c.req.query(targetQuery) || c.req.query(targetQuery) === "";
|
|
27
28
|
await next();
|
|
28
|
-
|
|
29
|
+
const contentType = c.res.headers.get("Content-Type");
|
|
30
|
+
if (pretty && contentType && jsonContentTypeRegex.test(contentType)) {
|
|
29
31
|
const obj = await c.res.json();
|
|
30
32
|
c.res = new Response(JSON.stringify(obj, null, options?.space ?? 2), c.res);
|
|
31
33
|
}
|
|
@@ -68,13 +68,13 @@ class HonoRequest {
|
|
|
68
68
|
return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
|
|
69
69
|
}
|
|
70
70
|
#getDecodedParam(key) {
|
|
71
|
-
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
71
|
+
const paramKey = this.#matchResult[0][this.routeIndex]?.[1][key];
|
|
72
72
|
const param = this.#getParamValue(paramKey);
|
|
73
73
|
return param && (0, import_url.tryDecodeURIComponent)(param);
|
|
74
74
|
}
|
|
75
75
|
#getAllDecodedParams() {
|
|
76
76
|
const decoded = {};
|
|
77
|
-
const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
|
|
77
|
+
const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
|
|
78
78
|
for (const key of keys) {
|
|
79
79
|
const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
80
80
|
if (value !== void 0) {
|
|
@@ -314,10 +314,14 @@ const cloneRawRequest = async (req) => {
|
|
|
314
314
|
message: "Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly."
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
let body = await req[cacheKey]();
|
|
318
318
|
const headers = req.header();
|
|
319
|
-
if (
|
|
319
|
+
if (cacheKey === "json") {
|
|
320
|
+
body = JSON.stringify(body);
|
|
321
|
+
delete headers["content-length"];
|
|
322
|
+
} else if (body instanceof FormData) {
|
|
320
323
|
delete headers["content-type"];
|
|
324
|
+
delete headers["content-length"];
|
|
321
325
|
}
|
|
322
326
|
const requestInit = {
|
|
323
327
|
body,
|
|
@@ -50,7 +50,8 @@ class LinearRouter {
|
|
|
50
50
|
}
|
|
51
51
|
} else if (hasStar && !hasLabel) {
|
|
52
52
|
const endsWithStar = routePath.charCodeAt(routePath.length - 1) === 42;
|
|
53
|
-
const
|
|
53
|
+
const endsWithSlashStar = routePath.endsWith("/*");
|
|
54
|
+
const parts = (endsWithStar ? routePath.slice(0, endsWithSlashStar ? -2 : -1) : routePath).split(splitByStarRe);
|
|
54
55
|
const lastIndex = parts.length - 1;
|
|
55
56
|
for (let j = 0, pos = 0, len2 = parts.length; j < len2; j++) {
|
|
56
57
|
const part = parts[j];
|
|
@@ -60,7 +61,11 @@ class LinearRouter {
|
|
|
60
61
|
}
|
|
61
62
|
pos += part.length;
|
|
62
63
|
if (j === lastIndex) {
|
|
63
|
-
if (
|
|
64
|
+
if (endsWithSlashStar) {
|
|
65
|
+
if (pos !== path.length && path.charCodeAt(pos) !== 47) {
|
|
66
|
+
continue ROUTES_LOOP;
|
|
67
|
+
}
|
|
68
|
+
} else if (!endsWithStar && pos !== path.length && !(pos === path.length - 1 && path.charCodeAt(pos) === 47)) {
|
|
64
69
|
continue ROUTES_LOOP;
|
|
65
70
|
}
|
|
66
71
|
} else {
|
|
@@ -26,10 +26,8 @@ class PatternRouter {
|
|
|
26
26
|
name = "PatternRouter";
|
|
27
27
|
#routes = [];
|
|
28
28
|
add(method, path, handler) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
path = path.slice(0, -2);
|
|
32
|
-
}
|
|
29
|
+
const suffix = path.endsWith("/*") ? "(?:$|/)" : path.endsWith("*") ? "" : "/?$";
|
|
30
|
+
path = path.replace(/\*$/, "");
|
|
33
31
|
if (path.at(-1) === "?") {
|
|
34
32
|
path = path.slice(0, -1);
|
|
35
33
|
this.add(method, path.replace(/\/[^/]+$/, ""), handler);
|
|
@@ -41,11 +39,7 @@ class PatternRouter {
|
|
|
41
39
|
}
|
|
42
40
|
);
|
|
43
41
|
try {
|
|
44
|
-
this.#routes.push([
|
|
45
|
-
new RegExp(`^${parts.join("")}${endsWithWildcard ? "" : "/?$"}`),
|
|
46
|
-
method,
|
|
47
|
-
handler
|
|
48
|
-
]);
|
|
42
|
+
this.#routes.push([new RegExp(`^${parts.join("")}${suffix}`), method, handler]);
|
|
49
43
|
} catch {
|
|
50
44
|
throw new import_router.UnsupportedPathError();
|
|
51
45
|
}
|
|
@@ -17,10 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var node_exports = {};
|
|
19
19
|
__export(node_exports, {
|
|
20
|
+
LABEL_REG_EXP_STR: () => LABEL_REG_EXP_STR,
|
|
20
21
|
Node: () => Node,
|
|
21
|
-
|
|
22
|
+
ONLY_WILDCARD_REG_EXP_STR: () => ONLY_WILDCARD_REG_EXP_STR,
|
|
23
|
+
PATH_ERROR: () => PATH_ERROR,
|
|
24
|
+
TAIL_WILDCARD_REG_EXP_STR: () => TAIL_WILDCARD_REG_EXP_STR
|
|
22
25
|
});
|
|
23
26
|
module.exports = __toCommonJS(node_exports);
|
|
27
|
+
var import_utils = require("../utils");
|
|
24
28
|
const LABEL_REG_EXP_STR = "[^/]+";
|
|
25
29
|
const ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
26
30
|
const TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -49,7 +53,7 @@ class Node {
|
|
|
49
53
|
// handler index of a dynamic path, or -1 for a static path terminal
|
|
50
54
|
#index;
|
|
51
55
|
#varIndex;
|
|
52
|
-
#children =
|
|
56
|
+
#children = (0, import_utils.createNullObject)();
|
|
53
57
|
insert(tokens, index, paramMap, context, isStatic) {
|
|
54
58
|
let node = this;
|
|
55
59
|
for (let i = 0, len = tokens.length; i < len; i++) {
|
|
@@ -128,6 +132,9 @@ class Node {
|
|
|
128
132
|
}
|
|
129
133
|
// Annotate the CommonJS export names for ESM import in node:
|
|
130
134
|
0 && (module.exports = {
|
|
135
|
+
LABEL_REG_EXP_STR,
|
|
131
136
|
Node,
|
|
132
|
-
|
|
137
|
+
ONLY_WILDCARD_REG_EXP_STR,
|
|
138
|
+
PATH_ERROR,
|
|
139
|
+
TAIL_WILDCARD_REG_EXP_STR
|
|
133
140
|
});
|
|
@@ -22,25 +22,20 @@ __export(router_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(router_exports);
|
|
23
23
|
var import_router = require("../../router");
|
|
24
24
|
var import_url = require("../../utils/url");
|
|
25
|
+
var import_utils = require("../utils");
|
|
25
26
|
var import_matcher = require("./matcher");
|
|
26
27
|
var import_node = require("./node");
|
|
27
28
|
var import_trie = require("./trie");
|
|
28
|
-
let wildcardRegExpCache =
|
|
29
|
+
let wildcardRegExpCache = (0, import_utils.createNullObject)();
|
|
29
30
|
function buildWildcardRegExp(path) {
|
|
30
31
|
return wildcardRegExpCache[path] ??= new RegExp(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(
|
|
32
|
+
`^${path.replace(
|
|
33
|
+
/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,
|
|
34
|
+
(match2, metaChar) => metaChar ? `\\${metaChar}` : match2 === "/*" ? import_node.TAIL_WILDCARD_REG_EXP_STR : match2 === "*" ? import_node.ONLY_WILDCARD_REG_EXP_STR : `/:${import_node.LABEL_REG_EXP_STR}`
|
|
34
35
|
)}$`
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
|
-
function clearWildcardRegExpCache() {
|
|
38
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
39
|
-
}
|
|
40
38
|
function findMiddleware(middleware, path) {
|
|
41
|
-
if (!middleware) {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
39
|
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
45
40
|
if (buildWildcardRegExp(k).test(path)) {
|
|
46
41
|
return [...middleware[k]];
|
|
@@ -54,8 +49,8 @@ class RegExpRouter {
|
|
|
54
49
|
#routes;
|
|
55
50
|
#tries;
|
|
56
51
|
constructor() {
|
|
57
|
-
this.#middleware = { [import_router.METHOD_NAME_ALL]:
|
|
58
|
-
this.#routes = { [import_router.METHOD_NAME_ALL]:
|
|
52
|
+
this.#middleware = { [import_router.METHOD_NAME_ALL]: (0, import_utils.createNullObject)() };
|
|
53
|
+
this.#routes = { [import_router.METHOD_NAME_ALL]: (0, import_utils.createNullObject)() };
|
|
59
54
|
this.#tries = { [import_router.METHOD_NAME_ALL]: new import_trie.Trie() };
|
|
60
55
|
}
|
|
61
56
|
#insertPath(method, path) {
|
|
@@ -68,117 +63,86 @@ class RegExpRouter {
|
|
|
68
63
|
add(method, path, handler) {
|
|
69
64
|
const middleware = this.#middleware;
|
|
70
65
|
const routes = this.#routes;
|
|
71
|
-
if (!middleware
|
|
66
|
+
if (!middleware) {
|
|
72
67
|
throw new Error(import_router.MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
73
68
|
}
|
|
74
69
|
if (!middleware[method]) {
|
|
75
70
|
this.#tries[method] = new import_trie.Trie();
|
|
76
|
-
[middleware, routes]
|
|
77
|
-
handlerMap[method] =
|
|
78
|
-
|
|
71
|
+
for (const handlerMap of [middleware, routes]) {
|
|
72
|
+
handlerMap[method] = (0, import_utils.createNullObject)();
|
|
73
|
+
for (const p in handlerMap[import_router.METHOD_NAME_ALL]) {
|
|
79
74
|
handlerMap[method][p] = [...handlerMap[import_router.METHOD_NAME_ALL][p]];
|
|
80
75
|
this.#insertPath(method, p);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
83
78
|
}
|
|
84
79
|
if (path === "/*") {
|
|
85
80
|
path = "*";
|
|
86
81
|
}
|
|
87
|
-
const
|
|
82
|
+
const methods = method === import_router.METHOD_NAME_ALL ? Object.keys(middleware) : [method];
|
|
88
83
|
if (/\*$/.test(path)) {
|
|
89
84
|
const re = buildWildcardRegExp(path);
|
|
90
|
-
|
|
91
|
-
if (
|
|
85
|
+
for (const m of methods) {
|
|
86
|
+
if (!middleware[m][path]) {
|
|
92
87
|
this.#insertPath(m, path);
|
|
93
88
|
middleware[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path) || [];
|
|
94
89
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
re.test(p) &&
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
Object.keys(routes).forEach((m) => {
|
|
104
|
-
if (method === import_router.METHOD_NAME_ALL || method === m) {
|
|
105
|
-
Object.keys(routes[m]).forEach(
|
|
106
|
-
(p) => re.test(p) && routes[m][p].push([handler, paramCount])
|
|
107
|
-
);
|
|
90
|
+
}
|
|
91
|
+
for (const handlerMap of [middleware, routes]) {
|
|
92
|
+
for (const m of methods) {
|
|
93
|
+
for (const p in handlerMap[m]) {
|
|
94
|
+
re.test(p) && handlerMap[m][p].push([handler, path]);
|
|
95
|
+
}
|
|
108
96
|
}
|
|
109
|
-
}
|
|
97
|
+
}
|
|
110
98
|
return;
|
|
111
99
|
}
|
|
112
100
|
const paths = (0, import_url.checkOptionalParameter)(path) || [path];
|
|
113
|
-
for (
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.#insertPath(m, path2);
|
|
119
|
-
routes[m][path2] = [
|
|
120
|
-
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path2) || []
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
101
|
+
for (const path2 of paths) {
|
|
102
|
+
for (const m of methods) {
|
|
103
|
+
if (!routes[m][path2]) {
|
|
104
|
+
this.#insertPath(m, path2);
|
|
105
|
+
routes[m][path2] = findMiddleware(middleware[m], path2) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path2) || [];
|
|
124
106
|
}
|
|
125
|
-
|
|
107
|
+
routes[m][path2].push([handler, path2]);
|
|
108
|
+
}
|
|
126
109
|
}
|
|
127
110
|
}
|
|
128
111
|
match = import_matcher.match;
|
|
129
112
|
buildAllMatchers() {
|
|
130
|
-
const matchers =
|
|
131
|
-
Object.keys(this.#routes)
|
|
132
|
-
matchers[method]
|
|
133
|
-
}
|
|
113
|
+
const matchers = (0, import_utils.createNullObject)();
|
|
114
|
+
for (const method of Object.keys(this.#routes)) {
|
|
115
|
+
matchers[method] = this.#buildMatcher(method);
|
|
116
|
+
}
|
|
134
117
|
this.#middleware = this.#routes = this.#tries = void 0;
|
|
135
|
-
|
|
118
|
+
wildcardRegExpCache = (0, import_utils.createNullObject)();
|
|
136
119
|
return matchers;
|
|
137
120
|
}
|
|
138
121
|
#buildMatcher(method) {
|
|
139
122
|
const middleware = this.#middleware[method];
|
|
140
123
|
const routes = this.#routes[method];
|
|
141
124
|
const trie = this.#tries[method];
|
|
142
|
-
const staticMap =
|
|
125
|
+
const staticMap = (0, import_utils.createNullObject)();
|
|
143
126
|
const handlerData = [];
|
|
144
|
-
[
|
|
127
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
128
|
+
for (const r of [middleware, routes]) {
|
|
145
129
|
for (const path in r) {
|
|
146
130
|
const handlers = r[path];
|
|
147
131
|
const pathData = trie.paths[path];
|
|
148
132
|
if (!pathData) {
|
|
149
|
-
staticMap[path] = [handlers.map(([h]) => [h,
|
|
133
|
+
staticMap[path] = [handlers.map(([h]) => [h, (0, import_utils.createNullObject)()]), import_matcher.emptyParam];
|
|
150
134
|
continue;
|
|
151
135
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
return [h, paramIndexMap];
|
|
161
|
-
});
|
|
136
|
+
handlerData[pathData[0]] = handlers.map(([h, handlerPath]) => [
|
|
137
|
+
h,
|
|
138
|
+
trie.paths[handlerPath][1].reduceRight((map, [key], i) => {
|
|
139
|
+
map[key] = paramReplacementMap[pathData[1][i][1]];
|
|
140
|
+
return map;
|
|
141
|
+
}, (0, import_utils.createNullObject)())
|
|
142
|
+
]);
|
|
162
143
|
}
|
|
163
|
-
});
|
|
164
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
165
|
-
for (let i = 0, len = handlerData.length; i < len; i++) {
|
|
166
|
-
for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
|
|
167
|
-
const map = handlerData[i][j]?.[1];
|
|
168
|
-
if (!map) {
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
const keys = Object.keys(map);
|
|
172
|
-
for (let k = 0, len3 = keys.length; k < len3; k++) {
|
|
173
|
-
map[keys[k]] = paramReplacementMap[map[keys[k]]];
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
const handlerMap = [];
|
|
178
|
-
for (const i in indexReplacementMap) {
|
|
179
|
-
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
180
144
|
}
|
|
181
|
-
return [regexp,
|
|
145
|
+
return [regexp, indexReplacementMap.map((i) => handlerData[i]), staticMap];
|
|
182
146
|
}
|
|
183
147
|
}
|
|
184
148
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -20,13 +20,14 @@ __export(trie_exports, {
|
|
|
20
20
|
Trie: () => Trie
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(trie_exports);
|
|
23
|
+
var import_utils = require("../utils");
|
|
23
24
|
var import_node = require("./node");
|
|
24
25
|
class Trie {
|
|
25
26
|
#context = { varIndex: 0 };
|
|
26
27
|
#root = new import_node.Node();
|
|
27
28
|
#index = 0;
|
|
28
29
|
// dynamic path -> [handler index, param assoc]; static paths are not registered
|
|
29
|
-
paths =
|
|
30
|
+
paths = (0, import_utils.createNullObject)();
|
|
30
31
|
insert(path, isStatic) {
|
|
31
32
|
if (isStatic) {
|
|
32
33
|
this.#root.insert(path.split(""), 0, [], this.#context, true);
|