acrylblends 0.6.1 → 0.6.2

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 (119) hide show
  1. package/README.md +8 -6
  2. package/docs/framework/UPSTREAM.md +1 -1
  3. package/docs/framework/api/presets.md +0 -3
  4. package/docs/framework/cordis/acryl-in-a-cordis-app.md +3 -0
  5. package/docs/framework/getting-started/basic.md +4 -4
  6. package/docs/framework/guides/jsx.md +1 -1
  7. package/docs/framework/guides/middleware.md +1 -1
  8. package/docs/framework/helpers/cookie.md +1 -1
  9. package/docs/framework/helpers/dev.md +0 -3
  10. package/docs/framework/helpers/jwt.md +1 -1
  11. package/docs/framework/helpers/proxy.md +0 -3
  12. package/docs/framework/middleware/builtin/basic-auth.md +6 -6
  13. package/docs/framework/middleware/builtin/cache.md +0 -3
  14. package/docs/framework/middleware/builtin/combine.md +1 -1
  15. package/docs/framework/middleware/builtin/ip-restriction.md +1 -1
  16. package/docs/framework/middleware/builtin/logger.md +1 -1
  17. package/docs/framework/middleware/builtin/mount.md +0 -3
  18. package/docs/framework/upstream.json +2 -2
  19. package/lib/accepts.d.ts +1 -1
  20. package/lib/acryl-base.d.ts +1 -1
  21. package/lib/adapter.d.ts +1 -1
  22. package/lib/{app-CmAYW1Al.d.ts → app-BdrVHBlJ.d.ts} +1 -1
  23. package/lib/basic-auth.d.ts +1 -1
  24. package/lib/bearer-auth.d.ts +1 -1
  25. package/lib/body-limit.d.ts +1 -1
  26. package/lib/cache.d.ts +43 -0
  27. package/lib/cache.js +169 -0
  28. package/lib/client.d.ts +2 -2
  29. package/lib/combine.d.ts +1 -1
  30. package/lib/compress.d.ts +1 -1
  31. package/lib/conninfo.d.ts +2 -2
  32. package/lib/{context-Bm7rI-oK.d.ts → context-B5Y1lLha.d.ts} +1 -1
  33. package/lib/context-storage.d.ts +1 -1
  34. package/lib/{cookie-ClMaKDQf.d.ts → cookie-D9_nQbsM.d.ts} +1 -1
  35. package/lib/cookie.d.ts +3 -3
  36. package/lib/cors.d.ts +1 -1
  37. package/lib/csrf.d.ts +1 -1
  38. package/lib/dev.d.ts +19 -0
  39. package/lib/dev.js +50 -0
  40. package/lib/etag.d.ts +1 -1
  41. package/lib/factory.d.ts +2 -2
  42. package/lib/{index-B-3F4wt2.d.ts → index-DtEoak1i.d.ts} +2 -2
  43. package/lib/{index-UTBmM3GX.d.ts → index-Kqou8Fjh.d.ts} +2 -2
  44. package/lib/{index-oOClm_Xk.d.ts → index-m12zcmph.d.ts} +3 -3
  45. package/lib/index.d.ts +4 -4
  46. package/lib/ip-restriction.d.ts +2 -2
  47. package/lib/jwk.d.ts +4 -4
  48. package/lib/{jwt-Dg493Tai.d.ts → jwt-BA65QhnJ.d.ts} +1 -1
  49. package/lib/jwt.d.ts +4 -4
  50. package/lib/language.d.ts +1 -1
  51. package/lib/linear-router-C3FPib6h.js +96 -0
  52. package/lib/logger.d.ts +1 -1
  53. package/lib/loopback-only.d.ts +1 -1
  54. package/lib/method-not-allowed.d.ts +2 -2
  55. package/lib/method-override.d.ts +2 -2
  56. package/lib/mount.d.ts +44 -0
  57. package/lib/mount.js +67 -0
  58. package/lib/node-server/conninfo.d.ts +1 -1
  59. package/lib/node-server/serve-static.d.ts +1 -1
  60. package/lib/node-server.d.ts +1 -1
  61. package/lib/pattern-router-HZxjDGEQ.js +41 -0
  62. package/lib/powered-by.d.ts +1 -1
  63. package/lib/pretty-json.d.ts +1 -1
  64. package/lib/proxy.d.ts +72 -0
  65. package/lib/proxy.js +121 -0
  66. package/lib/quick.d.ts +8 -0
  67. package/lib/quick.js +17 -0
  68. package/lib/request-id.d.ts +1 -1
  69. package/lib/request.d.ts +1 -1
  70. package/lib/route.d.ts +1 -1
  71. package/lib/router/linear-router.js +1 -95
  72. package/lib/router/pattern-router.js +1 -40
  73. package/lib/schema-validator.d.ts +1 -1
  74. package/lib/secure-headers.d.ts +1 -1
  75. package/lib/serve-static.d.ts +1 -1
  76. package/lib/streaming.d.ts +1 -1
  77. package/lib/testing.d.ts +4 -4
  78. package/lib/timeout.d.ts +1 -1
  79. package/lib/timing.d.ts +1 -1
  80. package/lib/tiny.d.ts +8 -0
  81. package/lib/tiny.js +15 -0
  82. package/lib/trailing-slash.d.ts +1 -1
  83. package/lib/{types-CHesD1KG.d.ts → types-Bd29gh2o.d.ts} +3 -3
  84. package/lib/{types-CwrQjlaM.d.ts → types-D9DEXMjE.d.ts} +3 -1
  85. package/lib/{types-CDO6I3B0.d.ts → types-ZM9gIiKh.d.ts} +1 -1
  86. package/lib/types.d.ts +1 -1
  87. package/lib/utils/body.d.ts +1 -1
  88. package/lib/utils/cookie.d.ts +1 -1
  89. package/lib/utils/crypto.d.ts +1 -1
  90. package/lib/utils/ipaddr.d.ts +1 -1
  91. package/lib/utils/jwt.d.ts +1 -1
  92. package/lib/utils/types.d.ts +2 -2
  93. package/lib/validator.d.ts +2 -2
  94. package/lib/ws.d.ts +1 -1
  95. package/package.json +25 -1
  96. package/plugins/acryl-inspect/upstream.json +1 -1
  97. package/plugins/acryl-node-server/upstream.json +1 -1
  98. package/plugins/acryl-router/src/core/helper/dev/index.test.ts +181 -0
  99. package/plugins/acryl-router/src/core/helper/dev/index.ts +79 -0
  100. package/plugins/acryl-router/src/core/helper/proxy/index.test.ts +356 -0
  101. package/plugins/acryl-router/src/core/helper/proxy/index.ts +203 -0
  102. package/plugins/acryl-router/src/core/middleware/cache/index.test.ts +1211 -0
  103. package/plugins/acryl-router/src/core/middleware/cache/index.ts +323 -0
  104. package/plugins/acryl-router/src/core/middleware/mount/index.test.ts +334 -0
  105. package/plugins/acryl-router/src/core/middleware/mount/index.ts +108 -0
  106. package/plugins/acryl-router/src/core/preset/quick.test.ts +42 -0
  107. package/plugins/acryl-router/src/core/preset/quick.ts +24 -0
  108. package/plugins/acryl-router/src/core/preset/tiny.test.ts +42 -0
  109. package/plugins/acryl-router/src/core/preset/tiny.ts +20 -0
  110. package/plugins/acryl-router/src/core/utils/types.ts +3 -0
  111. package/plugins/acryl-router/src/helpers/index.ts +2 -0
  112. package/plugins/acryl-router/src/middleware/index.ts +2 -0
  113. package/plugins/acryl-router/src/service.ts +22 -5
  114. package/plugins/acryl-router/upstream.json +2 -2
  115. package/plugins/acryl-router-http/upstream.json +1 -1
  116. package/plugins/acryl-state/upstream.json +1 -1
  117. package/plugins/desktop/upstream.json +1 -1
  118. package/plugins/desktop-web/upstream.json +1 -1
  119. package/templates/todo/upstream.json +1 -1
