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,14 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
function jsxDEV(tag, props, key) {
|
|
4
|
-
let node;
|
|
5
|
-
if (!props || !("children" in props)) node = jsxFn(tag, props, []);
|
|
6
|
-
else {
|
|
7
|
-
const children = props.children;
|
|
8
|
-
node = Array.isArray(children) ? jsxFn(tag, props, children) : jsxFn(tag, props, [children]);
|
|
9
|
-
}
|
|
10
|
-
node.key = key;
|
|
11
|
-
return node;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
1
|
+
import { t as Fragment } from "../base-D_6kfOr-.js";
|
|
2
|
+
import { t as jsxDEV } from "../jsx-dev-runtime-B4WTyq8r.js";
|
|
14
3
|
export { Fragment, jsxDEV };
|
package/lib/jsx/jsx-runtime.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as HtmlEscapedString } from "../html-SllAe0YT.js";
|
|
2
|
-
import { html } from "../
|
|
2
|
+
import { t as html } from "../index-dAzQsJG9.js";
|
|
3
3
|
import { a as JSX, i as Fragment } from "../base-BpQy2Rk7.js";
|
|
4
|
-
import { jsxDEV } from "
|
|
4
|
+
import { t as jsxDEV } from "../jsx-dev-runtime-CGt4kNYr.js";
|
|
5
5
|
|
|
6
6
|
//#region ../../plugins/acryl-router/src/core/jsx/jsx-runtime.d.ts
|
|
7
7
|
declare const jsxAttr: (key: string, v: string | Promise<string> | Record<string, string | number | null | undefined | boolean>) => HtmlEscapedString | Promise<HtmlEscapedString>;
|
package/lib/jsx/jsx-runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as styleObjectForEach, p as isValidAttributeName, t as Fragment } from "../base-
|
|
2
|
-
import { escapeToBuffer,
|
|
3
|
-
import { html } from "../html.js";
|
|
4
|
-
import { jsxDEV } from "
|
|
1
|
+
import { h as styleObjectForEach, p as isValidAttributeName, t as Fragment } from "../base-D_6kfOr-.js";
|
|
2
|
+
import { n as escapeToBuffer, o as stringBufferToString, r as raw } from "../html-DGExBFNg.js";
|
|
3
|
+
import { t as html } from "../html-CgNa89xw.js";
|
|
4
|
+
import { t as jsxDEV } from "../jsx-dev-runtime-B4WTyq8r.js";
|
|
5
5
|
//#region ../../plugins/acryl-router/src/core/jsx/jsx-runtime.ts
|
|
6
6
|
const jsxAttr = (key, v) => {
|
|
7
7
|
if (!isValidAttributeName(key)) return raw("");
|
package/lib/jsx/streaming.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as renderToReadableStream, n as StreamingContext, r as Suspense } from "../components-
|
|
1
|
+
import { i as renderToReadableStream, n as StreamingContext, r as Suspense } from "../components-B2ka9Ax1.js";
|
|
2
2
|
export { StreamingContext, Suspense, renderToReadableStream };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { E as useContext, a as isValidElement, c as memo, g as Children, l as reactAPICompatVersion, o as jsx, r as cloneElement, t as Fragment, w as createContext } from "./base-D_6kfOr-.js";
|
|
2
|
+
import { _ as useState, a as use, b as useViewTransition, c as useDeferredValue, d as useImperativeHandle, f as useInsertionEffect, g as useRef, h as useReducer, i as startViewTransition, l as useEffect, m as useMemo, n as forwardRef, o as useCallback, p as useLayoutEffect, r as startTransition, s as useDebugValue, t as createRef, u as useId, v as useSyncExternalStore, y as useTransition } from "./hooks-CfC07ri0.js";
|
|
3
|
+
import { a as useOptimistic, r as useActionState } from "./jsx-dev-runtime-BLfA-EhI.js";
|
|
4
|
+
import { r as Suspense, t as ErrorBoundary } from "./components-B2ka9Ax1.js";
|
|
5
|
+
//#region ../../plugins/acryl-router/src/core/jsx/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* @module
|
|
8
|
+
* JSX for Acryl.
|
|
9
|
+
*/
|
|
10
|
+
var jsx_default = {
|
|
11
|
+
version: reactAPICompatVersion,
|
|
12
|
+
memo,
|
|
13
|
+
Fragment,
|
|
14
|
+
StrictMode: Fragment,
|
|
15
|
+
isValidElement,
|
|
16
|
+
createElement: jsx,
|
|
17
|
+
cloneElement,
|
|
18
|
+
ErrorBoundary,
|
|
19
|
+
createContext,
|
|
20
|
+
useContext,
|
|
21
|
+
useState,
|
|
22
|
+
useEffect,
|
|
23
|
+
useRef,
|
|
24
|
+
useCallback,
|
|
25
|
+
useReducer,
|
|
26
|
+
useId,
|
|
27
|
+
useDebugValue,
|
|
28
|
+
use,
|
|
29
|
+
startTransition,
|
|
30
|
+
useTransition,
|
|
31
|
+
useDeferredValue,
|
|
32
|
+
startViewTransition,
|
|
33
|
+
useViewTransition,
|
|
34
|
+
useMemo,
|
|
35
|
+
useLayoutEffect,
|
|
36
|
+
useInsertionEffect,
|
|
37
|
+
createRef,
|
|
38
|
+
forwardRef,
|
|
39
|
+
useImperativeHandle,
|
|
40
|
+
useSyncExternalStore,
|
|
41
|
+
useActionState,
|
|
42
|
+
useOptimistic,
|
|
43
|
+
Suspense,
|
|
44
|
+
Children
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { jsx_default as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { s as jsxFn } from "./base-D_6kfOr-.js";
|
|
2
|
+
//#region ../../plugins/acryl-router/src/core/jsx/jsx-dev-runtime.ts
|
|
3
|
+
function jsxDEV(tag, props, key) {
|
|
4
|
+
let node;
|
|
5
|
+
if (!props || !("children" in props)) node = jsxFn(tag, props, []);
|
|
6
|
+
else {
|
|
7
|
+
const children = props.children;
|
|
8
|
+
node = Array.isArray(children) ? jsxFn(tag, props, children) : jsxFn(tag, props, [children]);
|
|
9
|
+
}
|
|
10
|
+
node.key = key;
|
|
11
|
+
return node;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { jsxDEV as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as createContext, E as useContext, O as __exportAll, S as shouldDeDupeByKey, b as domRenderers, v as dataPrecedenceAttr, x as isStylesheetLinkWithPrecedence, y as deDupeKeyMap } from "./base-
|
|
1
|
+
import { D as createContext, E as useContext, O as __exportAll, S as shouldDeDupeByKey, b as domRenderers, v as dataPrecedenceAttr, x as isStylesheetLinkWithPrecedence, y as deDupeKeyMap } from "./base-D_6kfOr-.js";
|
|
2
2
|
import { o as PERMALINK } from "./constants-BR9jM9BC.js";
|
|
3
|
-
import { C as createPortal, T as getNameSpaceContext, _ as useState, a as use, m as useMemo, o as useCallback } from "./hooks-
|
|
3
|
+
import { C as createPortal, T as getNameSpaceContext, _ as useState, a as use, m as useMemo, o as useCallback } from "./hooks-CfC07ri0.js";
|
|
4
4
|
//#region ../../plugins/acryl-router/src/core/jsx/dom/hooks/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* Provide hooks used only in jsx/dom
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { o as JSXNode } from "./base-BpQy2Rk7.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../plugins/acryl-router/src/core/jsx/jsx-dev-runtime.d.ts
|
|
4
|
+
declare function jsxDEV(tag: string | Function, props: Record<string, unknown>, key?: string): JSXNode;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { jsxDEV as t };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { E as useContext, o as jsx, t as Fragment, w as createContext } from "./base-D_6kfOr-.js";
|
|
2
|
+
import { r as raw } from "./html-DGExBFNg.js";
|
|
3
|
+
import { t as html } from "./html-CgNa89xw.js";
|
|
4
|
+
import { i as renderToReadableStream } from "./components-B2ka9Ax1.js";
|
|
5
|
+
import "./jsx-CUQgttxU.js";
|
|
6
|
+
//#region ../../plugins/acryl-router/src/core/middleware/jsx-renderer/index.ts
|
|
7
|
+
const RequestContext = createContext(null);
|
|
8
|
+
const createRenderer = (c, Layout, component, options) => (children, props) => {
|
|
9
|
+
options = typeof options === "function" ? options(c) : options;
|
|
10
|
+
const docType = typeof options?.docType === "string" ? options.docType : options?.docType === false ? "" : "<!DOCTYPE html>";
|
|
11
|
+
const currentLayout = component ? jsx((props) => component(props, c), {
|
|
12
|
+
Layout,
|
|
13
|
+
...props
|
|
14
|
+
}, children) : children;
|
|
15
|
+
const body = html`${raw(docType)}${jsx(RequestContext.Provider, { value: c }, currentLayout)}`;
|
|
16
|
+
if (options?.stream) {
|
|
17
|
+
if (options.stream === true) {
|
|
18
|
+
c.header("Transfer-Encoding", "chunked");
|
|
19
|
+
c.header("Content-Type", "text/html; charset=UTF-8");
|
|
20
|
+
c.header("Content-Encoding", "Identity");
|
|
21
|
+
} else for (const [key, value] of Object.entries(options.stream)) c.header(key, value);
|
|
22
|
+
return c.body(renderToReadableStream(body));
|
|
23
|
+
} else return c.html(body);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* JSX Renderer Middleware for acryl.
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
* @param {ComponentWithChildren} [component] - The component to render, which can accept children and props.
|
|
30
|
+
* @param {RendererOptions} [options] - The options for the JSX renderer middleware.
|
|
31
|
+
* @param {boolean | string} [options.docType=true] - The DOCTYPE to be added at the beginning of the HTML. If set to false, no DOCTYPE will be added.
|
|
32
|
+
* @param {boolean | Record<string, string>} [options.stream=false] - If set to true, enables streaming response with default headers. If a record is provided, custom headers will be used.
|
|
33
|
+
* @returns {MiddlewareHandler} The middleware handler function.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const app = new Acryl()
|
|
38
|
+
*
|
|
39
|
+
* app.get(
|
|
40
|
+
* '/page/*',
|
|
41
|
+
* jsxRenderer(({ children }) => {
|
|
42
|
+
* return (
|
|
43
|
+
* <html>
|
|
44
|
+
* <body>
|
|
45
|
+
* <header>Menu</header>
|
|
46
|
+
* <div>{children}</div>
|
|
47
|
+
* </body>
|
|
48
|
+
* </html>
|
|
49
|
+
* )
|
|
50
|
+
* })
|
|
51
|
+
* )
|
|
52
|
+
*
|
|
53
|
+
* app.get('/page/about', (c) => {
|
|
54
|
+
* return c.render(<h1>About me!</h1>)
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
const jsxRenderer = (component, options) => function jsxRenderer(c, next) {
|
|
59
|
+
const Layout = c.getLayout() ?? Fragment;
|
|
60
|
+
if (component) c.setLayout((props) => {
|
|
61
|
+
return component({
|
|
62
|
+
...props,
|
|
63
|
+
Layout
|
|
64
|
+
}, c);
|
|
65
|
+
});
|
|
66
|
+
c.setRenderer(createRenderer(c, Layout, component, options));
|
|
67
|
+
return next();
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* useRequestContext for Acryl.
|
|
71
|
+
*
|
|
72
|
+
* @template E - The environment type.
|
|
73
|
+
* @template P - The parameter type.
|
|
74
|
+
* @template I - The input type.
|
|
75
|
+
* @returns {Context<E, P, I>} An instance of Context.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const RequestUrlBadge: FC = () => {
|
|
80
|
+
* const c = useRequestContext()
|
|
81
|
+
* return <b>{c.req.url}</b>
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* app.get('/page/info', (c) => {
|
|
85
|
+
* return c.render(
|
|
86
|
+
* <div>
|
|
87
|
+
* You are accessing: <RequestUrlBadge />
|
|
88
|
+
* </div>
|
|
89
|
+
* )
|
|
90
|
+
* })
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
const useRequestContext = () => {
|
|
94
|
+
const c = useContext(RequestContext);
|
|
95
|
+
if (!c) throw new Error("RequestContext is not provided.");
|
|
96
|
+
return c;
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { jsxRenderer as n, useRequestContext as r, RequestContext as t };
|
package/lib/jsx-renderer.js
CHANGED
|
@@ -1,99 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { raw } from "./utils/html.js";
|
|
3
|
-
import { html } from "./html.js";
|
|
4
|
-
import { i as renderToReadableStream } from "./components-cEW3ovK0.js";
|
|
5
|
-
import "./jsx.js";
|
|
6
|
-
//#region ../../plugins/acryl-router/src/core/middleware/jsx-renderer/index.ts
|
|
7
|
-
const RequestContext = createContext(null);
|
|
8
|
-
const createRenderer = (c, Layout, component, options) => (children, props) => {
|
|
9
|
-
options = typeof options === "function" ? options(c) : options;
|
|
10
|
-
const docType = typeof options?.docType === "string" ? options.docType : options?.docType === false ? "" : "<!DOCTYPE html>";
|
|
11
|
-
const currentLayout = component ? jsx((props) => component(props, c), {
|
|
12
|
-
Layout,
|
|
13
|
-
...props
|
|
14
|
-
}, children) : children;
|
|
15
|
-
const body = html`${raw(docType)}${jsx(RequestContext.Provider, { value: c }, currentLayout)}`;
|
|
16
|
-
if (options?.stream) {
|
|
17
|
-
if (options.stream === true) {
|
|
18
|
-
c.header("Transfer-Encoding", "chunked");
|
|
19
|
-
c.header("Content-Type", "text/html; charset=UTF-8");
|
|
20
|
-
c.header("Content-Encoding", "Identity");
|
|
21
|
-
} else for (const [key, value] of Object.entries(options.stream)) c.header(key, value);
|
|
22
|
-
return c.body(renderToReadableStream(body));
|
|
23
|
-
} else return c.html(body);
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* JSX Renderer Middleware for acryl.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @param {ComponentWithChildren} [component] - The component to render, which can accept children and props.
|
|
30
|
-
* @param {RendererOptions} [options] - The options for the JSX renderer middleware.
|
|
31
|
-
* @param {boolean | string} [options.docType=true] - The DOCTYPE to be added at the beginning of the HTML. If set to false, no DOCTYPE will be added.
|
|
32
|
-
* @param {boolean | Record<string, string>} [options.stream=false] - If set to true, enables streaming response with default headers. If a record is provided, custom headers will be used.
|
|
33
|
-
* @returns {MiddlewareHandler} The middleware handler function.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* const app = new Acryl()
|
|
38
|
-
*
|
|
39
|
-
* app.get(
|
|
40
|
-
* '/page/*',
|
|
41
|
-
* jsxRenderer(({ children }) => {
|
|
42
|
-
* return (
|
|
43
|
-
* <html>
|
|
44
|
-
* <body>
|
|
45
|
-
* <header>Menu</header>
|
|
46
|
-
* <div>{children}</div>
|
|
47
|
-
* </body>
|
|
48
|
-
* </html>
|
|
49
|
-
* )
|
|
50
|
-
* })
|
|
51
|
-
* )
|
|
52
|
-
*
|
|
53
|
-
* app.get('/page/about', (c) => {
|
|
54
|
-
* return c.render(<h1>About me!</h1>)
|
|
55
|
-
* })
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
const jsxRenderer = (component, options) => function jsxRenderer(c, next) {
|
|
59
|
-
const Layout = c.getLayout() ?? Fragment;
|
|
60
|
-
if (component) c.setLayout((props) => {
|
|
61
|
-
return component({
|
|
62
|
-
...props,
|
|
63
|
-
Layout
|
|
64
|
-
}, c);
|
|
65
|
-
});
|
|
66
|
-
c.setRenderer(createRenderer(c, Layout, component, options));
|
|
67
|
-
return next();
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* useRequestContext for Acryl.
|
|
71
|
-
*
|
|
72
|
-
* @template E - The environment type.
|
|
73
|
-
* @template P - The parameter type.
|
|
74
|
-
* @template I - The input type.
|
|
75
|
-
* @returns {Context<E, P, I>} An instance of Context.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```ts
|
|
79
|
-
* const RequestUrlBadge: FC = () => {
|
|
80
|
-
* const c = useRequestContext()
|
|
81
|
-
* return <b>{c.req.url}</b>
|
|
82
|
-
* }
|
|
83
|
-
*
|
|
84
|
-
* app.get('/page/info', (c) => {
|
|
85
|
-
* return c.render(
|
|
86
|
-
* <div>
|
|
87
|
-
* You are accessing: <RequestUrlBadge />
|
|
88
|
-
* </div>
|
|
89
|
-
* )
|
|
90
|
-
* })
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
const useRequestContext = () => {
|
|
94
|
-
const c = useContext(RequestContext);
|
|
95
|
-
if (!c) throw new Error("RequestContext is not provided.");
|
|
96
|
-
return c;
|
|
97
|
-
};
|
|
98
|
-
//#endregion
|
|
1
|
+
import { n as jsxRenderer, r as useRequestContext, t as RequestContext } from "./jsx-renderer-CfifM4hT.js";
|
|
99
2
|
export { RequestContext, jsxRenderer, useRequestContext };
|
package/lib/jsx.js
CHANGED
|
@@ -1,47 +1,6 @@
|
|
|
1
|
-
import { E as useContext, a as isValidElement, c as memo, g as Children, l as reactAPICompatVersion, o as jsx, r as cloneElement, t as Fragment, w as createContext } from "./base-
|
|
2
|
-
import { _ as useState, a as use, b as useViewTransition, c as useDeferredValue, d as useImperativeHandle, f as useInsertionEffect, g as useRef, h as useReducer, i as startViewTransition, l as useEffect, m as useMemo, n as forwardRef, o as useCallback, p as useLayoutEffect, r as startTransition, s as useDebugValue, t as createRef, u as useId, v as useSyncExternalStore, y as useTransition } from "./hooks-
|
|
3
|
-
import { a as useOptimistic, r as useActionState } from "./jsx-dev-runtime-
|
|
4
|
-
import { r as Suspense, t as ErrorBoundary } from "./components-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @module
|
|
8
|
-
* JSX for Acryl.
|
|
9
|
-
*/
|
|
10
|
-
var jsx_default = {
|
|
11
|
-
version: reactAPICompatVersion,
|
|
12
|
-
memo,
|
|
13
|
-
Fragment,
|
|
14
|
-
StrictMode: Fragment,
|
|
15
|
-
isValidElement,
|
|
16
|
-
createElement: jsx,
|
|
17
|
-
cloneElement,
|
|
18
|
-
ErrorBoundary,
|
|
19
|
-
createContext,
|
|
20
|
-
useContext,
|
|
21
|
-
useState,
|
|
22
|
-
useEffect,
|
|
23
|
-
useRef,
|
|
24
|
-
useCallback,
|
|
25
|
-
useReducer,
|
|
26
|
-
useId,
|
|
27
|
-
useDebugValue,
|
|
28
|
-
use,
|
|
29
|
-
startTransition,
|
|
30
|
-
useTransition,
|
|
31
|
-
useDeferredValue,
|
|
32
|
-
startViewTransition,
|
|
33
|
-
useViewTransition,
|
|
34
|
-
useMemo,
|
|
35
|
-
useLayoutEffect,
|
|
36
|
-
useInsertionEffect,
|
|
37
|
-
createRef,
|
|
38
|
-
forwardRef,
|
|
39
|
-
useImperativeHandle,
|
|
40
|
-
useSyncExternalStore,
|
|
41
|
-
useActionState,
|
|
42
|
-
useOptimistic,
|
|
43
|
-
Suspense,
|
|
44
|
-
Children
|
|
45
|
-
};
|
|
46
|
-
//#endregion
|
|
1
|
+
import { E as useContext, a as isValidElement, c as memo, g as Children, l as reactAPICompatVersion, o as jsx, r as cloneElement, t as Fragment, w as createContext } from "./base-D_6kfOr-.js";
|
|
2
|
+
import { _ as useState, a as use, b as useViewTransition, c as useDeferredValue, d as useImperativeHandle, f as useInsertionEffect, g as useRef, h as useReducer, i as startViewTransition, l as useEffect, m as useMemo, n as forwardRef, o as useCallback, p as useLayoutEffect, r as startTransition, s as useDebugValue, t as createRef, u as useId, v as useSyncExternalStore, y as useTransition } from "./hooks-CfC07ri0.js";
|
|
3
|
+
import { a as useOptimistic, r as useActionState } from "./jsx-dev-runtime-BLfA-EhI.js";
|
|
4
|
+
import { r as Suspense, t as ErrorBoundary } from "./components-B2ka9Ax1.js";
|
|
5
|
+
import { t as jsx_default } from "./jsx-CUQgttxU.js";
|
|
47
6
|
export { Children, ErrorBoundary, Fragment, Fragment as StrictMode, Suspense, cloneElement, createContext, jsx as createElement, jsx, createRef, jsx_default as default, forwardRef, isValidElement, memo, startTransition, startViewTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition, reactAPICompatVersion as version };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HTTPException } from "./http-exception.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as Jwt } from "./jwt-
|
|
1
|
+
import { t as HTTPException } from "./http-exception-MjWkT89V.js";
|
|
2
|
+
import { a as getSignedCookie, i as getCookie } from "./cookie-BHIduy2T.js";
|
|
3
|
+
import { t as Jwt } from "./jwt-BXoIA2fQ.js";
|
|
4
4
|
//#region ../../plugins/acryl-router/src/core/middleware/jwk/jwk.ts
|
|
5
5
|
/**
|
|
6
6
|
* JWK Auth Middleware for Acryl.
|
package/lib/jwk.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as jwk } from "./jwk-
|
|
1
|
+
import { t as jwk } from "./jwk-CDPpYQpD.js";
|
|
2
2
|
export { jwk };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getRuntimeKey } from "./adapter.js";
|
|
1
|
+
import { i as encodeBase64Url, n as decodeBase64Url, t as decodeBase64 } from "./encode-BhbNLrjp.js";
|
|
2
|
+
import { r as getRuntimeKey } from "./adapter-CaZ6FZUU.js";
|
|
3
3
|
//#region ../../plugins/acryl-router/src/core/utils/jwt/jwa.ts
|
|
4
4
|
/**
|
|
5
5
|
* @module
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HTTPException } from "./http-exception.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as Jwt } from "./jwt-
|
|
1
|
+
import { t as HTTPException } from "./http-exception-MjWkT89V.js";
|
|
2
|
+
import { a as getSignedCookie, i as getCookie } from "./cookie-BHIduy2T.js";
|
|
3
|
+
import { t as Jwt } from "./jwt-BXoIA2fQ.js";
|
|
4
4
|
//#region ../../plugins/acryl-router/src/core/middleware/jwt/jwt.ts
|
|
5
5
|
/**
|
|
6
6
|
* JWT Auth Middleware for Acryl.
|
package/lib/jwt.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as AlgorithmTypes } from "./jwt-
|
|
2
|
-
import { a as verifyWithJwks, i as verify, n as jwt, r as sign, t as decode } from "./jwt-
|
|
1
|
+
import { n as AlgorithmTypes } from "./jwt-BXoIA2fQ.js";
|
|
2
|
+
import { a as verifyWithJwks, i as verify, n as jwt, r as sign, t as decode } from "./jwt-lyS4Q3mT.js";
|
|
3
3
|
export { AlgorithmTypes, decode, jwt, sign, verify, verifyWithJwks };
|
package/lib/kv/db.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { t as Db } from "../database-DBHdwefi.js";
|
|
2
1
|
import { n as Kv } from "../kv-9f-AlRKN.js";
|
|
3
|
-
|
|
4
|
-
//#region ../../plugins/acryl-kv-db/src/open.d.ts
|
|
5
|
-
interface KvOnDbOptions {
|
|
6
|
-
/** The table that holds the documents. Defaults to `kv`; a plain SQL identifier. */
|
|
7
|
-
readonly table?: string;
|
|
8
|
-
}
|
|
9
|
-
/** The `kv` port over a `db`. It does not own the database: whoever opened it closes it, and calls after that reject. */
|
|
10
|
-
declare function kvOnDb(db: Db, options?: KvOnDbOptions): Kv;
|
|
11
|
-
//#endregion
|
|
2
|
+
import { n as kvOnDb, t as KvOnDbOptions } from "../open-CULVJgOc.js";
|
|
12
3
|
export { type Kv, KvOnDbOptions, kvOnDb };
|
package/lib/kv/db.js
CHANGED
|
@@ -1,57 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region ../../plugins/acryl-kv-db/src/open.ts
|
|
3
|
-
const IDENTIFIER = /^[a-z_][a-z0-9_]*$/u;
|
|
4
|
-
/** The `kv` port over a `db`. It does not own the database: whoever opened it closes it, and calls after that reject. */
|
|
5
|
-
function kvOnDb(db, options = {}) {
|
|
6
|
-
const table = options.table ?? "kv";
|
|
7
|
-
if (!IDENTIFIER.test(table)) throw new TypeError(`acryl-kv-db: the table name must be a plain lower case SQL identifier, got ${JSON.stringify(table)}`);
|
|
8
|
-
let ready;
|
|
9
|
-
const ensure = () => {
|
|
10
|
-
ready ??= db.exec(`CREATE TABLE IF NOT EXISTS ${table} (key TEXT PRIMARY KEY, value TEXT NOT NULL)`).catch((error) => {
|
|
11
|
-
ready = void 0;
|
|
12
|
-
throw error;
|
|
13
|
-
});
|
|
14
|
-
return ready;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Run a statement after the table exists. The table's statement and this one are both handed to the database at once (its queue keeps
|
|
18
|
-
* their order), so a `close()` called right after a write cannot slip between them and leave the write on a closed database.
|
|
19
|
-
*/
|
|
20
|
-
const after = async (work) => {
|
|
21
|
-
const created = ensure();
|
|
22
|
-
const result = work();
|
|
23
|
-
const [, value] = await Promise.all([created, result]);
|
|
24
|
-
return value;
|
|
25
|
-
};
|
|
26
|
-
const upsert = `INSERT INTO ${table} (key, value) VALUES (?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value`;
|
|
27
|
-
return {
|
|
28
|
-
async get(key) {
|
|
29
|
-
checkKey(key);
|
|
30
|
-
const row = await after(() => db.get(`SELECT value FROM ${table} WHERE key = ?`, key));
|
|
31
|
-
return row === void 0 ? void 0 : decodeValue(row.value);
|
|
32
|
-
},
|
|
33
|
-
async set(key, value) {
|
|
34
|
-
checkKey(key);
|
|
35
|
-
const text = encodeValue(value);
|
|
36
|
-
await after(() => db.run(upsert, key, text));
|
|
37
|
-
},
|
|
38
|
-
async update(key, change) {
|
|
39
|
-
checkKey(key);
|
|
40
|
-
return after(() => db.transaction(async (tx) => {
|
|
41
|
-
const row = await tx.get(`SELECT value FROM ${table} WHERE key = ?`, key);
|
|
42
|
-
const text = encodeValue(runChange(change, row === void 0 ? void 0 : decodeValue(row.value)));
|
|
43
|
-
await tx.run(upsert, key, text);
|
|
44
|
-
return decodeValue(text);
|
|
45
|
-
}));
|
|
46
|
-
},
|
|
47
|
-
async delete(key) {
|
|
48
|
-
checkKey(key);
|
|
49
|
-
await after(() => db.run(`DELETE FROM ${table} WHERE key = ?`, key));
|
|
50
|
-
},
|
|
51
|
-
async list(prefix = "") {
|
|
52
|
-
return (await after(() => prefix === "" ? db.all(`SELECT key FROM ${table}`) : db.all(`SELECT key FROM ${table} WHERE substr(key, 1, ?) = ?`, codePoints(prefix), prefix))).map((row) => row.key).sort(compareKeys);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
1
|
+
import { t as kvOnDb } from "../open-But9E2rL.js";
|
|
57
2
|
export { kvOnDb };
|
package/lib/kv/json.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
import { n as Kv, 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
|
|
2
|
+
import { n as openKv, t as OpenKvOptions } from "../open-BqK4D2Wn.js";
|
|
11
3
|
export { type Kv, type KvOpened, OpenKvOptions, openKv };
|