acrylblends 1.0.4 → 1.0.5
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/docs/framework/agents/index.md +6 -4
- package/lib/accept-CNNHu4Cf.js +193 -0
- package/lib/{accepts-XBuZPVRI.js → accepts-Btq83xPd.js} +1 -1
- package/lib/accepts.js +1 -1
- package/lib/acryl-base.js +1 -331
- package/lib/adapter-CaZ6FZUU.js +37 -0
- package/lib/adapter.js +1 -36
- package/lib/{app-BM0rTCp7.js → app-CQcGWjrk.js} +4 -4
- package/lib/app-base-CpRMZL4v.js +332 -0
- package/lib/{base-NSN_SNv-.js → base-D_6kfOr-.js} +1 -1
- package/lib/basic-auth-C0HTRpXh.js +20 -0
- package/lib/basic-auth-DFLflXNe.js +95 -0
- package/lib/basic-auth.js +1 -94
- package/lib/bearer-auth-Cwxt-vgS.js +94 -0
- package/lib/bearer-auth.js +1 -93
- package/lib/body-D7f4e7w_.js +94 -0
- package/lib/body-limit-WmIjWRLt.js +66 -0
- package/lib/body-limit.js +1 -65
- package/lib/buffer-CkEOJCcY.js +51 -0
- package/lib/bun.js +3 -3
- package/lib/cache-B0bHH7s5.js +169 -0
- package/lib/cache.js +1 -168
- package/lib/{client-DDLXwhBo.js → client-BrMFnMEd.js} +1 -1
- package/lib/{client-modules-CLvWOjbd.js → client-modules-drj4mjhj.js} +4 -4
- package/lib/client.js +1 -1
- package/lib/color-COa3DplO.js +37 -0
- package/lib/combine-TWuGdcbC.js +137 -0
- package/lib/combine.js +1 -136
- package/lib/{components-cEW3ovK0.js → components-B2ka9Ax1.js} +4 -4
- package/lib/{components-JXVm45kK.js → components-PVXwaOaC.js} +2 -2
- package/lib/compress-BzWqsHF1.js +79 -0
- package/lib/compress-C-9vK4B2.d.ts +11 -0
- package/lib/compress-DCyrrQ5D.js +11 -0
- package/lib/compress.d.ts +1 -1
- package/lib/compress.js +2 -78
- package/lib/concurrent-DrF3d2c-.js +30 -0
- package/lib/conninfo-BCROmdnf.d.ts +11 -0
- package/lib/conninfo-CWJwieh4.js +19 -0
- package/lib/constants-CBSEudrb.js +7 -0
- package/lib/{context-DDO0cfuP.js → context-CkOh7Ygv.js} +2 -2
- package/lib/context-storage-iuPoI_CR.js +52 -0
- package/lib/context-storage.js +1 -51
- package/lib/cookie-B1LlkzOe.js +125 -0
- package/lib/cookie-BHIduy2T.js +82 -0
- package/lib/cookie.js +1 -81
- package/lib/cordis/db-sqlite.d.ts +1 -1
- package/lib/cordis/door.d.ts +9 -1
- package/lib/cordis/door.js +39 -8
- package/lib/cordis/inspect.js +4 -4
- package/lib/cordis/kv-db.d.ts +1 -1
- package/lib/cordis/kv-db.js +1 -1
- package/lib/cordis/kv-json.d.ts +1 -1
- package/lib/cordis/kv-json.js +1 -1
- package/lib/cordis/node-server.d.ts +1 -1
- package/lib/cordis/node-server.js +3 -116
- package/lib/cordis/router-http.js +2 -2
- package/lib/cordis/router.js +4 -4
- package/lib/cordis/state.js +7 -7
- package/lib/{core-CaY8XDZ6.js → core-BOu1jYua.js} +1 -1
- package/lib/cors-CbAQ-8qU.js +106 -0
- package/lib/cors.js +1 -105
- package/lib/crypto-iVP-N-tS.js +34 -0
- package/lib/csrf-DqqOZtgy.js +101 -0
- package/lib/csrf.js +1 -100
- package/lib/css-C5CPVMvM.js +134 -0
- package/lib/css.js +2 -133
- package/lib/db/sqlite.d.ts +1 -25
- package/lib/dev-CLgu-JRe.js +50 -0
- package/lib/dev.js +1 -49
- package/lib/dom-YjND9Jt3.js +74 -0
- package/lib/door/host.js +1 -1
- package/lib/door/page.js +1 -1
- package/lib/door/protocol.js +1 -212
- package/lib/encode-BhbNLrjp.js +33 -0
- package/lib/factory-CLdSf-xS.js +30 -0
- package/lib/factory.js +1 -29
- package/lib/handler-C0wZ0KwO.js +12 -0
- package/lib/helpers-BEjcdbgw.js +5 -0
- package/lib/{hooks-w72iLeFR.js → hooks-CfC07ri0.js} +1 -1
- package/lib/html-CgNa89xw.js +31 -0
- package/lib/html-DGExBFNg.js +103 -0
- package/lib/html.d.ts +2 -5
- package/lib/html.js +2 -30
- package/lib/http-exception-MjWkT89V.js +54 -0
- package/lib/http-exception.js +1 -53
- package/lib/index-dAzQsJG9.d.ts +6 -0
- package/lib/index.js +3 -3
- package/lib/ip-restriction-jKtKCRM_.js +166 -0
- package/lib/ip-restriction.js +1 -165
- package/lib/ipaddr-DCoIo528.js +238 -0
- package/lib/jsx/dom/client.js +1 -1
- package/lib/jsx/dom/jsx-dev-runtime.js +1 -1
- package/lib/jsx/dom/jsx-runtime.js +2 -1
- package/lib/jsx/dom/server.js +3 -3
- package/lib/jsx/dom.js +5 -73
- package/lib/jsx/jsx-dev-runtime.d.ts +2 -5
- package/lib/jsx/jsx-dev-runtime.js +2 -13
- package/lib/jsx/jsx-runtime.d.ts +2 -2
- package/lib/jsx/jsx-runtime.js +4 -4
- package/lib/jsx/streaming.js +1 -1
- package/lib/jsx-CUQgttxU.js +47 -0
- package/lib/jsx-dev-runtime-B4WTyq8r.js +14 -0
- package/lib/{jsx-dev-runtime-CWLRA2F3.js → jsx-dev-runtime-BLfA-EhI.js} +2 -2
- package/lib/jsx-dev-runtime-CGt4kNYr.d.ts +6 -0
- package/lib/jsx-renderer-CfifM4hT.js +99 -0
- package/lib/jsx-renderer.js +1 -98
- package/lib/jsx-runtime-COCRWBJ9.js +2 -0
- package/lib/jsx.js +5 -46
- package/lib/{jwk-LkzeoaU8.js → jwk-CDPpYQpD.js} +3 -3
- package/lib/jwk.js +1 -1
- package/lib/{jwt-BGJBw5AF.js → jwt-BXoIA2fQ.js} +2 -2
- package/lib/{jwt-CskdhEW9.js → jwt-lyS4Q3mT.js} +3 -3
- package/lib/jwt.js +2 -2
- package/lib/kv/db.d.ts +1 -10
- package/lib/kv/db.js +1 -56
- package/lib/kv/json.d.ts +1 -9
- package/lib/kv/json.js +1 -223
- package/lib/{language-D9a4zqvn.js → language-DeGRtLJt.js} +2 -2
- package/lib/language.js +1 -1
- package/lib/{linear-router-C3FPib6h.js → linear-router-CmZn_JLV.js} +2 -2
- package/lib/logger-Ckxu8diz.js +54 -0
- package/lib/logger.js +1 -53
- package/lib/loopback-only-BbasoF7R.js +90 -0
- package/lib/loopback-only.js +1 -89
- package/lib/method-not-allowed-TO2_hnfl.js +82 -0
- package/lib/method-not-allowed.js +1 -81
- package/lib/method-override-DnZKfJbV.js +103 -0
- package/lib/method-override.js +1 -102
- package/lib/middleware-BfG_fp8P.js +12 -0
- package/lib/mime-BnScXkQn.js +77 -0
- package/lib/mount-QkK_3NtJ.js +67 -0
- package/lib/mount.js +1 -66
- package/lib/node-server/conninfo.d.ts +1 -10
- package/lib/node-server/conninfo.js +1 -18
- package/lib/node-server/register.js +25 -2
- package/lib/node-server/serve-static.d.ts +1 -17
- package/lib/node-server/serve-static.js +1 -1
- package/lib/node-server.d.ts +2 -2
- package/lib/node-server.js +4 -4
- package/lib/open-BqK4D2Wn.d.ts +11 -0
- package/lib/open-But9E2rL.js +57 -0
- package/lib/open-CULVJgOc.d.ts +12 -0
- package/lib/open-Dp4sxspc.js +224 -0
- package/lib/open-T7kgbO2O.d.ts +27 -0
- package/lib/{pattern-router-HZxjDGEQ.js → pattern-router-CJBecJBd.js} +1 -1
- package/lib/powered-by-CXQNjNIX.js +24 -0
- package/lib/powered-by.js +1 -23
- package/lib/pretty-json-CeC1yvYt.js +39 -0
- package/lib/pretty-json.js +1 -38
- package/lib/protocol-Dt0AZBOz.js +213 -0
- package/lib/proxy-C2w_mH7k.js +121 -0
- package/lib/proxy.js +1 -120
- package/lib/quick.js +4 -4
- package/lib/{reg-exp-router-DC1R3qoY.js → reg-exp-router-C_WV84eV.js} +2 -2
- package/lib/request-DvMgGtlW.js +323 -0
- package/lib/request.js +1 -322
- package/lib/route-D8m-a2I1.js +126 -0
- package/lib/route.js +1 -125
- package/lib/router/linear-router.js +1 -1
- package/lib/router/pattern-router.js +1 -1
- package/lib/router/reg-exp-router.js +1 -1
- package/lib/router/smart-router.js +1 -1
- package/lib/router/trie-router.js +1 -1
- package/lib/router-Be_o6nFu.js +35 -0
- package/lib/router.js +1 -34
- package/lib/schema-validator-EK3cUUCt.js +22 -0
- package/lib/schema-validator.js +1 -21
- package/lib/{secure-headers-mP3j6Hm6.js → secure-headers-C5ZOcXqk.js} +1 -1
- package/lib/secure-headers.js +1 -1
- package/lib/serve-static-B7sqnftW.d.ts +18 -0
- package/lib/{serve-static-3uo_9rjF.js → serve-static-C1Nkj_xB.js} +2 -2
- package/lib/{serve-static-Cp5adzGo.js → serve-static-EiJf1zkO.js} +4 -4
- package/lib/serve-static.js +1 -1
- package/lib/{smart-router-C5CZ5XSM.js → smart-router-BjxkDQCE.js} +1 -1
- package/lib/{snapshot-text-BLz8nlSc.js → snapshot-text-Bbx43mN0.js} +9 -9
- package/lib/{src-dy3Fk9tA.js → src-BTBm4OPD.js} +6 -6
- package/lib/src-LX0E4ec4.js +117 -0
- package/lib/{ssg-BwjcA-Ge.js → ssg-BEl7MHqg.js} +5 -5
- package/lib/ssg.js +1 -1
- package/lib/stream-CzM_SHkq.js +88 -0
- package/lib/{streaming-DHST3Scg.js → streaming-BlDaph8U.js} +3 -3
- package/lib/streaming.js +1 -1
- package/lib/{test-websocket-D8WWqE5G.js → test-websocket-BLeEvybj.js} +2 -2
- package/lib/testing-BQx5T_UX.js +17 -0
- package/lib/testing.js +1 -16
- package/lib/timeout-FeqZ9A-0.js +42 -0
- package/lib/timeout.js +1 -41
- package/lib/tiny.js +2 -2
- package/lib/trailing-slash-DwTx-1sk.js +85 -0
- package/lib/trailing-slash.js +1 -84
- package/lib/{trie-router-CfFbapzL.js → trie-router-JydLKUa2.js} +2 -2
- package/lib/url-BPh4d6j-.js +197 -0
- package/lib/utils/accept.js +1 -192
- package/lib/utils/basic-auth.js +1 -19
- package/lib/utils/body.js +1 -93
- package/lib/utils/buffer.js +1 -50
- package/lib/utils/color.js +1 -36
- package/lib/utils/compress.d.ts +1 -10
- package/lib/utils/compress.js +1 -10
- package/lib/utils/concurrent.js +1 -29
- package/lib/utils/constants.js +1 -6
- package/lib/utils/cookie.js +1 -124
- package/lib/utils/crypto.js +1 -33
- package/lib/utils/encode.js +1 -32
- package/lib/utils/handler.js +1 -11
- package/lib/utils/html.js +1 -102
- package/lib/utils/ipaddr.js +1 -237
- package/lib/utils/jwt.js +1 -1
- package/lib/utils/mime.js +1 -76
- package/lib/utils/stream.js +1 -87
- package/lib/utils/url.js +1 -196
- package/lib/{validator-D84mq-dO.js → validator-Btiyt5VJ.js} +3 -3
- package/lib/validator.js +1 -1
- package/lib/websocket-DsyBIKVA.js +56 -0
- package/lib/ws.js +1 -55
- package/package.json +1 -1
- package/plugins/acryl-door/src/host/chat-tools.ts +2 -0
- package/plugins/acryl-door/src/host/door.ts +19 -2
- package/plugins/acryl-door/src/index.ts +15 -2
- package/plugins/acryl-node-server/src/register.ts +29 -2
- package/plugins/agent/model.ts +6 -1
- package/plugins/agent/tools.ts +12 -2
- package/plugins/agent-panel/client/describe.ts +44 -0
- package/plugins/agent-panel/client/main.ts +4 -1
- package/plugins/agent-panel/index.ts +22 -10
- package/plugins/desktop/attach.ts +72 -0
- package/plugins/desktop/main.ts +17 -4
- package/plugins/extensions/index.ts +3 -4
- package/plugins/extensions/stage.ts +33 -5
- package/plugins/openai/index.ts +1 -1
- package/templates/agent/AGENTS.md +2 -0
- package/templates/agent/blend.yaml +4 -1
- package/templates/agent/src/app.ts +2 -0
- package/templates/agent/src/routes.ts +1 -1
- package/templates/agent/template.json +1 -0
- package/templates/agent/test/builder.test.ts +26 -21
- package/lib/helpers-CvTauQT5.js +0 -5
- package/lib/middleware-CPQ8himN.js +0 -12
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { t as TrieRouter } from "./trie-router-CfFbapzL.js";
|
|
3
|
-
import { basePath, matchedRoutes } from "./route.js";
|
|
4
|
-
//#region ../../plugins/acryl-router/src/core/middleware/method-not-allowed/index.ts
|
|
5
|
-
/**
|
|
6
|
-
* Method Not Allowed Middleware for Acryl.
|
|
7
|
-
*
|
|
8
|
-
* Returns a `405 Method Not Allowed` response with an `Allow` header when the request path
|
|
9
|
-
* matches a registered route but the request method is not supported.
|
|
10
|
-
*
|
|
11
|
-
* @param {MethodNotAllowedOptions} options - The options for the middleware.
|
|
12
|
-
* @param {Acryl} options.app - The Acryl instance used by the application.
|
|
13
|
-
* @param {MethodNotAllowedHandler} [options.onMethodNotAllowed] - Generates the response, including its `Allow` header.
|
|
14
|
-
* @returns {MiddlewareHandler} The middleware handler function.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* const app = new Acryl()
|
|
19
|
-
*
|
|
20
|
-
* app.use(methodNotAllowed({ app }))
|
|
21
|
-
*
|
|
22
|
-
* app.get('/hello', (c) => c.text('Hello!'))
|
|
23
|
-
* app.post('/hello', (c) => c.text('Posted!'))
|
|
24
|
-
*
|
|
25
|
-
* // PUT /hello -> 405 Method Not Allowed
|
|
26
|
-
* // Allow: GET, HEAD, POST
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* app.use(
|
|
32
|
-
* methodNotAllowed({
|
|
33
|
-
* app,
|
|
34
|
-
* onMethodNotAllowed: (c, methods) =>
|
|
35
|
-
* c.json({ error: 'Method Not Allowed' }, 405, { Allow: methods.join(', ') }),
|
|
36
|
-
* })
|
|
37
|
-
* )
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
const methodNotAllowed = (options) => {
|
|
41
|
-
let methodRouter;
|
|
42
|
-
return async function methodNotAllowed(c, next) {
|
|
43
|
-
const routeIndex = c.req.routeIndex;
|
|
44
|
-
await next();
|
|
45
|
-
if (c.res.status !== 404) return;
|
|
46
|
-
if (c.error) return;
|
|
47
|
-
if (!methodRouter) {
|
|
48
|
-
const methodsByPath = /* @__PURE__ */ new Map();
|
|
49
|
-
for (const route of options.app.routes) {
|
|
50
|
-
if (route.method === "ALL" || route.method === "HEAD") continue;
|
|
51
|
-
const methods = methodsByPath.get(route.path) ?? /* @__PURE__ */ new Set();
|
|
52
|
-
methods.add(route.method);
|
|
53
|
-
if (route.method === "GET") methods.add("HEAD");
|
|
54
|
-
methodsByPath.set(route.path, methods);
|
|
55
|
-
}
|
|
56
|
-
methodRouter = new TrieRouter();
|
|
57
|
-
for (const [path, methods] of methodsByPath) methodRouter.add("ALL", path, [...methods]);
|
|
58
|
-
}
|
|
59
|
-
let requestPath = c.req.path;
|
|
60
|
-
const currentRoute = matchedRoutes(c)[routeIndex];
|
|
61
|
-
const sourceRoute = options.app.routes.find((route) => route.handler === methodNotAllowed);
|
|
62
|
-
if (currentRoute && sourceRoute) {
|
|
63
|
-
const currentBasePathParts = basePath(c, routeIndex).split("/").filter(Boolean);
|
|
64
|
-
const sourceBasePathLength = sourceRoute.basePath.split("/").filter(Boolean).length;
|
|
65
|
-
const mountBasePathParts = currentBasePathParts.slice(0, currentBasePathParts.length - sourceBasePathLength);
|
|
66
|
-
if (mountBasePathParts.length > 0) {
|
|
67
|
-
const mountBasePath = `/${mountBasePathParts.join("/")}`;
|
|
68
|
-
requestPath = c.req.path.slice(mountBasePath.length) || "/";
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const allowedMethods = /* @__PURE__ */ new Set();
|
|
72
|
-
for (const [methods] of methodRouter.match("ALL", requestPath)[0]) for (const method of methods) allowedMethods.add(method);
|
|
73
|
-
if (allowedMethods.size === 0 || allowedMethods.has(c.req.method)) return;
|
|
74
|
-
c.res.headers.delete("Allow");
|
|
75
|
-
c.res.headers.delete("Content-Length");
|
|
76
|
-
const methods = [...allowedMethods];
|
|
77
|
-
const allow = methods.join(", ");
|
|
78
|
-
c.res = options.onMethodNotAllowed ? await options.onMethodNotAllowed(c, methods) : c.text("Method Not Allowed", 405, { Allow: allow });
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
//#endregion
|
|
1
|
+
import { t as methodNotAllowed } from "./method-not-allowed-TO2_hnfl.js";
|
|
82
2
|
export { methodNotAllowed };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { t as parseBody } from "./body-D7f4e7w_.js";
|
|
2
|
+
//#region ../../plugins/acryl-router/src/core/middleware/method-override/index.ts
|
|
3
|
+
const DEFAULT_METHOD_FORM_NAME = "_method";
|
|
4
|
+
/**
|
|
5
|
+
* Method Override Middleware for Acryl.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @param {MethodOverrideOptions} options - The options for the method override middleware.
|
|
9
|
+
* @param {Acryl} options.app - The instance of Acryl is used in your application.
|
|
10
|
+
* @param {string} [options.form=_method] - Form key with a value containing the method name.
|
|
11
|
+
* @param {string} [options.header] - Header name with a value containing the method name.
|
|
12
|
+
* @param {string} [options.query] - Query parameter key with a value containing the method name.
|
|
13
|
+
* @returns {MiddlewareHandler} The middleware handler function.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const app = new Acryl()
|
|
18
|
+
*
|
|
19
|
+
* // If no options are specified, the value of `_method` in the form,
|
|
20
|
+
* // e.g. DELETE, is used as the method.
|
|
21
|
+
* app.use('/posts', methodOverride({ app }))
|
|
22
|
+
*
|
|
23
|
+
* app.delete('/posts', (c) => {
|
|
24
|
+
* // ....
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
const methodOverride = (options) => async function methodOverride(c, next) {
|
|
29
|
+
if (c.req.method === "GET") return await next();
|
|
30
|
+
const app = options.app;
|
|
31
|
+
if (!(options.header || options.query)) {
|
|
32
|
+
const contentType = c.req.header("content-type");
|
|
33
|
+
const methodFormName = options.form || DEFAULT_METHOD_FORM_NAME;
|
|
34
|
+
const clonedRequest = c.req.raw.clone();
|
|
35
|
+
const newRequest = clonedRequest.clone();
|
|
36
|
+
if (contentType?.startsWith("multipart/form-data")) {
|
|
37
|
+
const method = (await clonedRequest.formData()).get(methodFormName);
|
|
38
|
+
if (method) {
|
|
39
|
+
const newForm = await newRequest.formData();
|
|
40
|
+
newForm.delete(methodFormName);
|
|
41
|
+
const newHeaders = new Headers(clonedRequest.headers);
|
|
42
|
+
newHeaders.delete("content-type");
|
|
43
|
+
newHeaders.delete("content-length");
|
|
44
|
+
const request = new Request(c.req.url, {
|
|
45
|
+
body: newForm,
|
|
46
|
+
headers: newHeaders,
|
|
47
|
+
method
|
|
48
|
+
});
|
|
49
|
+
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (contentType?.startsWith("application/x-www-form-urlencoded")) {
|
|
53
|
+
const params = await parseBody(clonedRequest);
|
|
54
|
+
const method = params[methodFormName];
|
|
55
|
+
if (method) {
|
|
56
|
+
delete params[methodFormName];
|
|
57
|
+
const newParams = new URLSearchParams(params);
|
|
58
|
+
const request = new Request(newRequest, {
|
|
59
|
+
body: newParams,
|
|
60
|
+
method
|
|
61
|
+
});
|
|
62
|
+
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} else if (options.header) {
|
|
66
|
+
const headerName = options.header;
|
|
67
|
+
const method = c.req.header(headerName);
|
|
68
|
+
if (method) {
|
|
69
|
+
const newHeaders = new Headers(c.req.raw.headers);
|
|
70
|
+
newHeaders.delete(headerName);
|
|
71
|
+
const request = new Request(c.req.raw, {
|
|
72
|
+
headers: newHeaders,
|
|
73
|
+
method
|
|
74
|
+
});
|
|
75
|
+
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
76
|
+
}
|
|
77
|
+
} else if (options.query) {
|
|
78
|
+
const queryName = options.query;
|
|
79
|
+
const method = c.req.query(queryName);
|
|
80
|
+
if (method) {
|
|
81
|
+
const url = new URL(c.req.url);
|
|
82
|
+
url.searchParams.delete(queryName);
|
|
83
|
+
const requestInit = {
|
|
84
|
+
body: c.req.raw.body,
|
|
85
|
+
headers: c.req.raw.headers,
|
|
86
|
+
method,
|
|
87
|
+
duplex: c.req.raw.body ? "half" : void 0
|
|
88
|
+
};
|
|
89
|
+
const request = new Request(url.toString(), requestInit);
|
|
90
|
+
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
await next();
|
|
94
|
+
};
|
|
95
|
+
const getExecutionCtx = (c) => {
|
|
96
|
+
let executionCtx;
|
|
97
|
+
try {
|
|
98
|
+
executionCtx = c.executionCtx;
|
|
99
|
+
} catch {}
|
|
100
|
+
return executionCtx;
|
|
101
|
+
};
|
|
102
|
+
//#endregion
|
|
103
|
+
export { methodOverride as t };
|
package/lib/method-override.js
CHANGED
|
@@ -1,103 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region ../../plugins/acryl-router/src/core/middleware/method-override/index.ts
|
|
3
|
-
const DEFAULT_METHOD_FORM_NAME = "_method";
|
|
4
|
-
/**
|
|
5
|
-
* Method Override Middleware for Acryl.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param {MethodOverrideOptions} options - The options for the method override middleware.
|
|
9
|
-
* @param {Acryl} options.app - The instance of Acryl is used in your application.
|
|
10
|
-
* @param {string} [options.form=_method] - Form key with a value containing the method name.
|
|
11
|
-
* @param {string} [options.header] - Header name with a value containing the method name.
|
|
12
|
-
* @param {string} [options.query] - Query parameter key with a value containing the method name.
|
|
13
|
-
* @returns {MiddlewareHandler} The middleware handler function.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const app = new Acryl()
|
|
18
|
-
*
|
|
19
|
-
* // If no options are specified, the value of `_method` in the form,
|
|
20
|
-
* // e.g. DELETE, is used as the method.
|
|
21
|
-
* app.use('/posts', methodOverride({ app }))
|
|
22
|
-
*
|
|
23
|
-
* app.delete('/posts', (c) => {
|
|
24
|
-
* // ....
|
|
25
|
-
* })
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
const methodOverride = (options) => async function methodOverride(c, next) {
|
|
29
|
-
if (c.req.method === "GET") return await next();
|
|
30
|
-
const app = options.app;
|
|
31
|
-
if (!(options.header || options.query)) {
|
|
32
|
-
const contentType = c.req.header("content-type");
|
|
33
|
-
const methodFormName = options.form || DEFAULT_METHOD_FORM_NAME;
|
|
34
|
-
const clonedRequest = c.req.raw.clone();
|
|
35
|
-
const newRequest = clonedRequest.clone();
|
|
36
|
-
if (contentType?.startsWith("multipart/form-data")) {
|
|
37
|
-
const method = (await clonedRequest.formData()).get(methodFormName);
|
|
38
|
-
if (method) {
|
|
39
|
-
const newForm = await newRequest.formData();
|
|
40
|
-
newForm.delete(methodFormName);
|
|
41
|
-
const newHeaders = new Headers(clonedRequest.headers);
|
|
42
|
-
newHeaders.delete("content-type");
|
|
43
|
-
newHeaders.delete("content-length");
|
|
44
|
-
const request = new Request(c.req.url, {
|
|
45
|
-
body: newForm,
|
|
46
|
-
headers: newHeaders,
|
|
47
|
-
method
|
|
48
|
-
});
|
|
49
|
-
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (contentType?.startsWith("application/x-www-form-urlencoded")) {
|
|
53
|
-
const params = await parseBody(clonedRequest);
|
|
54
|
-
const method = params[methodFormName];
|
|
55
|
-
if (method) {
|
|
56
|
-
delete params[methodFormName];
|
|
57
|
-
const newParams = new URLSearchParams(params);
|
|
58
|
-
const request = new Request(newRequest, {
|
|
59
|
-
body: newParams,
|
|
60
|
-
method
|
|
61
|
-
});
|
|
62
|
-
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} else if (options.header) {
|
|
66
|
-
const headerName = options.header;
|
|
67
|
-
const method = c.req.header(headerName);
|
|
68
|
-
if (method) {
|
|
69
|
-
const newHeaders = new Headers(c.req.raw.headers);
|
|
70
|
-
newHeaders.delete(headerName);
|
|
71
|
-
const request = new Request(c.req.raw, {
|
|
72
|
-
headers: newHeaders,
|
|
73
|
-
method
|
|
74
|
-
});
|
|
75
|
-
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
76
|
-
}
|
|
77
|
-
} else if (options.query) {
|
|
78
|
-
const queryName = options.query;
|
|
79
|
-
const method = c.req.query(queryName);
|
|
80
|
-
if (method) {
|
|
81
|
-
const url = new URL(c.req.url);
|
|
82
|
-
url.searchParams.delete(queryName);
|
|
83
|
-
const requestInit = {
|
|
84
|
-
body: c.req.raw.body,
|
|
85
|
-
headers: c.req.raw.headers,
|
|
86
|
-
method,
|
|
87
|
-
duplex: c.req.raw.body ? "half" : void 0
|
|
88
|
-
};
|
|
89
|
-
const request = new Request(url.toString(), requestInit);
|
|
90
|
-
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
await next();
|
|
94
|
-
};
|
|
95
|
-
const getExecutionCtx = (c) => {
|
|
96
|
-
let executionCtx;
|
|
97
|
-
try {
|
|
98
|
-
executionCtx = c.executionCtx;
|
|
99
|
-
} catch {}
|
|
100
|
-
return executionCtx;
|
|
101
|
-
};
|
|
102
|
-
//#endregion
|
|
1
|
+
import { t as methodOverride } from "./method-override-DnZKfJbV.js";
|
|
103
2
|
export { methodOverride };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./basic-auth-DFLflXNe.js";
|
|
2
|
+
import "./combine-TWuGdcbC.js";
|
|
3
|
+
import "./context-storage-iuPoI_CR.js";
|
|
4
|
+
import "./ip-restriction-jKtKCRM_.js";
|
|
5
|
+
import "./jsx-renderer-CfifM4hT.js";
|
|
6
|
+
import "./jwk-CDPpYQpD.js";
|
|
7
|
+
import "./jwt-lyS4Q3mT.js";
|
|
8
|
+
import "./method-not-allowed-TO2_hnfl.js";
|
|
9
|
+
import "./serve-static-EiJf1zkO.js";
|
|
10
|
+
import "./timeout-FeqZ9A-0.js";
|
|
11
|
+
import "./loopback-only-BbasoF7R.js";
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region ../../plugins/acryl-router/src/core/utils/mime.ts
|
|
2
|
+
/**
|
|
3
|
+
* @module
|
|
4
|
+
* MIME utility.
|
|
5
|
+
*/
|
|
6
|
+
const getMimeType = (filename, mimes = baseMimes) => {
|
|
7
|
+
const match = filename.match(/\.([a-zA-Z0-9]+?)$/);
|
|
8
|
+
if (!match) return;
|
|
9
|
+
return mimes[match[1].toLowerCase()];
|
|
10
|
+
};
|
|
11
|
+
const getExtension = (mimeType) => {
|
|
12
|
+
const baseType = mimeType.split(";", 1)[0].trim();
|
|
13
|
+
for (const ext in baseMimes) {
|
|
14
|
+
const stored = baseMimes[ext];
|
|
15
|
+
if (stored === mimeType || stored.split(";", 1)[0].trim() === baseType) return ext;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const baseMimes = {
|
|
19
|
+
aac: "audio/aac",
|
|
20
|
+
avi: "video/x-msvideo",
|
|
21
|
+
avif: "image/avif",
|
|
22
|
+
av1: "video/av1",
|
|
23
|
+
bin: "application/octet-stream",
|
|
24
|
+
bmp: "image/bmp",
|
|
25
|
+
css: "text/css; charset=utf-8",
|
|
26
|
+
csv: "text/csv; charset=utf-8",
|
|
27
|
+
eot: "application/vnd.ms-fontobject",
|
|
28
|
+
epub: "application/epub+zip",
|
|
29
|
+
gif: "image/gif",
|
|
30
|
+
gz: "application/gzip",
|
|
31
|
+
htm: "text/html; charset=utf-8",
|
|
32
|
+
html: "text/html; charset=utf-8",
|
|
33
|
+
ico: "image/x-icon",
|
|
34
|
+
ics: "text/calendar; charset=utf-8",
|
|
35
|
+
jpeg: "image/jpeg",
|
|
36
|
+
jpg: "image/jpeg",
|
|
37
|
+
js: "text/javascript; charset=utf-8",
|
|
38
|
+
json: "application/json",
|
|
39
|
+
jsonld: "application/ld+json",
|
|
40
|
+
map: "application/json",
|
|
41
|
+
mid: "audio/x-midi",
|
|
42
|
+
midi: "audio/x-midi",
|
|
43
|
+
mjs: "text/javascript; charset=utf-8",
|
|
44
|
+
mp3: "audio/mpeg",
|
|
45
|
+
mp4: "video/mp4",
|
|
46
|
+
mpeg: "video/mpeg",
|
|
47
|
+
oga: "audio/ogg",
|
|
48
|
+
ogv: "video/ogg",
|
|
49
|
+
ogx: "application/ogg",
|
|
50
|
+
opus: "audio/opus",
|
|
51
|
+
otf: "font/otf",
|
|
52
|
+
pdf: "application/pdf",
|
|
53
|
+
png: "image/png",
|
|
54
|
+
rtf: "application/rtf",
|
|
55
|
+
svg: "image/svg+xml; charset=utf-8",
|
|
56
|
+
tif: "image/tiff",
|
|
57
|
+
tiff: "image/tiff",
|
|
58
|
+
ts: "video/mp2t",
|
|
59
|
+
ttf: "font/ttf",
|
|
60
|
+
txt: "text/plain; charset=utf-8",
|
|
61
|
+
wasm: "application/wasm",
|
|
62
|
+
webm: "video/webm",
|
|
63
|
+
weba: "audio/webm",
|
|
64
|
+
webmanifest: "application/manifest+json",
|
|
65
|
+
webp: "image/webp",
|
|
66
|
+
woff: "font/woff",
|
|
67
|
+
woff2: "font/woff2",
|
|
68
|
+
xhtml: "application/xhtml+xml; charset=utf-8",
|
|
69
|
+
xml: "application/xml; charset=utf-8",
|
|
70
|
+
zip: "application/zip",
|
|
71
|
+
"3gp": "video/3gpp",
|
|
72
|
+
"3g2": "video/3gpp2",
|
|
73
|
+
gltf: "model/gltf+json",
|
|
74
|
+
glb: "model/gltf-binary"
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { getExtension as n, getMimeType as r, baseMimes as t };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { i as routePath } from "./route-D8m-a2I1.js";
|
|
2
|
+
//#region ../../plugins/acryl-router/src/core/middleware/mount/index.ts
|
|
3
|
+
const defaultReplaceRequest = (c) => {
|
|
4
|
+
const pathPrefix = routePath(c).replace(/\/\*$/, "");
|
|
5
|
+
const url = new URL(c.req.raw.url);
|
|
6
|
+
url.pathname = c.req.path.slice(pathPrefix.length) || "/";
|
|
7
|
+
return new Request(url, c.req.raw);
|
|
8
|
+
};
|
|
9
|
+
const defaultGetOptions = (c) => {
|
|
10
|
+
let executionContext = void 0;
|
|
11
|
+
try {
|
|
12
|
+
executionContext = c.executionCtx;
|
|
13
|
+
} catch {}
|
|
14
|
+
return [c.env, executionContext];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* `mount()` allows you to mount applications built with other frameworks into your Acryl application.
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* @param {Function} applicationHandler - other Request Handler
|
|
21
|
+
* @param {MountOptions} [options] - options of `mount()`
|
|
22
|
+
* @returns {MiddlewareHandler} handler to register with `app.all()`
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { Router as IttyRouter } from 'itty-router'
|
|
27
|
+
* import { Acryl } from 'acrylblends'
|
|
28
|
+
* import { mount } from 'acrylblends/mount'
|
|
29
|
+
* // Create itty-router application
|
|
30
|
+
* const ittyRouter = IttyRouter()
|
|
31
|
+
* // GET /itty-router/hello
|
|
32
|
+
* ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
|
|
33
|
+
*
|
|
34
|
+
* const app = new Acryl()
|
|
35
|
+
* app.all('/itty-router/*', mount(ittyRouter.handle))
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const app = new Acryl()
|
|
41
|
+
* // Send the request to another application without modification.
|
|
42
|
+
* app.all('/app/*', mount(anotherApp, {
|
|
43
|
+
* replaceRequest: (req) => req,
|
|
44
|
+
* }))
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
const mount = (applicationHandler, options) => {
|
|
48
|
+
let replaceRequest;
|
|
49
|
+
let optionHandler;
|
|
50
|
+
if (options) if (typeof options === "function") optionHandler = options;
|
|
51
|
+
else {
|
|
52
|
+
optionHandler = options.optionHandler;
|
|
53
|
+
if (options.replaceRequest === false) replaceRequest = (request) => request;
|
|
54
|
+
else replaceRequest = options.replaceRequest;
|
|
55
|
+
}
|
|
56
|
+
const getOptions = optionHandler ? (c) => {
|
|
57
|
+
const options = optionHandler(c);
|
|
58
|
+
return Array.isArray(options) ? options : [options];
|
|
59
|
+
} : defaultGetOptions;
|
|
60
|
+
return async (c, next) => {
|
|
61
|
+
const res = await applicationHandler(replaceRequest ? replaceRequest(c.req.raw) : defaultReplaceRequest(c), ...getOptions(c));
|
|
62
|
+
if (res) return res;
|
|
63
|
+
await next();
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { mount as t };
|
package/lib/mount.js
CHANGED
|
@@ -1,67 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region ../../plugins/acryl-router/src/core/middleware/mount/index.ts
|
|
3
|
-
const defaultReplaceRequest = (c) => {
|
|
4
|
-
const pathPrefix = routePath(c).replace(/\/\*$/, "");
|
|
5
|
-
const url = new URL(c.req.raw.url);
|
|
6
|
-
url.pathname = c.req.path.slice(pathPrefix.length) || "/";
|
|
7
|
-
return new Request(url, c.req.raw);
|
|
8
|
-
};
|
|
9
|
-
const defaultGetOptions = (c) => {
|
|
10
|
-
let executionContext = void 0;
|
|
11
|
-
try {
|
|
12
|
-
executionContext = c.executionCtx;
|
|
13
|
-
} catch {}
|
|
14
|
-
return [c.env, executionContext];
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* `mount()` allows you to mount applications built with other frameworks into your Acryl application.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param {Function} applicationHandler - other Request Handler
|
|
21
|
-
* @param {MountOptions} [options] - options of `mount()`
|
|
22
|
-
* @returns {MiddlewareHandler} handler to register with `app.all()`
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* import { Router as IttyRouter } from 'itty-router'
|
|
27
|
-
* import { Acryl } from 'acrylblends'
|
|
28
|
-
* import { mount } from 'acrylblends/mount'
|
|
29
|
-
* // Create itty-router application
|
|
30
|
-
* const ittyRouter = IttyRouter()
|
|
31
|
-
* // GET /itty-router/hello
|
|
32
|
-
* ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
|
|
33
|
-
*
|
|
34
|
-
* const app = new Acryl()
|
|
35
|
-
* app.all('/itty-router/*', mount(ittyRouter.handle))
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* const app = new Acryl()
|
|
41
|
-
* // Send the request to another application without modification.
|
|
42
|
-
* app.all('/app/*', mount(anotherApp, {
|
|
43
|
-
* replaceRequest: (req) => req,
|
|
44
|
-
* }))
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
const mount = (applicationHandler, options) => {
|
|
48
|
-
let replaceRequest;
|
|
49
|
-
let optionHandler;
|
|
50
|
-
if (options) if (typeof options === "function") optionHandler = options;
|
|
51
|
-
else {
|
|
52
|
-
optionHandler = options.optionHandler;
|
|
53
|
-
if (options.replaceRequest === false) replaceRequest = (request) => request;
|
|
54
|
-
else replaceRequest = options.replaceRequest;
|
|
55
|
-
}
|
|
56
|
-
const getOptions = optionHandler ? (c) => {
|
|
57
|
-
const options = optionHandler(c);
|
|
58
|
-
return Array.isArray(options) ? options : [options];
|
|
59
|
-
} : defaultGetOptions;
|
|
60
|
-
return async (c, next) => {
|
|
61
|
-
const res = await applicationHandler(replaceRequest ? replaceRequest(c.req.raw) : defaultReplaceRequest(c), ...getOptions(c));
|
|
62
|
-
if (res) return res;
|
|
63
|
-
await next();
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
//#endregion
|
|
1
|
+
import { t as mount } from "./mount-QkK_3NtJ.js";
|
|
67
2
|
export { mount };
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region ../../plugins/acryl-node-server/src/adapter/conninfo.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* ConnInfo Helper for Node.js
|
|
6
|
-
* @param c Context
|
|
7
|
-
* @returns ConnInfo
|
|
8
|
-
*/
|
|
9
|
-
declare const getConnInfo: GetConnInfo;
|
|
10
|
-
//#endregion
|
|
1
|
+
import { t as getConnInfo } from "../conninfo-BCROmdnf.js";
|
|
11
2
|
export { getConnInfo };
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* ConnInfo Helper for Node.js
|
|
4
|
-
* @param c Context
|
|
5
|
-
* @returns ConnInfo
|
|
6
|
-
*/
|
|
7
|
-
const getConnInfo = (c) => {
|
|
8
|
-
const bindings = c.env.server ? c.env.server : c.env;
|
|
9
|
-
const address = bindings.incoming.socket.remoteAddress;
|
|
10
|
-
const port = bindings.incoming.socket.remotePort;
|
|
11
|
-
const family = bindings.incoming.socket.remoteFamily;
|
|
12
|
-
return { remote: {
|
|
13
|
-
address,
|
|
14
|
-
port,
|
|
15
|
-
addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0
|
|
16
|
-
} };
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
1
|
+
import { t as getConnInfo } from "../conninfo-CWJwieh4.js";
|
|
19
2
|
export { getConnInfo };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as compileModule } from "../transpile-QUK9b3eG.js";
|
|
2
2
|
import { registerHooks } from "node:module";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
//#region ../../plugins/acryl-node-server/src/register.ts
|
|
6
6
|
/**
|
|
7
7
|
* JSX files on Node: `node --import acrylblends/node-server/register src/index.ts`. Node strips TypeScript's types but does not compile JSX, so a
|
|
@@ -27,5 +27,28 @@ registerHooks({ load(url, context, nextLoad) {
|
|
|
27
27
|
shortCircuit: true
|
|
28
28
|
};
|
|
29
29
|
} });
|
|
30
|
+
/**
|
|
31
|
+
* The framework's names for a file of the app: in an app the framework plugins are source under `plugins/`, not packages, so `acrylblends`, `acrylblends/body-limit` or `acryl-router`
|
|
32
|
+
* have nowhere to resolve from. A plugin installed while the app runs gets them from the extensions plugin; a plugin that is a ROW of `blend.yaml` is imported by `src/app.ts` before
|
|
33
|
+
* any of that exists, so the same names are resolved here, in the preload every `dev`, `start` and `test` script runs. Only a name that Node cannot resolve itself, only for the
|
|
34
|
+
* app's own files (never for something in `node_modules`), and only in an app that has the framework as vendored source: the published package resolves its own names.
|
|
35
|
+
*/
|
|
36
|
+
const plugins = new URL("../../", import.meta.url);
|
|
37
|
+
const appRoot = new URL("../", plugins).href;
|
|
38
|
+
const resolver = new URL("extensions/resolve.ts", plugins);
|
|
39
|
+
if (existsSync(fileURLToPath(new URL("acryl-router/src/index.ts", plugins))) && existsSync(fileURLToPath(resolver))) {
|
|
40
|
+
const { routerAliases } = await import(resolver.href);
|
|
41
|
+
const aliases = routerAliases();
|
|
42
|
+
registerHooks({ resolve(specifier, context, nextResolve) {
|
|
43
|
+
try {
|
|
44
|
+
return nextResolve(specifier, context);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
const alias = aliases[specifier];
|
|
47
|
+
const parent = context.parentURL;
|
|
48
|
+
if (alias !== void 0 && parent?.startsWith(appRoot) && !parent.includes("/node_modules/")) return nextResolve(pathToFileURL(alias).href, context);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
} });
|
|
52
|
+
}
|
|
30
53
|
//#endregion
|
|
31
54
|
export {};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region ../../plugins/acryl-node-server/src/adapter/serve-static.d.ts
|
|
3
|
-
type ServeStaticOptions<E extends Env = Env> = {
|
|
4
|
-
/**
|
|
5
|
-
* Root path. Relative path is based on current working directory from which the app was started.
|
|
6
|
-
*/
|
|
7
|
-
root?: string;
|
|
8
|
-
path?: string;
|
|
9
|
-
index?: string;
|
|
10
|
-
precompressed?: boolean; /** Allow percent signs in the routed request path. Defaults to false. */
|
|
11
|
-
allowPercentInPath?: boolean;
|
|
12
|
-
rewriteRequestPath?: (path: string, c: Context<E>) => string;
|
|
13
|
-
onFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
14
|
-
onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
|
|
17
|
-
//#endregion
|
|
1
|
+
import { n as serveStatic, t as ServeStaticOptions } from "../serve-static-B7sqnftW.js";
|
|
18
2
|
export { ServeStaticOptions, serveStatic };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as serveStatic } from "../serve-static-
|
|
1
|
+
import { t as serveStatic } from "../serve-static-C1Nkj_xB.js";
|
|
2
2
|
export { serveStatic };
|
package/lib/node-server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Acryl } from "./app-D8riatvv.js";
|
|
2
2
|
import { a as Owner, c as UpgradeHubOptions, d as upgradeWebSocket, f as WebSocketData, i as testWebSocket, l as UpgradeRouter, m as WebSocketServerLike, n as TestWebSocketOptions, o as UpgradeEmitter, p as WebSocketLike, r as TestWebSocketResult, s as UpgradeHub, t as TestSocket, u as RequestError } from "./test-websocket-DyeS50Tr.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getConnInfo } from "./
|
|
3
|
+
import { n as serveStatic, t as ServeStaticOptions } from "./serve-static-B7sqnftW.js";
|
|
4
|
+
import { t as getConnInfo } from "./conninfo-BCROmdnf.js";
|
|
5
5
|
import { AddressInfo } from "node:net";
|
|
6
6
|
import { IncomingMessage, Server, ServerOptions, ServerResponse, createServer } from "node:http";
|
|
7
7
|
import { Http2SecureServer, Http2Server, Http2ServerRequest, Http2ServerResponse, SecureServerOptions, ServerOptions as ServerOptions$1, createSecureServer, createServer as createServer$1 } from "node:http2";
|
package/lib/node-server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as serve, i as createAdaptorServer, l as RequestError, n as UpgradeEmitter, o as upgradeWebSocket, r as UpgradeHub, s as getRequestListener, t as testWebSocket } from "./test-websocket-
|
|
2
|
-
import { t as serveStatic } from "./serve-static-
|
|
3
|
-
import { getConnInfo } from "./
|
|
4
|
-
import { n as clientModules, t as buildClientModules } from "./client-modules-
|
|
1
|
+
import { a as serve, i as createAdaptorServer, l as RequestError, n as UpgradeEmitter, o as upgradeWebSocket, r as UpgradeHub, s as getRequestListener, t as testWebSocket } from "./test-websocket-BLeEvybj.js";
|
|
2
|
+
import { t as serveStatic } from "./serve-static-C1Nkj_xB.js";
|
|
3
|
+
import { t as getConnInfo } from "./conninfo-CWJwieh4.js";
|
|
4
|
+
import { n as clientModules, t as buildClientModules } from "./client-modules-drj4mjhj.js";
|
|
5
5
|
export { RequestError, UpgradeEmitter, UpgradeHub, buildClientModules, clientModules, createAdaptorServer, getConnInfo, getRequestListener, serve, serveStatic, testWebSocket, upgradeWebSocket };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { r as KvOpened } from "./kv-9f-AlRKN.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../plugins/acryl-kv-json/src/open.d.ts
|
|
4
|
+
interface OpenKvOptions {
|
|
5
|
+
/** The JSON file; its folder is created if missing. */
|
|
6
|
+
readonly path: string;
|
|
7
|
+
}
|
|
8
|
+
/** Open (and create, when missing) a JSON-file store. @throws when the file exists and is not a readable kv file. */
|
|
9
|
+
declare function openKv(options: OpenKvOptions): Promise<KvOpened>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { openKv as n, OpenKvOptions as t };
|