package/lib/proxy.js ADDED
@@ -0,0 +1,121 @@
1
+ import { HTTPException } from "./http-exception.js";
2
+ //#region ../../plugins/acryl-router/src/core/helper/proxy/index.ts
3
+ /**
4
+ * @module
5
+ * Proxy Helper for Acryl.
6
+ */
7
+ const hopByHopHeaders = [
8
+ "connection",
9
+ "keep-alive",
10
+ "proxy-authenticate",
11
+ "proxy-authorization",
12
+ "te",
13
+ "trailer",
14
+ "transfer-encoding",
15
+ "upgrade"
16
+ ];
17
+ const ALLOWED_TOKEN_PATTERN = /^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/;
18
+ const buildRequestInitFromRequest = (request, strictConnectionProcessing) => {
19
+ if (!request) return {};
20
+ const headers = new Headers(request.headers);
21
+ if (strictConnectionProcessing) {
22
+ const connectionValue = headers.get("connection");
23
+ if (connectionValue) {
24
+ const headerNames = connectionValue.split(",").map((h) => h.trim());
25
+ const invalidHeaders = headerNames.filter((h) => !ALLOWED_TOKEN_PATTERN.test(h));
26
+ if (invalidHeaders.length > 0) throw new HTTPException(400, { message: `Invalid Connection header value: ${invalidHeaders.join(", ")}` });
27
+ headerNames.forEach((headerName) => {
28
+ headers.delete(headerName);
29
+ });
30
+ }
31
+ }
32
+ hopByHopHeaders.forEach((header) => {
33
+ headers.delete(header);
34
+ });
35
+ return {
36
+ method: request.method,
37
+ body: request.body,
38
+ duplex: request.body ? "half" : void 0,
39
+ headers,
40
+ signal: request.signal
41
+ };
42
+ };
43
+ const preprocessRequestInit = (requestInit) => {
44
+ if (!requestInit.headers || Array.isArray(requestInit.headers) || requestInit.headers instanceof Headers) return requestInit;
45
+ const headers = new Headers();
46
+ for (const [key, value] of Object.entries(requestInit.headers)) if (value == null) headers.delete(key);
47
+ else headers.set(key, value);
48
+ requestInit.headers = headers;
49
+ return requestInit;
50
+ };
51
+ /**
52
+ * Fetch API wrapper for proxy.
53
+ * The parameters and return value are the same as for `fetch` (except for the proxy-specific options).
54
+ *
55
+ * The "Accept-Encoding" header is replaced with an encoding that the current runtime can handle.
56
+ * Unnecessary response headers are deleted and a Response object is returned that can be returned
57
+ * as is as a response from the handler.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * app.get('/proxy/:path', (c) => {
62
+ * return proxy(`http://${originServer}/${c.req.param('path')}`, {
63
+ * headers: {
64
+ * ...c.req.header(), // optional, specify only when forwarding all the request data (including credentials) is necessary.
65
+ * 'X-Forwarded-For': '127.0.0.1',
66
+ * 'X-Forwarded-Host': c.req.header('host'),
67
+ * Authorization: undefined, // do not propagate request headers contained in c.req.header('Authorization')
68
+ * },
69
+ * }).then((res) => {
70
+ * res.headers.delete('Set-Cookie')
71
+ * return res
72
+ * })
73
+ * })
74
+ *
75
+ * app.all('/proxy/:path', (c) => {
76
+ * return proxy(`http://${originServer}/${c.req.param('path')}`, {
77
+ * ...c.req, // optional, specify only when forwarding all the request data (including credentials) is necessary.
78
+ * headers: {
79
+ * ...c.req.header(),
80
+ * 'X-Forwarded-For': '127.0.0.1',
81
+ * 'X-Forwarded-Host': c.req.header('host'),
82
+ * Authorization: undefined, // do not propagate request headers contained in c.req.header('Authorization')
83
+ * },
84
+ * })
85
+ * })
86
+ *
87
+ * // Strict RFC compliance mode (use only in trusted environments)
88
+ * app.get('/internal-proxy/:path', (c) => {
89
+ * return proxy(`http://${internalServer}/${c.req.param('path')}`, {
90
+ * ...c.req,
91
+ * strictConnectionProcessing: true,
92
+ * })
93
+ * })
94
+ * ```
95
+ */
96
+ const proxy = async (input, proxyInit) => {
97
+ const { raw, customFetch, strictConnectionProcessing = false, ...requestInit } = proxyInit instanceof Request ? { raw: proxyInit } : proxyInit ?? {};
98
+ const req = new Request(input, {
99
+ ...buildRequestInitFromRequest(raw, strictConnectionProcessing),
100
+ ...preprocessRequestInit(requestInit)
101
+ });
102
+ req.headers.delete("accept-encoding");
103
+ const res = await (customFetch || fetch)(req);
104
+ const resHeaders = new Headers(res.headers);
105
+ const connectionValue = resHeaders.get("connection");
106
+ if (connectionValue) connectionValue.split(",").map((h) => h.trim()).filter((h) => ALLOWED_TOKEN_PATTERN.test(h)).forEach((h) => resHeaders.delete(h));
107
+ hopByHopHeaders.forEach((header) => {
108
+ resHeaders.delete(header);
109
+ });
110
+ if (resHeaders.has("content-encoding")) {
111
+ resHeaders.delete("content-encoding");
112
+ resHeaders.delete("content-length");
113
+ }
114
+ return new Response(res.body, {
115
+ status: res.status,
116
+ statusText: res.statusText,
117
+ headers: resHeaders
118
+ });
119
+ };
120
+ //#endregion
121
+ export { proxy };
package/lib/quick.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { $ as Acryl$1, J as Schema, _ as Env, et as AcrylOptions, h as BlankSchema, p as BlankEnv } from "./context-B5Y1lLha.js";
2
+
3
+ //#region ../../plugins/acryl-router/src/core/preset/quick.d.ts
4
+ declare class Acryl<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = '/'> extends Acryl$1<E, S, BasePath> {
5
+ constructor(options?: AcrylOptions<E>);
6
+ }
7
+ //#endregion
8
+ export { Acryl };
package/lib/quick.js ADDED
@@ -0,0 +1,17 @@
1
+ import { AcrylBase as Acryl$1 } from "./acryl-base.js";
2
+ import { t as SmartRouter } from "./smart-router-C5CZ5XSM.js";
3
+ import { t as TrieRouter } from "./trie-router-CfFbapzL.js";
4
+ import { t as LinearRouter } from "./linear-router-C3FPib6h.js";
5
+ //#region ../../plugins/acryl-router/src/core/preset/quick.ts
6
+ /**
7
+ * @module
8
+ * The preset that uses `LinearRouter`.
9
+ */
10
+ var Acryl = class extends Acryl$1 {
11
+ constructor(options = {}) {
12
+ super(options);
13
+ this.router = new SmartRouter({ routers: [new LinearRouter(), new TrieRouter()] });
14
+ }
15
+ };
16
+ //#endregion
17
+ export { Acryl };
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, t as Context } from "./context-Bm7rI-oK.js";
1
+ import { I as MiddlewareHandler, t as Context } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/middleware/request-id/request-id.d.ts
4
4
  type RequestIdVariables = {
package/lib/request.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { o as AcrylRequest, s as cloneRawRequest } from "./context-Bm7rI-oK.js";
1
+ import { o as AcrylRequest, s as cloneRawRequest } from "./context-B5Y1lLha.js";
2
2
  export { AcrylRequest, cloneRawRequest };
package/lib/route.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { q as RouterRoute, t as Context } from "./context-Bm7rI-oK.js";
1
+ import { q as RouterRoute, t as Context } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/helper/route/index.d.ts
4
4
  /**
@@ -1,96 +1,2 @@
1
- import { checkOptionalParameter } from "../utils/url.js";
2
- import { UnsupportedPathError } from "../router.js";
3
- //#region ../../plugins/acryl-router/src/core/router/linear-router/router.ts
4
- const emptyParams = Object.create(null);
5
- const splitPathRe = /\/(:\w+(?:{(?:(?:{[\d,]+})|[^}])+})?)|\/[^\/\?]+|(\?)/g;
6
- const splitByStarRe = /\*/;
7
- var LinearRouter = class {
8
- name = "LinearRouter";
9
- #routes = [];
10
- add(method, path, handler) {
11
- for (let i = 0, paths = checkOptionalParameter(path) || [path], len = paths.length; i < len; i++) this.#routes.push([
12
- method,
13
- paths[i],
14
- handler
15
- ]);
16
- }
17
- match(method, path) {
18
- const handlers = [];
19
- ROUTES_LOOP: for (let i = 0, len = this.#routes.length; i < len; i++) {
20
- const [routeMethod, routePath, handler] = this.#routes[i];
21
- if (routeMethod === method || routeMethod === "ALL") {
22
- if (routePath === "*" || routePath === "/*") {
23
- handlers.push([handler, emptyParams]);
24
- continue;
25
- }
26
- const hasStar = routePath.indexOf("*") !== -1;
27
- const hasLabel = routePath.indexOf(":") !== -1;
28
- if (!hasStar && !hasLabel) {
29
- if (routePath === path || routePath + "/" === path) handlers.push([handler, emptyParams]);
30
- } else if (hasStar && !hasLabel) {
31
- const endsWithStar = routePath.charCodeAt(routePath.length - 1) === 42;
32
- const endsWithSlashStar = routePath.endsWith("/*");
33
- const parts = (endsWithStar ? routePath.slice(0, endsWithSlashStar ? -2 : -1) : routePath).split(splitByStarRe);
34
- const lastIndex = parts.length - 1;
35
- for (let j = 0, pos = 0, len = parts.length; j < len; j++) {
36
- const part = parts[j];
37
- if (path.indexOf(part, pos) !== pos) continue ROUTES_LOOP;
38
- pos += part.length;
39
- if (j === lastIndex) {
40
- if (endsWithSlashStar) {
41
- if (pos !== path.length && path.charCodeAt(pos) !== 47) continue ROUTES_LOOP;
42
- } else if (!endsWithStar && pos !== path.length && !(pos === path.length - 1 && path.charCodeAt(pos) === 47)) continue ROUTES_LOOP;
43
- } else {
44
- const index = path.indexOf("/", pos);
45
- if (index === -1) continue ROUTES_LOOP;
46
- pos = index;
47
- }
48
- }
49
- handlers.push([handler, emptyParams]);
50
- } else if (hasLabel && !hasStar) {
51
- const params = Object.create(null);
52
- const parts = routePath.match(splitPathRe);
53
- const lastIndex = parts.length - 1;
54
- for (let j = 0, pos = 0, len = parts.length; j < len; j++) {
55
- if (pos === -1 || pos >= path.length) continue ROUTES_LOOP;
56
- const part = parts[j];
57
- if (part.charCodeAt(1) === 58) {
58
- if (path.charCodeAt(pos) !== 47) continue ROUTES_LOOP;
59
- let name = part.slice(2);
60
- let value;
61
- if (name.charCodeAt(name.length - 1) === 125) {
62
- const openBracePos = name.indexOf("{");
63
- const next = parts[j + 1];
64
- const lookahead = next && next[1] !== ":" && next[1] !== "*" ? `(?=${next})` : "";
65
- const pattern = name.slice(openBracePos + 1, -1) + lookahead;
66
- const restPath = path.slice(pos + 1);
67
- const match = new RegExp(pattern, "d").exec(restPath);
68
- if (!match || match.indices[0][0] !== 0 || match.indices[0][1] === 0) continue ROUTES_LOOP;
69
- name = name.slice(0, openBracePos);
70
- value = restPath.slice(...match.indices[0]);
71
- pos += match.indices[0][1] + 1;
72
- } else {
73
- let endValuePos = path.indexOf("/", pos + 1);
74
- if (endValuePos === -1) endValuePos = path.length;
75
- if (endValuePos === pos + 1) continue ROUTES_LOOP;
76
- value = path.slice(pos + 1, endValuePos);
77
- pos = endValuePos;
78
- }
79
- params[name] ||= value;
80
- } else {
81
- if (path.indexOf(part, pos) !== pos) continue ROUTES_LOOP;
82
- pos += part.length;
83
- }
84
- if (j === lastIndex) {
85
- if (pos !== path.length && !(pos === path.length - 1 && path.charCodeAt(pos) === 47)) continue ROUTES_LOOP;
86
- }
87
- }
88
- handlers.push([handler, params]);
89
- } else if (hasLabel && hasStar) throw new UnsupportedPathError();
90
- }
91
- }
92
- return [handlers];
93
- }
94
- };
95
- //#endregion
1
+ import { t as LinearRouter } from "../linear-router-C3FPib6h.js";
96
2
  export { LinearRouter };
