repocairn 0.1.2 → 0.1.4

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.
Files changed (233) hide show
  1. package/README.md +13 -2
  2. package/dist/graphify-source.d.ts +17 -0
  3. package/dist/graphify-source.js +87 -0
  4. package/dist/graphify-source.js.map +1 -0
  5. package/dist/index-command.js +3 -1
  6. package/dist/index-command.js.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/indexer.d.ts +1 -0
  11. package/dist/indexer.js +2 -1
  12. package/dist/indexer.js.map +1 -1
  13. package/dist/signals.d.ts +13 -0
  14. package/dist/signals.js +84 -0
  15. package/dist/signals.js.map +1 -0
  16. package/dist/tree-sitter-extract.js +134 -1
  17. package/dist/tree-sitter-extract.js.map +1 -1
  18. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  19. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  20. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  21. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  22. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  23. package/node_modules/eventsource-parser/dist/index.cjs +2 -2
  24. package/node_modules/eventsource-parser/dist/index.cjs.map +1 -1
  25. package/node_modules/eventsource-parser/dist/index.js +2 -2
  26. package/node_modules/eventsource-parser/dist/index.js.map +1 -1
  27. package/node_modules/eventsource-parser/package.json +1 -1
  28. package/node_modules/eventsource-parser/src/parse.ts +4 -2
  29. package/node_modules/express-rate-limit/dist/index.cjs +6 -1
  30. package/node_modules/express-rate-limit/dist/index.mjs +6 -1
  31. package/node_modules/express-rate-limit/package.json +6 -6
  32. package/node_modules/fast-uri/index.js +37 -1
  33. package/node_modules/fast-uri/package.json +1 -1
  34. package/node_modules/fast-uri/test/security.test.js +136 -0
  35. package/node_modules/hono/dist/cjs/client/client.js +3 -3
  36. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  37. package/node_modules/hono/dist/cjs/context.js +32 -13
  38. package/node_modules/hono/dist/cjs/helper/proxy/index.js +4 -0
  39. package/node_modules/hono/dist/cjs/hono-base.js +3 -2
  40. package/node_modules/hono/dist/cjs/jsx/base.js +27 -23
  41. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +16 -13
  42. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +1 -1
  43. package/node_modules/hono/dist/cjs/middleware/cache/index.js +103 -8
  44. package/node_modules/hono/dist/cjs/middleware/compress/index.js +5 -0
  45. package/node_modules/hono/dist/cjs/middleware/cors/index.js +17 -14
  46. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
  47. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +47 -1
  48. package/node_modules/hono/dist/cjs/middleware/etag/index.js +6 -3
  49. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +9 -4
  50. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +9 -4
  51. package/node_modules/hono/dist/cjs/middleware/language/language.js +10 -6
  52. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +90 -0
  53. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
  54. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +6 -3
  55. package/node_modules/hono/dist/cjs/request.js +6 -8
  56. package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
  57. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
  58. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +55 -56
  59. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +64 -85
  60. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +13 -5
  61. package/node_modules/hono/dist/cjs/router/trie-router/node.js +44 -68
  62. package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
  63. package/node_modules/hono/dist/cjs/router.js +1 -1
  64. package/node_modules/hono/dist/cjs/utils/cookie.js +3 -2
  65. package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
  66. package/node_modules/hono/dist/cjs/utils/stream.js +5 -2
  67. package/node_modules/hono/dist/cjs/utils/url.js +9 -9
  68. package/node_modules/hono/dist/client/client.js +3 -3
  69. package/node_modules/hono/dist/client/utils.js +1 -1
  70. package/node_modules/hono/dist/context.js +32 -13
  71. package/node_modules/hono/dist/helper/proxy/index.js +4 -0
  72. package/node_modules/hono/dist/hono-base.js +3 -2
  73. package/node_modules/hono/dist/jsx/base.js +27 -23
  74. package/node_modules/hono/dist/jsx/hooks/index.js +16 -13
  75. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +1 -1
  76. package/node_modules/hono/dist/middleware/cache/index.js +103 -8
  77. package/node_modules/hono/dist/middleware/compress/index.js +5 -0
  78. package/node_modules/hono/dist/middleware/cors/index.js +17 -14
  79. package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
  80. package/node_modules/hono/dist/middleware/etag/digest.js +47 -1
  81. package/node_modules/hono/dist/middleware/etag/index.js +6 -3
  82. package/node_modules/hono/dist/middleware/jwk/jwk.js +9 -4
  83. package/node_modules/hono/dist/middleware/jwt/jwt.js +9 -4
  84. package/node_modules/hono/dist/middleware/language/language.js +10 -6
  85. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +68 -0
  86. package/node_modules/hono/dist/middleware/pretty-json/index.js +3 -1
  87. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +6 -3
  88. package/node_modules/hono/dist/request.js +7 -9
  89. package/node_modules/hono/dist/router/linear-router/router.js +7 -2
  90. package/node_modules/hono/dist/router/pattern-router/router.js +3 -9
  91. package/node_modules/hono/dist/router/reg-exp-router/node.js +55 -56
  92. package/node_modules/hono/dist/router/reg-exp-router/router.js +64 -85
  93. package/node_modules/hono/dist/router/reg-exp-router/trie.js +13 -5
  94. package/node_modules/hono/dist/router/trie-router/node.js +44 -68
  95. package/node_modules/hono/dist/router/trie-router/router.js +3 -11
  96. package/node_modules/hono/dist/router.js +1 -1
  97. package/node_modules/hono/dist/types/client/types.d.ts +1 -1
  98. package/node_modules/hono/dist/types/context.d.ts +4 -0
  99. package/node_modules/hono/dist/types/hono-base.d.ts +4 -3
  100. package/node_modules/hono/dist/types/jsx/base.d.ts +4 -2
  101. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +5 -5
  102. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +2 -2
  103. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +5 -5
  104. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +8 -6
  105. package/node_modules/hono/dist/types/jsx/index.d.ts +5 -5
  106. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +6 -4
  107. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +1 -1
  108. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +2 -2
  109. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +2 -0
  110. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +2 -0
  111. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +49 -0
  112. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +3 -3
  113. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +1 -1
  114. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +2 -1
  115. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +1 -2
  116. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -1
  117. package/node_modules/hono/dist/types/router.d.ts +1 -1
  118. package/node_modules/hono/dist/types/utils/headers.d.ts +2 -2
  119. package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
  120. package/node_modules/hono/dist/utils/cookie.js +4 -3
  121. package/node_modules/hono/dist/utils/ipaddr.js +5 -3
  122. package/node_modules/hono/dist/utils/stream.js +5 -2
  123. package/node_modules/hono/dist/utils/url.js +7 -8
  124. package/node_modules/hono/package.json +10 -3
  125. package/node_modules/ip-address/README.md +163 -149
  126. package/node_modules/ip-address/dist/address-error.d.ts +11 -0
  127. package/node_modules/ip-address/dist/address-error.js.map +1 -1
  128. package/node_modules/ip-address/dist/common.d.ts +6 -0
  129. package/node_modules/ip-address/dist/common.js +17 -1
  130. package/node_modules/ip-address/dist/common.js.map +1 -1
  131. package/node_modules/ip-address/dist/ipv4.d.ts +22 -6
  132. package/node_modules/ip-address/dist/ipv4.js +25 -18
  133. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  134. package/node_modules/ip-address/dist/ipv6.d.ts +19 -5
  135. package/node_modules/ip-address/dist/ipv6.js +61 -33
  136. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  137. package/node_modules/ip-address/package.json +5 -3
  138. package/node_modules/jose/README.md +13 -13
  139. package/node_modules/jose/dist/types/index.d.ts +6 -5
  140. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +17 -11
  141. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +8 -19
  142. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +17 -11
  143. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +8 -19
  144. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +18 -13
  145. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +21 -21
  146. package/node_modules/jose/dist/types/jwk/embedded.d.ts +8 -12
  147. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -15
  148. package/node_modules/jose/dist/types/jwks/local.d.ts +12 -21
  149. package/node_modules/jose/dist/types/jwks/remote.d.ts +34 -165
  150. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +2 -13
  151. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +17 -13
  152. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +2 -13
  153. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +17 -13
  154. package/node_modules/jose/dist/types/jws/general/sign.d.ts +16 -17
  155. package/node_modules/jose/dist/types/jws/general/verify.d.ts +18 -15
  156. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +17 -11
  157. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +11 -34
  158. package/node_modules/jose/dist/types/jwt/sign.d.ts +2 -13
  159. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +4 -13
  160. package/node_modules/jose/dist/types/jwt/verify.d.ts +14 -13
  161. package/node_modules/jose/dist/types/key/export.d.ts +0 -14
  162. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +7 -14
  163. package/node_modules/jose/dist/types/key/generate_secret.d.ts +16 -14
  164. package/node_modules/jose/dist/types/key/import.d.ts +18 -28
  165. package/node_modules/jose/dist/types/types.d.ts +243 -224
  166. package/node_modules/jose/dist/types/util/base64url.d.ts +11 -4
  167. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -9
  168. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -8
  169. package/node_modules/jose/dist/types/util/errors.d.ts +128 -121
  170. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +4 -22
  171. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +5 -153
  172. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +16 -111
  173. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +23 -3
  174. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +70 -82
  175. package/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
  176. package/node_modules/jose/dist/webapi/jwks/local.js +32 -73
  177. package/node_modules/jose/dist/webapi/jwks/remote.js +19 -28
  178. package/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
  179. package/node_modules/jose/dist/webapi/jws/compact/verify.js +4 -16
  180. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -65
  181. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
  182. package/node_modules/jose/dist/webapi/jws/general/sign.js +19 -15
  183. package/node_modules/jose/dist/webapi/jws/general/verify.js +29 -9
  184. package/node_modules/jose/dist/webapi/jwt/decrypt.js +5 -5
  185. package/node_modules/jose/dist/webapi/jwt/sign.js +2 -3
  186. package/node_modules/jose/dist/webapi/jwt/unsecured.js +4 -3
  187. package/node_modules/jose/dist/webapi/jwt/verify.js +6 -6
  188. package/node_modules/jose/dist/webapi/key/export.js +37 -4
  189. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +33 -82
  190. package/node_modules/jose/dist/webapi/key/generate_secret.js +2 -2
  191. package/node_modules/jose/dist/webapi/key/import.js +8 -8
  192. package/node_modules/jose/dist/webapi/lib/asn1.js +53 -122
  193. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
  194. package/node_modules/jose/dist/webapi/lib/content_encryption.js +34 -109
  195. package/node_modules/jose/dist/webapi/lib/crypto_key.js +18 -126
  196. package/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
  197. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -1
  198. package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +107 -0
  199. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +186 -0
  200. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +114 -0
  201. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +8 -98
  202. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +73 -0
  203. package/node_modules/jose/dist/webapi/lib/jws_sign.js +74 -0
  204. package/node_modules/jose/dist/webapi/lib/jws_verify.js +107 -0
  205. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +68 -109
  206. package/node_modules/jose/dist/webapi/lib/key.js +132 -0
  207. package/node_modules/jose/dist/webapi/lib/key_algorithm.js +10 -0
  208. package/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
  209. package/node_modules/jose/dist/webapi/lib/key_management.js +162 -92
  210. package/node_modules/jose/dist/webapi/lib/options.js +48 -0
  211. package/node_modules/jose/dist/webapi/lib/signing.js +14 -56
  212. package/node_modules/jose/dist/webapi/lib/type_checks.js +13 -18
  213. package/node_modules/jose/dist/webapi/util/base64url.js +13 -4
  214. package/node_modules/jose/dist/webapi/util/decode_jwt.js +2 -2
  215. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -15
  216. package/node_modules/jose/dist/webapi/util/errors.js +1 -1
  217. package/node_modules/jose/package.json +2 -4
  218. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  219. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  220. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  221. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  222. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  223. package/package.json +5 -3
  224. package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -15
  225. package/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
  226. package/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
  227. package/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
  228. package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -34
  229. package/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -166
  230. package/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -42
  231. package/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
  232. package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
  233. package/node_modules/jose/dist/webapi/lib/validate_crit.js +0 -33