@@ -1,41 +1,2 @@
1
- import { UnsupportedPathError } from "../router.js";
2
- //#region ../../plugins/acryl-router/src/core/router/pattern-router/router.ts
3
- const emptyParams = Object.create(null);
4
- var PatternRouter = class {
5
- name = "PatternRouter";
6
- #routes = [];
7
- add(method, path, handler) {
8
- const suffix = path.endsWith("/*") ? "(?:$|/)" : path.endsWith("*") ? "" : "/?$";
9
- path = path.replace(/\*$/, "");
10
- if (path.at(-1) === "?") {
11
- path = path.slice(0, -1);
12
- this.add(method, path.replace(/\/[^/]+$/, ""), handler);
13
- }
14
- const parts = (path.match(/\/?(:\w+(?:{(?:(?:{[\d,]+})|[^}])+})?)|\/?[^\/\?]+/g) || []).map((part) => {
15
- const match = part.match(/^\/:([^{]+)(?:{(.*)})?/);
16
- return match ? `/(?<${match[1]}>${match[2] || "[^/]+"})` : part === "/*" ? "/[^/]+" : part.replace(/[.\\+*[^\]$()]/g, "\\$&");
17
- });
18
- try {
19
- this.#routes.push([
20
- new RegExp(`^${parts.join("")}${suffix}`),
21
- method,
22
- handler
23
- ]);
24
- } catch {
25
- throw new UnsupportedPathError();
26
- }
27
- }
28
- match(method, path) {
29
- const handlers = [];
30
- for (let i = 0, len = this.#routes.length; i < len; i++) {
31
- const [pattern, routeMethod, handler] = this.#routes[i];
32
- if (routeMethod === method || routeMethod === "ALL") {
33
- const match = pattern.exec(path);
34
- if (match) handlers.push([handler, match.groups || emptyParams]);
35
- }
36
- }
37
- return [handlers];
38
- }
39
- };
40
- //#endregion
1
+ import { t as PatternRouter } from "../pattern-router-HZxjDGEQ.js";
41
2
  export { PatternRouter };
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, Z as ValidationTargets, _ as Env } from "./context-Bm7rI-oK.js";
1
+ import { I as MiddlewareHandler, Z as ValidationTargets, _ as Env } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/helpers/schema-validator.d.ts
4
4
  /** The slice of the Standard Schema interface this needs; Schemastery (what Cordis uses), Zod and Valibot all implement it. */
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, t as Context } from "./context-Bm7rI-oK.js";
1
+ import { I as MiddlewareHandler, t as Context } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/middleware/secure-headers/permissions-policy.d.ts
4
4
  type PermissionsPolicyDirective = StandardizedFeatures | ProposedFeatures | ExperimentalFeatures;
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, _ as Env, i as Data, t as Context } from "./context-Bm7rI-oK.js";
1
+ import { I as MiddlewareHandler, _ as Env, i as Data, t as Context } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/middleware/serve-static/index.d.ts
4
4
  type ServeStaticOptions<E extends Env = Env> = {
@@ -1,4 +1,4 @@
1
- import { t as Context } from "./context-Bm7rI-oK.js";
1
+ import { t as Context } from "./context-B5Y1lLha.js";
2
2
  import { t as StreamingApi } from "./stream-CPdqZ0Fp.js";
3
3
 
4
4
  //#region ../../plugins/acryl-router/src/core/helper/streaming/stream.d.ts
package/lib/testing.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { J as Schema, a as ExecutionContext } from "./context-Bm7rI-oK.js";
2
- import { T as UnionToIntersection } from "./types-CwrQjlaM.js";
3
- import { t as Acryl } from "./app-CmAYW1Al.js";
4
- import { i as ClientRequestOptions, n as Client } from "./types-CHesD1KG.js";
1
+ import { J as Schema, a as ExecutionContext } from "./context-B5Y1lLha.js";
2
+ import { E as UnionToIntersection } from "./types-D9DEXMjE.js";
3
+ import { t as Acryl } from "./app-BdrVHBlJ.js";
4
+ import { i as ClientRequestOptions, n as Client } from "./types-Bd29gh2o.js";
5
5
 
6
6
  //#region ../../plugins/acryl-router/src/core/helper/testing/index.d.ts
7
7
  type ExtractEnv<T> = T extends Acryl<infer E, Schema, string> ? E : never;
package/lib/timeout.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, t as Context } from "./context-Bm7rI-oK.js";
1
+ import { I as MiddlewareHandler, t as Context } from "./context-B5Y1lLha.js";
2
2
  import { HTTPException } from "./http-exception.js";