@@ -8,7 +8,6 @@ import { checkOptionalParameter } from "../../utils/url.js";
8
8
  import { match, emptyParam } from "./matcher.js";
9
9
  import { PATH_ERROR } from "./node.js";
10
10
  import { Trie } from "./trie.js";
11
- var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
12
11
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
13
12
  function buildWildcardRegExp(path) {
14
13
  return wildcardRegExpCache[path] ??= new RegExp(
@@ -21,63 +20,6 @@ function buildWildcardRegExp(path) {
21
20
  function clearWildcardRegExpCache() {
22
21
  wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
23
22
  }
24
- function buildMatcherFromPreprocessedRoutes(routes) {
25
- const trie = new Trie();
26
- const handlerData = [];
27
- if (routes.length === 0) {
28
- return nullMatcher;
29
- }
30
- const routesWithStaticPathFlag = routes.map(
31
- (route) => [!/\*|\/:/.test(route[0]), ...route]
32
- ).sort(
33
- ([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length
34
- );
35
- const staticMap = /* @__PURE__ */ Object.create(null);
36
- for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
37
- const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];
38
- if (pathErrorCheckOnly) {
39
- staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
40
- } else {
41
- j++;
42
- }
43
- let paramAssoc;
44
- try {
45
- paramAssoc = trie.insert(path, j, pathErrorCheckOnly);
46
- } catch (e) {
47
- throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
48
- }
49
- if (pathErrorCheckOnly) {
50
- continue;
51
- }
52
- handlerData[j] = handlers.map(([h, paramCount]) => {
53
- const paramIndexMap = /* @__PURE__ */ Object.create(null);
54
- paramCount -= 1;
55
- for (; paramCount >= 0; paramCount--) {
56
- const [key, value] = paramAssoc[paramCount];
57
- paramIndexMap[key] = value;
58
- }
59
- return [h, paramIndexMap];
60
- });
61
- }
62
- const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
63
- for (let i = 0, len = handlerData.length; i < len; i++) {
64
- for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
65
- const map = handlerData[i][j]?.[1];
66
- if (!map) {
67
- continue;
68
- }
69
- const keys = Object.keys(map);
70
- for (let k = 0, len3 = keys.length; k < len3; k++) {
71
- map[keys[k]] = paramReplacementMap[map[keys[k]]];
72
- }
73
- }
74
- }
75
- const handlerMap = [];
76
- for (const i in indexReplacementMap) {
77
- handlerMap[i] = handlerData[indexReplacementMap[i]];
78
- }
79
- return [regexp, handlerMap, staticMap];
80
- }
81
23
  function findMiddleware(middleware, path) {
82
24
  if (!middleware) {
83
25
  return void 0;
@@ -93,9 +35,18 @@ var RegExpRouter = class {
93
35
  name = "RegExpRouter";
94
36
  #middleware;
95
37
  #routes;
38
+ #tries;
96
39
  constructor() {
97
40
  this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
98
41
  this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
42
+ this.#tries = { [METHOD_NAME_ALL]: new Trie() };
43
+ }
44
+ #insertPath(method, path) {
45
+ try {
46
+ this.#tries[method].insert(path, !/\*|\/:/.test(path));
47
+ } catch (e) {
48
+ throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
49
+ }
99
50
  }
100
51
  add(method, path, handler) {
101
52
  const middleware = this.#middleware;
@@ -104,11 +55,12 @@ var RegExpRouter = class {
104
55
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
105
56
  }
106
57
  if (!middleware[method]) {
107
- ;
58
+ this.#tries[method] = new Trie();
108
59
  [middleware, routes].forEach((handlerMap) => {
109
60
  handlerMap[method] = /* @__PURE__ */ Object.create(null);
110
61
  Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {
111
62
  handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
63
+ this.#insertPath(method, p);
112
64
  });
113
65
  });
114
66
  }
@@ -118,13 +70,12 @@ var RegExpRouter = class {
118
70
  const paramCount = (path.match(/\/:/g) || []).length;
119
71
  if (/\*$/.test(path)) {
120
72
  const re = buildWildcardRegExp(path);
121
- if (method === METHOD_NAME_ALL) {
122
- Object.keys(middleware).forEach((m) => {
123
- middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
124
- });
125
- } else {
126
- middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
127
- }
73
+ Object.keys(middleware).forEach((m) => {
74
+ if ((method === METHOD_NAME_ALL || method === m) && !middleware[m][path]) {
75
+ this.#insertPath(m, path);
76
+ middleware[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
77
+ }
78
+ });
128
79
  Object.keys(middleware).forEach((m) => {
129
80
  if (method === METHOD_NAME_ALL || method === m) {
130
81
  Object.keys(middleware[m]).forEach((p) => {
@@ -146,9 +97,12 @@ var RegExpRouter = class {
146
97
  const path2 = paths[i];
147
98
  Object.keys(routes).forEach((m) => {
148
99
  if (method === METHOD_NAME_ALL || method === m) {
149
- routes[m][path2] ||= [
150
- ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
151
- ];
100
+ if (!routes[m][path2]) {
101
+ this.#insertPath(m, path2);
102
+ routes[m][path2] = [
103
+ ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
104
+ ];
105
+ }
152
106
  routes[m][path2].push([handler, paramCount - len + i + 1]);
153
107
  }
154
108
  });
@@ -160,29 +114,54 @@ var RegExpRouter = class {
160
114
  Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((method) => {
161
115
  matchers[method] ||= this.#buildMatcher(method);
162
116
  });
163
- this.#middleware = this.#routes = void 0;
117
+ this.#middleware = this.#routes = this.#tries = void 0;
164
118
  clearWildcardRegExpCache();
165
119
  return matchers;
166
120
  }
167
121
  #buildMatcher(method) {
168
- const routes = [];
169
- let hasOwnRoute = method === METHOD_NAME_ALL;
170
- [this.#middleware, this.#routes].forEach((r) => {
171
- const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];
172
- if (ownRoute.length !== 0) {
173
- hasOwnRoute ||= true;
174
- routes.push(...ownRoute);
175
- } else if (method !== METHOD_NAME_ALL) {
176
- routes.push(
177
- ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]])
178
- );
122
+ const middleware = this.#middleware[method];
123
+ const routes = this.#routes[method];
124
+ const trie = this.#tries[method];
125
+ const staticMap = /* @__PURE__ */ Object.create(null);
126
+ const handlerData = [];
127
+ [middleware, routes].forEach((r) => {
128
+ for (const path in r) {
129
+ const handlers = r[path];
130
+ const pathData = trie.paths[path];
131
+ if (!pathData) {
132
+ staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
133
+ continue;
134
+ }
135
+ const paramAssoc = pathData[1];
136
+ handlerData[pathData[0]] = handlers.map(([h, paramCount]) => {
137
+ const paramIndexMap = /* @__PURE__ */ Object.create(null);
138
+ paramCount -= 1;
139
+ for (; paramCount >= 0; paramCount--) {
140
+ const [key, value] = paramAssoc[paramCount];
141
+ paramIndexMap[key] = value;
142
+ }
143
+ return [h, paramIndexMap];
144
+ });
179
145
  }
180
146
  });
181
- if (!hasOwnRoute) {
182
- return null;
183
- } else {
184
- return buildMatcherFromPreprocessedRoutes(routes);
147
+ const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
148
+ for (let i = 0, len = handlerData.length; i < len; i++) {
149
+ for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
150
+ const map = handlerData[i][j]?.[1];
151
+ if (!map) {
152
+ continue;
153
+ }
154
+ const keys = Object.keys(map);
155
+ for (let k = 0, len3 = keys.length; k < len3; k++) {
156
+ map[keys[k]] = paramReplacementMap[map[keys[k]]];
157
+ }
158
+ }
159
+ }
160
+ const handlerMap = [];
161
+ for (const i in indexReplacementMap) {
162
+ handlerMap[i] = handlerData[indexReplacementMap[i]];
185
163
  }
164
+ return [regexp, handlerMap, staticMap];
186
165
  }
187
166
  };
188
167
  export {
@@ -3,12 +3,20 @@ import { Node } from "./node.js";
3
3
  var Trie = class {
4
4
  #context = { varIndex: 0 };
5
5
  #root = new Node();
6
- insert(path, index, pathErrorCheckOnly) {
6
+ #index = 0;
7
+ // dynamic path -> [handler index, param assoc]; static paths are not registered
8
+ paths = /* @__PURE__ */ Object.create(null);
9
+ insert(path, isStatic) {
10
+ if (isStatic) {
11
+ this.#root.insert(path.split(""), 0, [], this.#context, true);
12
+ return;
13
+ }
7
14
  const paramAssoc = [];
8
15
  const groups = [];
16
+ let markedPath = path;
9
17
  for (let i = 0; ; ) {
10
18
  let replaced = false;
11
- path = path.replace(/\{[^}]+\}/g, (m) => {
19
+ markedPath = markedPath.replace(/\{[^}]+\}/g, (m) => {
12
20
  const mark = `@\\${i}`;
13
21
  groups[i] = [mark, m];
14
22
  i++;
@@ -19,7 +27,7 @@ var Trie = class {
19
27
  break;
20
28
  }
21
29
  }
22
- const tokens = path.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
30
+ const tokens = markedPath.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
23
31
  for (let i = groups.length - 1; i >= 0; i--) {
24
32
  const [mark] = groups[i];
25
33
  for (let j = tokens.length - 1; j >= 0; j--) {
@@ -29,8 +37,8 @@ var Trie = class {
29
37
  }
30
38
  }
31
39
  }
32
- this.#root.insert(tokens, index, paramAssoc, this.#context, pathErrorCheckOnly);
33
- return paramAssoc;
40
+ this.#root.insert(tokens, this.#index, paramAssoc, this.#context, false);
41
+ this.paths[path] = [this.#index++, paramAssoc];
34
42
  }
35
43
  buildRegExp() {
36
44
  let regexp = this.#root.buildRegExpStr();
@@ -2,76 +2,51 @@
2
2
  import { METHOD_NAME_ALL } from "../../router.js";
3
3
  import { getPattern, splitPath, splitRoutingPath } from "../../utils/url.js";
4
4
  var emptyParams = /* @__PURE__ */ Object.create(null);
5
- var hasChildren = (children) => {
6
- for (const _ in children) {
7
- return true;
8
- }
9
- return false;
10
- };
5
+ var order = 0;
11
6
  var Node = class _Node {
12
- #methods;
13
- #children;
14
- #patterns;
15
- #order = 0;
7
+ #methods = [];
8
+ #children = /* @__PURE__ */ Object.create(null);
9
+ #patterns = [];
10
+ #pattern;
16
11
  #params = emptyParams;
17
- constructor(method, handler, children) {
18
- this.#children = children || /* @__PURE__ */ Object.create(null);
19
- this.#methods = [];
20
- if (method && handler) {
21
- const m = /* @__PURE__ */ Object.create(null);
22
- m[method] = { handler, possibleKeys: [], score: 0 };
23
- this.#methods = [m];
24
- }
25
- this.#patterns = [];
26
- }
27
12
  insert(method, path, handler) {
28
- this.#order = ++this.#order;
29
13
  let curNode = this;
30
14
  const parts = splitRoutingPath(path);
31
- const possibleKeys = [];
32
- for (let i = 0, len = parts.length; i < len; i++) {
33
- const p = parts[i];
34
- const nextP = parts[i + 1];
35
- const pattern = getPattern(p, nextP);
36
- const key = Array.isArray(pattern) ? pattern[0] : p;
37
- if (key in curNode.#children) {
38
- curNode = curNode.#children[key];
39
- if (pattern) {
40
- possibleKeys.push(pattern[1]);
41
- }
42
- continue;
15
+ const possibleKeys = /* @__PURE__ */ new Set();
16
+ let i = 0;
17
+ for (const p of parts) {
18
+ const nextP = parts[++i];
19
+ const pattern = getPattern(p, nextP) || (nextP === void 0 && p && p.indexOf("*") === p.length - 1 ? p : null);
20
+ const isParam = Array.isArray(pattern);
21
+ const key = isParam ? pattern[0] : pattern || p;
22
+ const child = curNode.#children[key] ||= new _Node();
23
+ if (pattern && !child.#pattern) {
24
+ child.#pattern = pattern;
25
+ curNode.#patterns.push(child);
43
26
  }
44
- curNode.#children[key] = new _Node();
45
- if (pattern) {
46
- curNode.#patterns.push(pattern);
47
- possibleKeys.push(pattern[1]);
27
+ curNode = child;
28
+ if (isParam) {
29
+ possibleKeys.add(pattern[1]);
48
30
  }
49
- curNode = curNode.#children[key];
50
31
  }
51
32
  curNode.#methods.push({
52
33
  [method]: {
53
34
  handler,
54
- possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),
55
- score: this.#order
35
+ possibleKeys: [...possibleKeys],
36
+ score: ++order
56
37
  }
57
38
  });
58
- return curNode;
59
39
  }
60
40
  #pushHandlerSets(handlerSets, node, method, nodeParams, params) {
61
41
  for (let i = 0, len = node.#methods.length; i < len; i++) {
62
42
  const m = node.#methods[i];
63
43
  const handlerSet = m[method] || m[METHOD_NAME_ALL];
64
- const processedSet = {};
65
- if (handlerSet !== void 0) {
44
+ if (handlerSet) {
66
45
  handlerSet.params = /* @__PURE__ */ Object.create(null);
67
46
  handlerSets.push(handlerSet);
68
- if (nodeParams !== emptyParams || params && params !== emptyParams) {
69
- for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
70
- const key = handlerSet.possibleKeys[i2];
71
- const processed = processedSet[handlerSet.score];
72
- handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];
73
- processedSet[handlerSet.score] = true;
74
- }
47
+ for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
48
+ const key = handlerSet.possibleKeys[i2];
49
+ handlerSet.params[key] = params?.[key] && !i2 ? params[key] : nodeParams[key] ?? params?.[key];
75
50
  }
76
51
  }
77
52
  }
@@ -103,33 +78,33 @@ var Node = class _Node {
103
78
  tempNodes.push(nextNode);
104
79
  }
105
80
  }
106
- for (let k = 0, len3 = node.#patterns.length; k < len3; k++) {
107
- const pattern = node.#patterns[k];
81
+ for (const child of node.#patterns) {
82
+ const pattern = child.#pattern;
108
83
  const params = node.#params === emptyParams ? {} : { ...node.#params };
109
- if (pattern === "*") {
110
- const astNode = node.#children["*"];
111
- if (astNode) {
112
- this.#pushHandlerSets(handlerSets, astNode, method, node.#params);
113
- astNode.#params = params;
114
- tempNodes.push(astNode);
84
+ if (typeof pattern === "string") {
85
+ if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
86
+ this.#pushHandlerSets(handlerSets, child, method, node.#params);
87
+ if (pattern === "*") {
88
+ child.#params = params;
89
+ tempNodes.push(child);
90
+ }
115
91
  }
116
92
  continue;
117
93
  }
118
- const [key, name, matcher] = pattern;
119
- if (!part && !(matcher instanceof RegExp)) {
94
+ const [, name, matcher] = pattern;
95
+ if (!part && matcher === true) {
120
96
  continue;
121
97
  }
122
- const child = node.#children[key];
123
- if (matcher instanceof RegExp) {
124
- if (partOffsets === null) {
125
- partOffsets = new Array(len);
98
+ if (matcher !== true) {
99
+ if (!partOffsets) {
100
+ partOffsets = [];
126
101
  let offset = path[0] === "/" ? 1 : 0;
127
102
  for (let p = 0; p < len; p++) {
128
103
  partOffsets[p] = offset;
129
104
  offset += parts[p].length + 1;
130
105
  }
131
106
  }
132
- const restPathString = path.substring(partOffsets[i]);
107
+ const restPathString = path.slice(partOffsets[i]);
133
108
  const m = matcher.exec(restPathString);
134
109
  if (m) {
135
110
  params[name] = m[0];
@@ -143,11 +118,12 @@ var Node = class _Node {
143
118
  params
144
119
  );
145
120
  }
146
- if (hasChildren(child.#children)) {
121
+ for (const _ in child.#children) {
147
122
  child.#params = params;
148
- const componentCount = m[0].match(/\//)?.length ?? 0;
123
+ const componentCount = m[0].match(/\//g)?.length ?? 0;
149
124
  const targetCurNodes = curNodesQueue[componentCount] ||= [];
150
125
  targetCurNodes.push(child);
126
+ break;
151
127
  }
152
128
  continue;
153
129
  }
@@ -175,7 +151,7 @@ var Node = class _Node {
175
151
  const shifted = curNodesQueue.shift();
176
152
  curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
177
153
  }
178
- if (handlerSets.length > 1) {
154
+ if (handlerSets[1]) {
179
155
  handlerSets.sort((a, b) => {
180
156
  return a.score - b.score;
181
157
  });
@@ -3,19 +3,11 @@ import { checkOptionalParameter } from "../../utils/url.js";
3
3
  import { Node } from "./node.js";
4
4
  var TrieRouter = class {
5
5
  name = "TrieRouter";
6
- #node;
7
- constructor() {
8
- this.#node = new Node();
9
- }
6
+ #node = new Node();
10
7
  add(method, path, handler) {
11
- const results = checkOptionalParameter(path);
12
- if (results) {
13
- for (let i = 0, len = results.length; i < len; i++) {
14
- this.#node.insert(method, results[i], handler);
15
- }
16
- return;
8
+ for (const result of checkOptionalParameter(path) || [path]) {
9
+ this.#node.insert(method, result, handler);
17
10
  }
18
- this.#node.insert(method, path, handler);
19
11
  }
20
12
  match(method, path) {
21
13
  return this.#node.search(method, path);
@@ -1,7 +1,7 @@
1
1
  // src/router.ts
2
2
  var METHOD_NAME_ALL = "ALL";
3
3
  var METHOD_NAME_ALL_LOWERCASE = "all";
4
- var METHODS = ["get", "post", "put", "delete", "options", "patch"];
4
+ var METHODS = ["get", "post", "put", "delete", "options", "patch", "query"];
5
5
  var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
6
6
  var UnsupportedPathError = class extends Error {
7
7
  };
@@ -10,7 +10,7 @@ import type { HasRequiredKeys } from '../utils/types';
10
10
  type MethodNameAll = `$${typeof METHOD_NAME_ALL_LOWERCASE}`;
11
11
  /**
12
12
  * Type representing all standard HTTP methods prefixed with '$'
13
- * e.g., '$get' | '$post' | '$put' | '$delete' | '$options' | '$patch'
13
+ * e.g., '$get' | '$post' | '$put' | '$delete' | '$options' | '$patch' | '$query'
14
14
  */
15
15
  type StandardMethods = `$${(typeof METHODS)[number]}`;
16
16
  /**
@@ -323,6 +323,10 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
323
323
  * c.header('X-Message', 'Hello!')
324
324
  * c.header('Content-Type', 'text/plain')
325
325
  *
326
+ * // Append multiple headers using the append option (e.g. Vary)
327
+ * c.header('Vary', 'Accept-Encoding', { append: true })
328
+ * c.header('Vary', 'User-Agent', { append: true })
329
+ *
326
330
  * return c.body('Thank you for coming')
327
331
  * })
328
332
  * ```
@@ -65,6 +65,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
65
65
  delete: HandlerInterface<E, 'delete', S, BasePath, CurrentPath>;
66
66
  options: HandlerInterface<E, 'options', S, BasePath, CurrentPath>;
67
67
  patch: HandlerInterface<E, 'patch', S, BasePath, CurrentPath>;
68
+ query: HandlerInterface<E, 'query', S, BasePath, CurrentPath>;
68
69
  all: HandlerInterface<E, 'all', S, BasePath, CurrentPath>;
69
70
  on: OnHandlerInterface<E, S, BasePath>;
70
71
  use: MiddlewareHandlerInterface<E, S, BasePath>;
@@ -179,12 +180,12 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
179
180
  * @see {@link https://hono.dev/docs/api/hono#fetch}
180
181
  *
181
182
  * @param {Request} request - request Object of request
182
- * @param {Env} Env - env Object
183
- * @param {ExecutionContext} - context of execution
183
+ * @param {Env} env - env Object
184
+ * @param {ExecutionContext} executionCtx - context of execution
184
185
  * @returns {Response | Promise<Response>} response of request
185
186
  *
186
187
  */
187
- fetch: (request: Request, Env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
188
+ fetch: (request: Request, env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
188
189
  /**
189
190
  * `.request()` is a useful method for testing.
190
191
  * You can pass a URL or pathname to send a GET request.
@@ -3,14 +3,16 @@ import { DOM_MEMO } from './constants';
3
3
  import type { Context } from './context';
4
4
  import type { JSX as HonoJSX, IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements';
5
5
  export type Props = Record<string, any>;
6
+ type FunctionComponentResult = HtmlEscapedString | Child[] | Promise<HtmlEscapedString | Child[]> | null;
6
7
  export type FC<P = Props> = {
7
- (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null;
8
+ (props: P): FunctionComponentResult;
8
9
  defaultProps?: Partial<P> | undefined;
9
10
  displayName?: string | undefined;
10
11
  };
11
12
  export type DOMAttributes = HonoJSX.HTMLAttributes;
12
13
  export declare namespace JSX {
13
14
  type Element = HtmlEscapedString | Promise<HtmlEscapedString>;
15
+ type ElementType = string | ((props: never) => FunctionComponentResult);
14
16
  interface ElementChildrenAttribute {
15
17
  children: Child;
16
18
  }
@@ -30,7 +32,6 @@ export declare class JSXNode implements HtmlEscaped {
30
32
  key?: string;
31
33
  children: Child[];
32
34
  isEscaped: true;
33
- suspendedContext?: <T>(callback: () => T) => T;
34
35
  constructor(tag: string | Function, props: Props, children: Child[]);
35
36
  get type(): string | Function;
36
37
  get ref(): any;
@@ -54,3 +55,4 @@ export declare const Fragment: ({ children, }: {
54
55
  export declare const isValidElement: (element: unknown) => element is JSXNode;
55
56
  export declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]) => T;
56
57
  export declare const reactAPICompatVersion = "19.0.0-hono-jsx";
58
+ export {};
@@ -24,7 +24,7 @@ declare const _default: {
24
24
  <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
25
25
  };
26
26
  useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
27
- useRef: <T>(initialValue: T | null) => import("..").RefObject<T>;
27
+ useRef: typeof useRef;
28
28
  useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
29
29
  use: <T>(promise: Promise<T>) => T;
30
30
  startTransition: (callback: () => void) => void;
@@ -38,11 +38,11 @@ declare const _default: {
38
38
  useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
39
39
  useId: () => string;
40
40
  useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
41
- createRef: <T>() => import("..").RefObject<T>;
42
- forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T>) => JSX.Element) => ((props: P & {
43
- ref?: import("..").RefObject<T>;
41
+ createRef: <T>() => import("..").RefObject<T | null>;
42
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T | null>) => JSX.Element) => ((props: P & {
43
+ ref?: import("..").RefObject<T | null>;
44
44
  }) => JSX.Element);
45
- useImperativeHandle: <T>(ref: import("..").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
45
+ useImperativeHandle: <T>(ref: import("..").RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
46
46
  useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
47
47
  useFormStatus: () => {
48
48
  pending: false;
@@ -1,7 +1,7 @@
1
1
  import type { IntrinsicElements } from '../../intrinsic-elements';
2
2
  import type { FC, PropsWithChildren, RefObject } from '../../types';
3
3
  export declare const clearCache: () => void;
4
- export declare const composeRef: <T>(ref: RefObject<T> | Function | undefined, cb: (e: T) => void | (() => void)) => ((e: T) => () => void);
4
+ export declare const composeRef: <T>(ref: RefObject<T | null> | Function | undefined, cb: (e: T) => void | (() => void)) => ((e: T) => () => void);
5
5
  export declare const title: FC<PropsWithChildren>;
6
6
  export declare const script: FC<PropsWithChildren<IntrinsicElements['script']>>;
7
7
  export declare const style: FC<PropsWithChildren<IntrinsicElements['style']>>;
@@ -10,7 +10,7 @@ export declare const meta: FC<PropsWithChildren>;
10
10
  export declare const form: FC<PropsWithChildren<{
11
11
  action?: Function | string;
12
12
  method?: 'get' | 'post';
13
- ref?: RefObject<HTMLFormElement> | ((e: HTMLFormElement | null) => void | (() => void));
13
+ ref?: RefObject<HTMLFormElement | null> | ((e: HTMLFormElement | null) => void | (() => void));
14
14
  }>>;
15
15
  export declare const input: FC<PropsWithChildren<IntrinsicElements['input']>>;
16
16
  export declare const button: FC<PropsWithChildren<IntrinsicElements['button']>>;
@@ -43,7 +43,7 @@ declare const _default: {
43
43
  <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
44
44
  };
45
45
  useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
46
- useRef: <T>(initialValue: T | null) => import("..").RefObject<T>;
46
+ useRef: typeof import("..").useRef;
47
47
  useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
48
48
  use: <T>(promise: Promise<T>) => T;
49
49
  startTransition: (callback: () => void) => void;
@@ -57,11 +57,11 @@ declare const _default: {
57
57
  useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
58
58
  useId: () => string;
59
59
  useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
60
- createRef: <T>() => import("..").RefObject<T>;
61
- forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T>) => import("./jsx-dev-runtime").JSX.Element) => ((props: P & {
62
- ref?: import("..").RefObject<T>;
60
+ createRef: <T>() => import("..").RefObject<T | null>;
61
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T | null>) => import("./jsx-dev-runtime").JSX.Element) => ((props: P & {
62
+ ref?: import("..").RefObject<T | null>;
63
63
  }) => import("./jsx-dev-runtime").JSX.Element);
64
- useImperativeHandle: <T>(ref: import("..").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
64
+ useImperativeHandle: <T>(ref: import("..").RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
65
65
  useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
66
66
  useFormStatus: () => {
67
67
  pending: false;
@@ -29,17 +29,19 @@ export declare const useLayoutEffect: (effect: () => void | (() => void), deps?:
29
29
  export declare const useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
30
30
  export declare const useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
31
31
  export type RefObject<T> = {
32
- current: T | null;
32
+ current: T;
33
33
  };
34
- export declare const useRef: <T>(initialValue: T | null) => RefObject<T>;
34
+ export declare function useRef<T>(initialValue: T): RefObject<T>;
35
+ export declare function useRef<T>(initialValue: T | null): RefObject<T | null>;
36
+ export declare function useRef<T>(initialValue: T | undefined): RefObject<T | undefined>;
35
37
  export declare const use: <T>(promise: Promise<T>) => T;
36
38
  export declare const useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
37
39
  export declare const useId: () => string;
38
40
  export declare const useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
39
- export declare const createRef: <T>() => RefObject<T>;
40
- export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T>) => JSX.Element) => ((props: P & {
41
- ref?: RefObject<T>;
41
+ export declare const createRef: <T>() => RefObject<T | null>;
42
+ export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T | null>) => JSX.Element) => ((props: P & {
43
+ ref?: RefObject<T | null>;
42
44
  }) => JSX.Element);
43
- export declare const useImperativeHandle: <T>(ref: RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
45
+ export declare const useImperativeHandle: <T>(ref: RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
44
46
  export declare const useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
45
47
  export {};