3
3
 
4
4
  //#region ../../plugins/acryl-router/src/core/middleware/timeout/index.d.ts
package/lib/timing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler, t as Context } from "./context-Bm7rI-oK.js";
1
+ import { I as MiddlewareHandler, t as Context } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/middleware/timing/timing.d.ts
4
4
  type TimingVariables = {
package/lib/tiny.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { $ as Acryl$1, J as Schema, _ as Env, et as AcrylOptions, h as BlankSchema, p as BlankEnv } from "./context-B5Y1lLha.js";
2
+
3
+ //#region ../../plugins/acryl-router/src/core/preset/tiny.d.ts
4
+ declare class Acryl<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = '/'> extends Acryl$1<E, S, BasePath> {
5
+ constructor(options?: AcrylOptions<E>);
6
+ }
7
+ //#endregion
8
+ export { Acryl };
package/lib/tiny.js ADDED
@@ -0,0 +1,15 @@
1
+ import { AcrylBase as Acryl$1 } from "./acryl-base.js";
2
+ import { t as PatternRouter } from "./pattern-router-HZxjDGEQ.js";
3
+ //#region ../../plugins/acryl-router/src/core/preset/tiny.ts
4
+ /**
5
+ * @module
6
+ * The preset that uses `PatternRouter`.
7
+ */
8
+ var Acryl = class extends Acryl$1 {
9
+ constructor(options = {}) {
10
+ super(options);
11
+ this.router = new PatternRouter();
12
+ }
13
+ };
14
+ //#endregion
15
+ export { Acryl };
@@ -1,4 +1,4 @@
1
- import { I as MiddlewareHandler } from "./context-Bm7rI-oK.js";
1
+ import { I as MiddlewareHandler } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/middleware/trailing-slash/index.d.ts
4
4
  type TrimTrailingSlashOptions = {
@@ -1,8 +1,8 @@
1
- import { $ as Acryl, J as Schema, K as ResponseFormat, N as KnownResponseFormat, g as Endpoint, x as ExtractSchema } from "./context-Bm7rI-oK.js";
1
+ import { $ as Acryl, J as Schema, K as ResponseFormat, N as KnownResponseFormat, g as Endpoint, x as ExtractSchema } from "./context-B5Y1lLha.js";
2
2
  import { i as METHOD_NAME_ALL_LOWERCASE, n as METHODS } from "./router-CvUxUTOq.js";
3
3
  import { c as StatusCode, l as SuccessStatusCode } from "./http-status-DaAwGAFL.js";
4
- import { s as HasRequiredKeys } from "./types-CwrQjlaM.js";
5
- import { t as Acryl$1 } from "./app-CmAYW1Al.js";
4
+ import { s as HasRequiredKeys } from "./types-D9DEXMjE.js";
5
+ import { t as Acryl$1 } from "./app-BdrVHBlJ.js";
6
6
 
7
7
  //#region ../../plugins/acryl-router/src/core/client/types.d.ts
8
8
  /**
@@ -62,6 +62,8 @@ type StringLiteralUnion<T> = T | (string & Record<never, never>);
62
62
  type BufferSource = ArrayBufferView<ArrayBuffer> | ArrayBuffer;
63
63
  /** A Web Crypto key, named from the runtime's own `crypto` so the public types do not need the DOM library. */
64
64
  type CryptoKey = Awaited<ReturnType<typeof crypto.subtle.importKey>>;
65
+ /** What the Web `Headers` constructor accepts, named from the runtime's own `Headers` so the public types do not need the DOM library. */
66
+ type HeadersInit = NonNullable<ConstructorParameters<typeof Headers>[0]>;
65
67
  /** How a WebSocket hands binary data to `onmessage`; declared here so the public types do not need the DOM library. */
66
68
  type BinaryType = 'arraybuffer' | 'blob';
67
69
  /** The members of a WebSocket `message` event the helpers hand out (the Web `MessageEvent`, whose Node global is not generic); declared here so the public types do not need the DOM library. */
@@ -102,4 +104,4 @@ interface JsonWebKey {
102
104
  y?: string;
103
105
  }
104
106
  //#endregion
105
- export { SimplifyDeepArray as C, Simplify as S, UnionToIntersection as T, JsonWebKey as _, Equal as a, RemoveBlankRecord as b, IfAnyThenEmptyObject as c, IsAny as d, JSONArray as f, JSONValue as g, JSONPrimitive as h, CryptoKey as i, InterfaceToType as l, JSONParsed as m, BufferSource as n, Expect as o, JSONObject as p, CloseEvent as r, HasRequiredKeys as s, BinaryType as t, InvalidJSONValue as u, MessageEvent as v, StringLiteralUnion as w, RequiredKeysOf as x, NotEqual as y };
107
+ export { Simplify as C, UnionToIntersection as E, RequiredKeysOf as S, StringLiteralUnion as T, JSONValue as _, Equal as a, NotEqual as b, HeadersInit as c, InvalidJSONValue as d, IsAny as f, JSONPrimitive as g, JSONParsed as h, CryptoKey as i, IfAnyThenEmptyObject as l, JSONObject as m, BufferSource as n, Expect as o, JSONArray as p, CloseEvent as r, HasRequiredKeys as s, BinaryType as t, InterfaceToType as u, JsonWebKey as v, SimplifyDeepArray as w, RemoveBlankRecord as x, MessageEvent as y };
@@ -1,4 +1,4 @@
1
- import { t as Context } from "./context-Bm7rI-oK.js";
1
+ import { t as Context } from "./context-B5Y1lLha.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/helper/conninfo/types.d.ts
4
4
  type AddressType = 'IPv6' | 'IPv4' | undefined;
package/lib/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as Input, B as NotFoundResponse, C as FetchEventLike, D as Handler, E as HTTPResponseError, F as MergeSchemaPath, G as RemoveQuestion, H as ParamKeyToRecord, I as MiddlewareHandler, J as Schema, K as ResponseFormat, L as MiddlewareHandlerInterface, M as IntersectNonAnyTypes, N as KnownResponseFormat, O as HandlerInterface, P as MergePath, Q as Variables, R as Next, S as ExtractSchemaForStatusCode, T as H, U as ParamKeys, V as OnHandlerInterface, W as ParsedFormValue, X as TypedResponse, Y as ToSchema, Z as ValidationTargets, _ as Env, b as ExtractInput, d as AddParam, f as Bindings, g as Endpoint, h as BlankSchema, j as InputToDataByTarget, k as HandlerResponse, m as BlankInput, p as BlankEnv, q as RouterRoute, v as ErrorHandler, w as FormValue, x as ExtractSchema, y as ExtractHandlerResponse, z as NotFoundHandler } from "./context-Bm7rI-oK.js";
1
+ import { A as Input, B as NotFoundResponse, C as FetchEventLike, D as Handler, E as HTTPResponseError, F as MergeSchemaPath, G as RemoveQuestion, H as ParamKeyToRecord, I as MiddlewareHandler, J as Schema, K as ResponseFormat, L as MiddlewareHandlerInterface, M as IntersectNonAnyTypes, N as KnownResponseFormat, O as HandlerInterface, P as MergePath, Q as Variables, R as Next, S as ExtractSchemaForStatusCode, T as H, U as ParamKeys, V as OnHandlerInterface, W as ParsedFormValue, X as TypedResponse, Y as ToSchema, Z as ValidationTargets, _ as Env, b as ExtractInput, d as AddParam, f as Bindings, g as Endpoint, h as BlankSchema, j as InputToDataByTarget, k as HandlerResponse, m as BlankInput, p as BlankEnv, q as RouterRoute, v as ErrorHandler, w as FormValue, x as ExtractSchema, y as ExtractHandlerResponse, z as NotFoundHandler } from "./context-B5Y1lLha.js";
2
2
  export { AddParam, Bindings, BlankEnv, BlankInput, BlankSchema, Endpoint, Env, ErrorHandler, ExtractHandlerResponse, ExtractInput, ExtractSchema, ExtractSchemaForStatusCode, FetchEventLike, FormValue, H, HTTPResponseError, Handler, HandlerInterface, HandlerResponse, Input, InputToDataByTarget, IntersectNonAnyTypes, KnownResponseFormat, MergePath, MergeSchemaPath, MiddlewareHandler, MiddlewareHandlerInterface, Next, NotFoundHandler, NotFoundResponse, OnHandlerInterface, ParamKeyToRecord, ParamKeys, ParsedFormValue, RemoveQuestion, ResponseFormat, RouterRoute, Schema, ToSchema, TypedResponse, ValidationTargets, Variables };
@@ -1,2 +1,2 @@
1
- import { c as BodyData, l as ParseBodyOptions, u as parseBody } from "../context-Bm7rI-oK.js";
1
+ import { c as BodyData, l as ParseBodyOptions, u as parseBody } from "../context-B5Y1lLha.js";
2
2
  export { BodyData, ParseBodyOptions, parseBody };
@@ -1,2 +1,2 @@
1
- import { a as SignedCookie, c as serialize, i as CookiePrefixOptions, l as serializeSigned, n as CookieConstraint, o as parse, r as CookieOptions, s as parseSigned, t as Cookie } from "../cookie-ClMaKDQf.js";
1
+ import { a as SignedCookie, c as serialize, i as CookiePrefixOptions, l as serializeSigned, n as CookieConstraint, o as parse, r as CookieOptions, s as parseSigned, t as Cookie } from "../cookie-D9_nQbsM.js";
2
2
  export { Cookie, CookieConstraint, CookieOptions, CookiePrefixOptions, SignedCookie, parse, parseSigned, serialize, serializeSigned };
@@ -1,4 +1,4 @@
1
- import { g as JSONValue } from "../types-CwrQjlaM.js";
1
+ import { _ as JSONValue } from "../types-D9DEXMjE.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/utils/crypto.d.ts
4
4
  type Algorithm = {
@@ -1,4 +1,4 @@
1
- import { t as AddressType } from "../types-CDO6I3B0.js";
1
+ import { t as AddressType } from "../types-ZM9gIiKh.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/utils/ipaddr.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as SignatureKey, c as SignatureAlgorithm, i as AcrylJsonWebKey, n as VerifyOptions, r as VerifyOptionsWithAlg, s as AsymmetricAlgorithm, t as TokenHeader } from "../jwt-Dg493Tai.js";
1
+ import { a as SignatureKey, c as SignatureAlgorithm, i as AcrylJsonWebKey, n as VerifyOptions, r as VerifyOptionsWithAlg, s as AsymmetricAlgorithm, t as TokenHeader } from "../jwt-BA65QhnJ.js";
2
2
  import { t as JWTPayload } from "../types-DR95J00T.js";
3
3
 
4
4
  //#region ../../plugins/acryl-router/src/core/utils/jwt/index.d.ts
@@ -1,2 +1,2 @@
1
- import { C as SimplifyDeepArray, S as Simplify, T as UnionToIntersection, _ as JsonWebKey, a as Equal, b as RemoveBlankRecord, c as IfAnyThenEmptyObject, d as IsAny, f as JSONArray, g as JSONValue, h as JSONPrimitive, i as CryptoKey, l as InterfaceToType, m as JSONParsed, n as BufferSource, o as Expect, p as JSONObject, r as CloseEvent, s as HasRequiredKeys, t as BinaryType, u as InvalidJSONValue, v as MessageEvent, w as StringLiteralUnion, x as RequiredKeysOf, y as NotEqual } from "../types-CwrQjlaM.js";
2
- export { BinaryType, BufferSource, CloseEvent, CryptoKey, Equal, Expect, HasRequiredKeys, IfAnyThenEmptyObject, InterfaceToType, InvalidJSONValue, IsAny, JSONArray, JSONObject, JSONParsed, JSONPrimitive, JSONValue, JsonWebKey, MessageEvent, NotEqual, RemoveBlankRecord, RequiredKeysOf, Simplify, SimplifyDeepArray, StringLiteralUnion, UnionToIntersection };
1
+ import { C as Simplify, E as UnionToIntersection, S as RequiredKeysOf, T as StringLiteralUnion, _ as JSONValue, a as Equal, b as NotEqual, c as HeadersInit, d as InvalidJSONValue, f as IsAny, g as JSONPrimitive, h as JSONParsed, i as CryptoKey, l as IfAnyThenEmptyObject, m as JSONObject, n as BufferSource, o as Expect, p as JSONArray, r as CloseEvent, s as HasRequiredKeys, t as BinaryType, u as InterfaceToType, v as JsonWebKey, w as SimplifyDeepArray, x as RemoveBlankRecord, y as MessageEvent } from "../types-D9DEXMjE.js";
2
+ export { BinaryType, BufferSource, CloseEvent, CryptoKey, Equal, Expect, HasRequiredKeys, HeadersInit, IfAnyThenEmptyObject, InterfaceToType, InvalidJSONValue, IsAny, JSONArray, JSONObject, JSONParsed, JSONPrimitive, JSONValue, JsonWebKey, MessageEvent, NotEqual, RemoveBlankRecord, RequiredKeysOf, Simplify, SimplifyDeepArray, StringLiteralUnion, UnionToIntersection };
@@ -1,5 +1,5 @@
1
- import { I as MiddlewareHandler, W as ParsedFormValue, X as TypedResponse, Z as ValidationTargets, _ as Env, t as Context, w as FormValue } from "./context-Bm7rI-oK.js";
2
- import { T as UnionToIntersection } from "./types-CwrQjlaM.js";
1
+ import { I as MiddlewareHandler, W as ParsedFormValue, X as TypedResponse, Z as ValidationTargets, _ as Env, t as Context, w as FormValue } from "./context-B5Y1lLha.js";
2
+ import { E as UnionToIntersection } from "./types-D9DEXMjE.js";
3
3
 
4
4
  //#region ../../plugins/acryl-router/src/core/validator/utils.d.ts
5
5
  /**
package/lib/ws.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as WSEvents, c as WebSocketHelperDefineContext, d as defineWebSocketHelper, i as WSContextInit, l as WebSocketHelperDefineHandler, n as UpgradeWebSocket, o as WSMessageReceive, r as WSContext, s as WSReadyState, t as SendOptions, u as createWSMessageEvent } from "./index-UTBmM3GX.js";
1
+ import { a as WSEvents, c as WebSocketHelperDefineContext, d as defineWebSocketHelper, i as WSContextInit, l as WebSocketHelperDefineHandler, n as UpgradeWebSocket, o as WSMessageReceive, r as WSContext, s as WSReadyState, t as SendOptions, u as createWSMessageEvent } from "./index-Kqou8Fjh.js";
2
2
  export { SendOptions, UpgradeWebSocket, WSContext, WSContextInit, WSEvents, WSMessageReceive, WSReadyState, WebSocketHelperDefineContext, WebSocketHelperDefineHandler, createWSMessageEvent, defineWebSocketHelper };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acrylblends",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "The Acryl web framework (import { Acryl } from \"acrylblends\") and the acrylblends command that scaffolds Cordis apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,6 +30,14 @@
30
30
  "types": "./lib/http-exception.d.ts",
31
31
  "default": "./lib/http-exception.js"
32
32
  },
33
+ "./tiny": {
34
+ "types": "./lib/tiny.d.ts",
35
+ "default": "./lib/tiny.js"
36
+ },
37
+ "./quick": {
38
+ "types": "./lib/quick.d.ts",
39
+ "default": "./lib/quick.js"
40
+ },
33
41
  "./basic-auth": {
34
42
  "types": "./lib/basic-auth.d.ts",
35
43
  "default": "./lib/basic-auth.js"
@@ -42,6 +50,10 @@
42
50
  "types": "./lib/body-limit.d.ts",
43
51
  "default": "./lib/body-limit.js"
44
52
  },
53
+ "./cache": {
54
+ "types": "./lib/cache.d.ts",
55
+ "default": "./lib/cache.js"
56
+ },
45
57
  "./combine": {
46
58
  "types": "./lib/combine.d.ts",
47
59
  "default": "./lib/combine.js"
@@ -94,6 +106,10 @@
94
106
  "types": "./lib/method-override.d.ts",
95
107
  "default": "./lib/method-override.js"
96
108
  },
109
+ "./mount": {
110
+ "types": "./lib/mount.d.ts",
111
+ "default": "./lib/mount.js"
112
+ },
97
113
  "./powered-by": {
98
114
  "types": "./lib/powered-by.d.ts",
99
115
  "default": "./lib/powered-by.js"
@@ -138,6 +154,10 @@
138
154
  "types": "./lib/cookie.d.ts",
139
155
  "default": "./lib/cookie.js"
140
156
  },
157
+ "./dev": {
158
+ "types": "./lib/dev.d.ts",
159
+ "default": "./lib/dev.js"
160
+ },
141
161
  "./factory": {
142
162
  "types": "./lib/factory.d.ts",
143
163
  "default": "./lib/factory.js"
@@ -146,6 +166,10 @@
146
166
  "types": "./lib/html.d.ts",
147
167
  "default": "./lib/html.js"
148
168
  },
169
+ "./proxy": {
170
+ "types": "./lib/proxy.d.ts",
171
+ "default": "./lib/proxy.js"
172
+ },
149
173
  "./route": {
150
174
  "types": "./lib/route.d.ts",
151
175
  "default": "./lib/route.js"
@@ -2,7 +2,7 @@
2
2
  "source": {
3
3
  "repo": "acryldev/acryl",
4
4
  "path": "plugins/acryl-inspect",
5
- "commit": "5743482e4199ded676a77f594bce15fd4aa0ca2f"
5
+ "commit": "0174cb01625bfd32d0162ad56179c582f353321e"
6
6
  },
7
7
  "vendored": [
8
8
  "src",
@@ -2,7 +2,7 @@
2
2
  "source": {
3
3
  "repo": "acryldev/acryl",
4
4
  "path": "plugins/acryl-node-server",
5
- "commit": "5743482e4199ded676a77f594bce15fd4aa0ca2f"
5
+ "commit": "0174cb01625bfd32d0162ad56179c582f353321e"
6
6
  },
7
7
  "vendored": [
8
8
  "src",