acrylblends 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/docs/framework/README.md +3 -2
- package/docs/framework/UPSTREAM.md +1 -1
- package/docs/framework/cordis/acryl-in-a-cordis-app.md +6 -0
- package/docs/framework/getting-started/basic.md +1 -0
- package/docs/framework/getting-started/desktop.md +41 -0
- package/docs/framework/guides/jsx-dom.md +0 -3
- package/docs/framework/guides/jsx.md +24 -3
- package/docs/framework/helpers/css.md +0 -3
- package/docs/framework/helpers/ssg.md +3 -6
- package/docs/framework/middleware/builtin/jsx-renderer.md +0 -3
- package/docs/framework/upstream.json +3 -3
- package/lib/accepts.d.ts +1 -1
- package/lib/acryl-base.d.ts +1 -1
- package/lib/adapter.d.ts +1 -1
- package/lib/{app-BdrVHBlJ.d.ts → app-D8riatvv.d.ts} +1 -1
- package/lib/base-BpQy2Rk7.d.ts +783 -0
- package/lib/base-ddiVmiE7.js +721 -0
- package/lib/basic-auth.d.ts +1 -1
- package/lib/bearer-auth.d.ts +1 -1
- package/lib/body-limit.d.ts +1 -1
- package/lib/cache.d.ts +1 -1
- package/lib/cache.js +4 -4
- package/lib/{client-BHTr318g.js → client-DDLXwhBo.js} +2 -125
- package/lib/client.d.ts +2 -2
- package/lib/client.js +2 -1
- package/lib/combine.d.ts +1 -1
- package/lib/common-D8Z4JRCw.d.ts +46 -0
- package/lib/components-0o0CBYNv.js +268 -0
- package/lib/components-DdI7-ns7.js +24 -0
- package/lib/compress.d.ts +1 -1
- package/lib/conninfo.d.ts +2 -2
- package/lib/constants-BR9jM9BC.js +9 -0
- package/lib/{context-B5Y1lLha.d.ts → context-DS3fYyG-.d.ts} +2 -2
- package/lib/context-DxFdY_un.d.ts +250 -0
- package/lib/context-storage.d.ts +1 -1
- package/lib/{cookie-D9_nQbsM.d.ts → cookie-CCelEqky.d.ts} +1 -1
- package/lib/cookie.d.ts +3 -3
- package/lib/cors.d.ts +1 -1
- package/lib/csrf.d.ts +1 -1
- package/lib/css-D2jb7X8b.js +320 -0
- package/lib/css.d.ts +82 -0
- package/lib/css.js +134 -0
- package/lib/dev.d.ts +2 -2
- package/lib/etag.d.ts +1 -1
- package/lib/factory.d.ts +2 -2
- package/lib/hooks-BMw6BAyP.js +762 -0
- package/lib/html-SllAe0YT.d.ts +46 -0
- package/lib/html.d.ts +1 -1
- package/lib/{index-m12zcmph.d.ts → index-Bb7YJKCq.d.ts} +3 -3
- package/lib/{index-Kqou8Fjh.d.ts → index-BvFh1Gfx.d.ts} +2 -2
- package/lib/index-C850MeBA.d.ts +94 -0
- package/lib/{index-DtEoak1i.d.ts → index-CTy4N7ng.d.ts} +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/ip-restriction.d.ts +2 -2
- package/lib/jsx/dom/client.d.ts +30 -0
- package/lib/jsx/dom/client.js +49 -0
- package/lib/jsx/dom/css.d.ts +84 -0
- package/lib/jsx/dom/css.js +2 -0
- package/lib/jsx/dom/jsx-dev-runtime.d.ts +3 -0
- package/lib/jsx/dom/jsx-dev-runtime.js +2 -0
- package/lib/jsx/dom/jsx-runtime.d.ts +3 -0
- package/lib/jsx/dom/jsx-runtime.js +2 -0
- package/lib/jsx/dom/server.d.ts +105 -0
- package/lib/jsx/dom/server.js +37 -0
- package/lib/jsx/dom.d.ts +5 -0
- package/lib/jsx/dom.js +74 -0
- package/lib/jsx/jsx-dev-runtime.d.ts +6 -0
- package/lib/jsx/jsx-dev-runtime.js +14 -0
- package/lib/jsx/jsx-runtime.d.ts +10 -0
- package/lib/jsx/jsx-runtime.js +30 -0
- package/lib/jsx/streaming.d.ts +2 -0
- package/lib/jsx/streaming.js +2 -0
- package/lib/jsx-dev-runtime-B22O-Npk.d.ts +7 -0
- package/lib/jsx-dev-runtime-D18Y35TI.js +354 -0
- package/lib/jsx-renderer.d.ts +75 -0
- package/lib/jsx-renderer.js +99 -0
- package/lib/jsx-runtime-BVVgDSdq.d.ts +1 -0
- package/lib/jsx.d.ts +3 -0
- package/lib/jsx.js +47 -0
- package/lib/jwk.d.ts +4 -4
- package/lib/{jwt-BA65QhnJ.d.ts → jwt-BARhotDz.d.ts} +1 -1
- package/lib/jwt.d.ts +4 -4
- package/lib/language.d.ts +1 -1
- package/lib/logger.d.ts +1 -1
- package/lib/loopback-only.d.ts +1 -1
- package/lib/method-not-allowed.d.ts +2 -2
- package/lib/method-override.d.ts +2 -2
- package/lib/mount.d.ts +1 -1
- package/lib/node-server/conninfo.d.ts +1 -1
- package/lib/node-server/serve-static.d.ts +1 -1
- package/lib/node-server/serve-static.js +1 -1
- package/lib/node-server.d.ts +1 -1
- package/lib/node-server.js +1 -1
- package/lib/powered-by.d.ts +1 -1
- package/lib/pretty-json.d.ts +1 -1
- package/lib/proxy.d.ts +1 -1
- package/lib/quick.d.ts +1 -1
- package/lib/request-id.d.ts +1 -1
- package/lib/request.d.ts +1 -1
- package/lib/route.d.ts +1 -1
- package/lib/schema-validator.d.ts +1 -1
- package/lib/secure-headers.d.ts +1 -1
- package/lib/{serve-static-Dw_m6KxR.js → serve-static-B14MF1Va.js} +2 -0
- package/lib/serve-static.d.ts +1 -1
- package/lib/ssg-BwjcA-Ge.js +389 -0
- package/lib/ssg.d.ts +156 -0
- package/lib/ssg.js +2 -0
- package/lib/streaming.d.ts +1 -1
- package/lib/testing.d.ts +4 -4
- package/lib/testing.js +1 -1
- package/lib/timeout.d.ts +1 -1
- package/lib/timing.d.ts +1 -1
- package/lib/tiny.d.ts +1 -1
- package/lib/trailing-slash.d.ts +1 -1
- package/lib/{types-ZM9gIiKh.d.ts → types-Dv_nV2cv.d.ts} +1 -1
- package/lib/{types-D9DEXMjE.d.ts → types-Lqx5BxQF.d.ts} +8 -1
- package/lib/{types-Bd29gh2o.d.ts → types-zNxyEpG2.d.ts} +3 -3
- package/lib/types.d.ts +1 -1
- package/lib/utils/body.d.ts +1 -1
- package/lib/utils/cookie.d.ts +1 -1
- package/lib/utils/crypto.d.ts +1 -1
- package/lib/utils/html.d.ts +1 -45
- package/lib/utils/ipaddr.d.ts +1 -1
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/types.d.ts +2 -2
- package/lib/utils-Cx61GFMC.js +125 -0
- package/lib/validator.d.ts +2 -2
- package/lib/ws.d.ts +1 -1
- package/package.json +53 -1
- package/plugins/acryl-inspect/upstream.json +1 -1
- package/plugins/acryl-node-server/upstream.json +1 -1
- package/plugins/acryl-router/src/core/helper/css/common.ts +337 -0
- package/plugins/acryl-router/src/core/helper/css/index.ts +262 -0
- package/plugins/acryl-router/src/core/helper/ssg/index.ts +14 -0
- package/plugins/acryl-router/src/core/helper/ssg/middleware.ts +83 -0
- package/plugins/acryl-router/src/core/helper/ssg/plugins.ts +72 -0
- package/plugins/acryl-router/src/core/helper/ssg/ssg.ts +471 -0
- package/plugins/acryl-router/src/core/helper/ssg/utils.ts +118 -0
- package/plugins/acryl-router/src/core/jsx/base.ts +490 -0
- package/plugins/acryl-router/src/core/jsx/children.ts +20 -0
- package/plugins/acryl-router/src/core/jsx/components.ts +257 -0
- package/plugins/acryl-router/src/core/jsx/constants.ts +6 -0
- package/plugins/acryl-router/src/core/jsx/context.ts +266 -0
- package/plugins/acryl-router/src/core/jsx/dom/client.ts +89 -0
- package/plugins/acryl-router/src/core/jsx/dom/components.ts +39 -0
- package/plugins/acryl-router/src/core/jsx/dom/context.ts +52 -0
- package/plugins/acryl-router/src/core/jsx/dom/css.ts +263 -0
- package/plugins/acryl-router/src/core/jsx/dom/hooks/index.ts +91 -0
- package/plugins/acryl-router/src/core/jsx/dom/index.ts +170 -0
- package/plugins/acryl-router/src/core/jsx/dom/intrinsic-element/components.ts +438 -0
- package/plugins/acryl-router/src/core/jsx/dom/jsx-dev-runtime.ts +23 -0
- package/plugins/acryl-router/src/core/jsx/dom/jsx-runtime.ts +8 -0
- package/plugins/acryl-router/src/core/jsx/dom/render.ts +879 -0
- package/plugins/acryl-router/src/core/jsx/dom/server.ts +76 -0
- package/plugins/acryl-router/src/core/jsx/dom/utils.ts +7 -0
- package/plugins/acryl-router/src/core/jsx/hooks/index.ts +437 -0
- package/plugins/acryl-router/src/core/jsx/index.ts +115 -0
- package/plugins/acryl-router/src/core/jsx/intrinsic-element/common.ts +23 -0
- package/plugins/acryl-router/src/core/jsx/intrinsic-element/components.ts +210 -0
- package/plugins/acryl-router/src/core/jsx/intrinsic-elements.ts +938 -0
- package/plugins/acryl-router/src/core/jsx/jsx-dev-runtime.ts +26 -0
- package/plugins/acryl-router/src/core/jsx/jsx-runtime.ts +51 -0
- package/plugins/acryl-router/src/core/jsx/streaming.ts +231 -0
- package/plugins/acryl-router/src/core/jsx/types.ts +41 -0
- package/plugins/acryl-router/src/core/jsx/utils.ts +202 -0
- package/plugins/acryl-router/src/core/middleware/cache/index.ts +4 -4
- package/plugins/acryl-router/src/core/middleware/jsx-renderer/index.ts +162 -0
- package/plugins/acryl-router/src/core/utils/types.ts +6 -0
- package/plugins/acryl-router/src/helpers/index.ts +2 -0
- package/plugins/acryl-router/src/middleware/index.ts +1 -0
- package/plugins/acryl-router/upstream.json +3 -3
- package/plugins/acryl-router-http/upstream.json +1 -1
- package/plugins/acryl-state/upstream.json +1 -1
- package/plugins/desktop/upstream.json +1 -1
- package/plugins/desktop-web/upstream.json +1 -1
- package/plugins/extensions/resolve.ts +4 -0
- package/plugins/save/plugin.json +1 -1
- package/shared/AGENTS.core.md +4 -0
- package/templates/agent/tsconfig.json +7 -1
- package/templates/todo/upstream.json +1 -1
- package/plugins/acryl-inspect/tests/report.spec.ts +0 -69
- package/plugins/acryl-inspect/tests/service.spec.ts +0 -121
- package/plugins/acryl-node-server/tests/adapter/app.ts +0 -76
- package/plugins/acryl-node-server/tests/adapter/assets/.static/plain.txt +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/favicon.ico +0 -0
- package/plugins/acryl-node-server/tests/adapter/assets/secret.txt +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static/acryl.html +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static/admin/secret.txt +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static/data.json +0 -5
- package/plugins/acryl-node-server/tests/adapter/assets/static/extensionless +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static/foo..bar.txt +0 -0
- package/plugins/acryl-node-server/tests/adapter/assets/static/index.html +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static/plain.txt +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static-with-context-path/plain.txt +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static-with-precompressed/hello.bin +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static-with-precompressed/hello.bin.br +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static-with-precompressed/hello.txt +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static-with-precompressed/hello.txt.br +0 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static-with-precompressed/hello.txt.zst +0 -1
- package/plugins/acryl-node-server/tests/adapter/conninfo.test.ts +0 -34
- package/plugins/acryl-node-server/tests/adapter/content-length.test.ts +0 -248
- package/plugins/acryl-node-server/tests/adapter/early-hints.test.ts +0 -457
- package/plugins/acryl-node-server/tests/adapter/fixtures/keys/agent1-cert.pem +0 -23
- package/plugins/acryl-node-server/tests/adapter/fixtures/keys/agent1-key.pem +0 -27
- package/plugins/acryl-node-server/tests/adapter/headers.test.ts +0 -252
- package/plugins/acryl-node-server/tests/adapter/helpers/request.ts +0 -190
- package/plugins/acryl-node-server/tests/adapter/listener.test.ts +0 -727
- package/plugins/acryl-node-server/tests/adapter/request-client-disconnect.test.ts +0 -189
- package/plugins/acryl-node-server/tests/adapter/request.test.ts +0 -1230
- package/plugins/acryl-node-server/tests/adapter/response.test.ts +0 -285
- package/plugins/acryl-node-server/tests/adapter/serve-static.test.ts +0 -849
- package/plugins/acryl-node-server/tests/adapter/server-socket.test.ts +0 -790
- package/plugins/acryl-node-server/tests/adapter/server.test.ts +0 -1312
- package/plugins/acryl-node-server/tests/adapter/setup.ts +0 -16
- package/plugins/acryl-node-server/tests/adapter/url.test.ts +0 -76
- package/plugins/acryl-node-server/tests/adapter/utils/response.test.ts +0 -23
- package/plugins/acryl-node-server/tests/adapter/utils/stream.test.ts +0 -75
- package/plugins/acryl-node-server/tests/adapter/utils.test.ts +0 -235
- package/plugins/acryl-node-server/tests/adapter/websocket.test.ts +0 -260
- package/plugins/acryl-node-server/tests/server.spec.ts +0 -141
- package/plugins/acryl-router/src/core/app.test.ts +0 -3833
- package/plugins/acryl-router/src/core/client/client.test.ts +0 -2313
- package/plugins/acryl-router/src/core/client/types.test.ts +0 -149
- package/plugins/acryl-router/src/core/client/utils.test.ts +0 -405
- package/plugins/acryl-router/src/core/compose.test.ts +0 -751
- package/plugins/acryl-router/src/core/context.test.ts +0 -629
- package/plugins/acryl-router/src/core/helper/accepts/accepts.test.ts +0 -344
- package/plugins/acryl-router/src/core/helper/adapter/index.test.ts +0 -55
- package/plugins/acryl-router/src/core/helper/cookie/index.test.ts +0 -510
- package/plugins/acryl-router/src/core/helper/dev/index.test.ts +0 -181
- package/plugins/acryl-router/src/core/helper/factory/index.test.ts +0 -434
- package/plugins/acryl-router/src/core/helper/html/index.test.ts +0 -78
- package/plugins/acryl-router/src/core/helper/proxy/index.test.ts +0 -356
- package/plugins/acryl-router/src/core/helper/route/index.test.ts +0 -259
- package/plugins/acryl-router/src/core/helper/streaming/stream.test.ts +0 -128
- package/plugins/acryl-router/src/core/helper/streaming/text.test.ts +0 -34
- package/plugins/acryl-router/src/core/helper/testing/index.test.ts +0 -42
- package/plugins/acryl-router/src/core/helper/websocket/index.test.ts +0 -124
- package/plugins/acryl-router/src/core/http-exception.test.ts +0 -45
- package/plugins/acryl-router/src/core/middleware/basic-auth/index.test.ts +0 -434
- package/plugins/acryl-router/src/core/middleware/bearer-auth/index.test.ts +0 -1018
- package/plugins/acryl-router/src/core/middleware/body-limit/index.test.ts +0 -273
- package/plugins/acryl-router/src/core/middleware/cache/index.test.ts +0 -1211
- package/plugins/acryl-router/src/core/middleware/combine/index.test.ts +0 -355
- package/plugins/acryl-router/src/core/middleware/compress/index.test.ts +0 -535
- package/plugins/acryl-router/src/core/middleware/context-storage/index.test.ts +0 -43
- package/plugins/acryl-router/src/core/middleware/cors/index.test.ts +0 -532
- package/plugins/acryl-router/src/core/middleware/csrf/index.test.ts +0 -534
- package/plugins/acryl-router/src/core/middleware/etag/digest.test.ts +0 -21
- package/plugins/acryl-router/src/core/middleware/etag/index.test.ts +0 -503
- package/plugins/acryl-router/src/core/middleware/ip-restriction/index.test.ts +0 -217
- package/plugins/acryl-router/src/core/middleware/jwk/index.test.ts +0 -1135
- package/plugins/acryl-router/src/core/middleware/jwk/keys.test.json +0 -48
- package/plugins/acryl-router/src/core/middleware/jwt/index.test.ts +0 -802
- package/plugins/acryl-router/src/core/middleware/language/index.test.ts +0 -552
- package/plugins/acryl-router/src/core/middleware/logger/index.test.ts +0 -204
- package/plugins/acryl-router/src/core/middleware/method-not-allowed/index.test.ts +0 -292
- package/plugins/acryl-router/src/core/middleware/method-override/index.test.ts +0 -221
- package/plugins/acryl-router/src/core/middleware/mount/index.test.ts +0 -334
- package/plugins/acryl-router/src/core/middleware/powered-by/index.test.ts +0 -37
- package/plugins/acryl-router/src/core/middleware/pretty-json/index.test.ts +0 -218
- package/plugins/acryl-router/src/core/middleware/request-id/index.test.ts +0 -168
- package/plugins/acryl-router/src/core/middleware/secure-headers/index.test.ts +0 -671
- package/plugins/acryl-router/src/core/middleware/serve-static/index.test.ts +0 -450
- package/plugins/acryl-router/src/core/middleware/serve-static/path.test.ts +0 -50
- package/plugins/acryl-router/src/core/middleware/timeout/index.test.ts +0 -70
- package/plugins/acryl-router/src/core/middleware/timing/index.test.ts +0 -310
- package/plugins/acryl-router/src/core/middleware/trailing-slash/index.test.ts +0 -381
- package/plugins/acryl-router/src/core/preset/quick.test.ts +0 -42
- package/plugins/acryl-router/src/core/preset/tiny.test.ts +0 -42
- package/plugins/acryl-router/src/core/request.test.ts +0 -751
- package/plugins/acryl-router/src/core/router/common.case.test.ts +0 -1132
- package/plugins/acryl-router/src/core/router/linear-router/router.test.ts +0 -80
- package/plugins/acryl-router/src/core/router/pattern-router/router.test.ts +0 -46
- package/plugins/acryl-router/src/core/router/reg-exp-router/prepared-router.test.ts +0 -154
- package/plugins/acryl-router/src/core/router/reg-exp-router/router.test.ts +0 -265
- package/plugins/acryl-router/src/core/router/smart-router/router.test.ts +0 -13
- package/plugins/acryl-router/src/core/router/trie-router/node.test.ts +0 -896
- package/plugins/acryl-router/src/core/router/trie-router/router.test.ts +0 -8
- package/plugins/acryl-router/src/core/types.test.ts +0 -4134
- package/plugins/acryl-router/src/core/utils/accept.test.ts +0 -299
- package/plugins/acryl-router/src/core/utils/basic-auth.test.ts +0 -56
- package/plugins/acryl-router/src/core/utils/body.test.ts +0 -496
- package/plugins/acryl-router/src/core/utils/buffer.test.ts +0 -147
- package/plugins/acryl-router/src/core/utils/color.test.ts +0 -23
- package/plugins/acryl-router/src/core/utils/concurrent.test.ts +0 -69
- package/plugins/acryl-router/src/core/utils/cookie.test.ts +0 -460
- package/plugins/acryl-router/src/core/utils/crypto.test.ts +0 -43
- package/plugins/acryl-router/src/core/utils/encode.test.ts +0 -61
- package/plugins/acryl-router/src/core/utils/filepath.test.ts +0 -78
- package/plugins/acryl-router/src/core/utils/html.test.ts +0 -16
- package/plugins/acryl-router/src/core/utils/ipaddr.test.ts +0 -149
- package/plugins/acryl-router/src/core/utils/jwt/jwa.test.ts +0 -86
- package/plugins/acryl-router/src/core/utils/jwt/jwt.test.ts +0 -1788
- package/plugins/acryl-router/src/core/utils/mime.test.ts +0 -64
- package/plugins/acryl-router/src/core/utils/stream.test.ts +0 -212
- package/plugins/acryl-router/src/core/utils/types.test.ts +0 -295
- package/plugins/acryl-router/src/core/utils/url.test.ts +0 -384
- package/plugins/acryl-router/src/core/validator/utils.test.ts +0 -82
- package/plugins/acryl-router/src/core/validator/validator.test.ts +0 -1488
- package/plugins/acryl-router/tests/docs-examples.spec.ts +0 -152
- package/plugins/acryl-router/tests/live-install.spec.ts +0 -64
- package/plugins/acryl-router/tests/loader.spec.ts +0 -72
- package/plugins/acryl-router/tests/loopback-only.spec.ts +0 -80
- package/plugins/acryl-router/tests/no-dom/consumer.ts +0 -11
- package/plugins/acryl-router/tests/no-dom/tsconfig.json +0 -13
- package/plugins/acryl-router/tests/service.spec.ts +0 -426
- package/plugins/acryl-router/tests/shadow-state.spec.ts +0 -79
- package/plugins/acryl-router-http/tests/adapter.spec.ts +0 -174
- package/plugins/acryl-router-http/tests/stream.spec.ts +0 -133
- package/plugins/acryl-router-http/tests/surfaces.spec.ts +0 -101
- package/plugins/acryl-state/src/react.ts +0 -11
- package/plugins/acryl-state/tests/cell.spec.ts +0 -71
- package/plugins/acryl-state/tests/react.spec.ts +0 -39
- package/plugins/acryl-state/tests/service.spec.ts +0 -132
package/lib/basic-auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as MiddlewareHandler, t as Context } from "./context-DS3fYyG-.js";
|
|
2
2
|
|
|
3
3
|
//#region ../../plugins/acryl-router/src/core/middleware/basic-auth/index.d.ts
|
|
4
4
|
type MessageFunction = (c: Context) => string | object | Promise<string | object>;
|
package/lib/bearer-auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as MiddlewareHandler, t as Context, v as Env } from "./context-DS3fYyG-.js";
|
|
2
2
|
|
|
3
3
|
//#region ../../plugins/acryl-router/src/core/middleware/bearer-auth/index.d.ts
|
|
4
4
|
type MessageFunction = (c: Context) => string | object | Promise<string | object>;
|
package/lib/body-limit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as MiddlewareHandler, t as Context } from "./context-DS3fYyG-.js";
|
|
2
2
|
|
|
3
3
|
//#region ../../plugins/acryl-router/src/core/middleware/body-limit/index.d.ts
|
|
4
4
|
type OnError = (c: Context) => Response | Promise<Response>;
|
package/lib/cache.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as MiddlewareHandler, t as Context } from "./context-DS3fYyG-.js";
|
|
2
2
|
import { c as StatusCode } from "./http-status-DaAwGAFL.js";
|
|
3
3
|
|
|
4
4
|
//#region ../../plugins/acryl-router/src/core/middleware/cache/index.d.ts
|
package/lib/cache.js
CHANGED
|
@@ -7,10 +7,10 @@ import { cloneRawRequest } from "./request.js";
|
|
|
7
7
|
const defaultCacheableStatusCodes = [200];
|
|
8
8
|
const defaultMaxQueryBodySize = 64 * 1024;
|
|
9
9
|
const cacheKeyPath = "/.acryl-router/cache";
|
|
10
|
-
const cacheKeyParameter = "
|
|
11
|
-
const cacheMethodKeyParameter = "
|
|
12
|
-
const queryDigestKeyParameter = "
|
|
13
|
-
const cacheVaryKeyParameter = "
|
|
10
|
+
const cacheKeyParameter = "__acryl_cache_key";
|
|
11
|
+
const cacheMethodKeyParameter = "__acryl_cache_method";
|
|
12
|
+
const queryDigestKeyParameter = "__acryl_query_digest";
|
|
13
|
+
const cacheVaryKeyParameter = "__acryl_cache_vary";
|
|
14
14
|
const queryRepresentationMetadataHeaders = [
|
|
15
15
|
"content-type",
|
|
16
16
|
"content-encoding",
|
|
@@ -1,128 +1,5 @@
|
|
|
1
1
|
import { serialize } from "./utils/cookie.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @description This file is a modified version of `fetch-result-please` (`ofetch`), minimalized and adapted to Acryl's custom needs.
|
|
5
|
-
*
|
|
6
|
-
* @link https://www.npmjs.com/package/fetch-result-please
|
|
7
|
-
*/
|
|
8
|
-
const nullBodyResponses = /* @__PURE__ */ new Set([
|
|
9
|
-
101,
|
|
10
|
-
204,
|
|
11
|
-
205,
|
|
12
|
-
304
|
|
13
|
-
]);
|
|
14
|
-
/**
|
|
15
|
-
* Smartly parses and return the consumable result from a fetch `Response`.
|
|
16
|
-
*
|
|
17
|
-
* Throwing a structured error if the response is not `ok`. ({@link DetailedError})
|
|
18
|
-
*/
|
|
19
|
-
async function fetchRP(fetchRes) {
|
|
20
|
-
const _fetchRes = await fetchRes;
|
|
21
|
-
if ((_fetchRes.body || _fetchRes._bodyInit) && !nullBodyResponses.has(_fetchRes.status)) _fetchRes._data = await _fetchRes[detectResponseType(_fetchRes)]();
|
|
22
|
-
if (!_fetchRes.ok) throw new DetailedError(`${_fetchRes.status} ${_fetchRes.statusText}`, {
|
|
23
|
-
statusCode: _fetchRes?.status,
|
|
24
|
-
detail: {
|
|
25
|
-
data: _fetchRes?._data,
|
|
26
|
-
statusText: _fetchRes?.statusText
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return _fetchRes._data;
|
|
30
|
-
}
|
|
31
|
-
var DetailedError = class extends Error {
|
|
32
|
-
/**
|
|
33
|
-
* Additional `message` that will be logged AND returned to client
|
|
34
|
-
*/
|
|
35
|
-
detail;
|
|
36
|
-
/**
|
|
37
|
-
* Additional `code` that will be logged AND returned to client
|
|
38
|
-
*/
|
|
39
|
-
code;
|
|
40
|
-
/**
|
|
41
|
-
* Additional value that will be logged AND NOT returned to client
|
|
42
|
-
*/
|
|
43
|
-
log;
|
|
44
|
-
/**
|
|
45
|
-
* Optionally set the status code to return, in a web server context
|
|
46
|
-
*/
|
|
47
|
-
statusCode;
|
|
48
|
-
constructor(message, options = {}) {
|
|
49
|
-
super(message);
|
|
50
|
-
this.name = "DetailedError";
|
|
51
|
-
this.log = options.log;
|
|
52
|
-
this.detail = options.detail;
|
|
53
|
-
this.code = options.code;
|
|
54
|
-
this.statusCode = options.statusCode;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const jsonRegex = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(?:;.+)?$/i;
|
|
58
|
-
function detectResponseType(response) {
|
|
59
|
-
const _contentType = response.headers.get("content-type");
|
|
60
|
-
if (!_contentType) return "text";
|
|
61
|
-
const contentType = _contentType.split(";").shift();
|
|
62
|
-
if (jsonRegex.test(contentType)) return "json";
|
|
63
|
-
return "text";
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region ../../plugins/acryl-router/src/core/client/utils.ts
|
|
67
|
-
const mergePath = (base, path) => {
|
|
68
|
-
base = base.replace(/\/+$/, "");
|
|
69
|
-
base = base + "/";
|
|
70
|
-
path = path.replace(/^\/+/, "");
|
|
71
|
-
return base + path;
|
|
72
|
-
};
|
|
73
|
-
const replaceUrlParam = (urlString, params) => {
|
|
74
|
-
for (const [k, v] of Object.entries(params)) {
|
|
75
|
-
const reg = new RegExp("/:" + k + "(?:{[^/]+})?\\??(?=/|$)");
|
|
76
|
-
urlString = urlString.replace(reg, () => v ? `/${v}` : "");
|
|
77
|
-
}
|
|
78
|
-
return urlString;
|
|
79
|
-
};
|
|
80
|
-
const buildSearchParams = (query) => {
|
|
81
|
-
const searchParams = new URLSearchParams();
|
|
82
|
-
for (const [k, v] of Object.entries(query)) {
|
|
83
|
-
if (v === void 0) continue;
|
|
84
|
-
if (Array.isArray(v)) for (const v2 of v) {
|
|
85
|
-
if (v2 === void 0) continue;
|
|
86
|
-
searchParams.append(k, v2);
|
|
87
|
-
}
|
|
88
|
-
else searchParams.set(k, v);
|
|
89
|
-
}
|
|
90
|
-
return searchParams;
|
|
91
|
-
};
|
|
92
|
-
const replaceUrlProtocol = (urlString, protocol) => {
|
|
93
|
-
switch (protocol) {
|
|
94
|
-
case "ws": return urlString.replace(/^http/, "ws");
|
|
95
|
-
case "http": return urlString.replace(/^ws/, "http");
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const removeIndexString = (urlString) => {
|
|
99
|
-
if (/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(urlString)) return urlString.replace(/\/index(?=\?|$)/, "/");
|
|
100
|
-
return urlString.replace(/\/index(?=\?|$)/, "");
|
|
101
|
-
};
|
|
102
|
-
function isObject(item) {
|
|
103
|
-
return typeof item === "object" && item !== null && !Array.isArray(item);
|
|
104
|
-
}
|
|
105
|
-
function deepMerge(target, source) {
|
|
106
|
-
if (!isObject(target) && !isObject(source)) return source;
|
|
107
|
-
const merged = { ...target };
|
|
108
|
-
for (const key in source) {
|
|
109
|
-
const value = source[key];
|
|
110
|
-
if (isObject(merged[key]) && isObject(value)) merged[key] = deepMerge(merged[key], value);
|
|
111
|
-
else merged[key] = value;
|
|
112
|
-
}
|
|
113
|
-
return merged;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Shortcut to get a consumable response from `hc`'s fetch calls (Response), with types inference.
|
|
117
|
-
*
|
|
118
|
-
* Smartly parse the response data, throwing a structured error if the response is not `ok`. ({@link DetailedError})
|
|
119
|
-
*
|
|
120
|
-
* @example const result = await parseResponse(client.posts.$get())
|
|
121
|
-
*/
|
|
122
|
-
async function parseResponse(fetchRes) {
|
|
123
|
-
return fetchRP(fetchRes);
|
|
124
|
-
}
|
|
125
|
-
//#endregion
|
|
2
|
+
import { a as removeIndexString, n as deepMerge, o as replaceUrlParam, r as mergePath, s as replaceUrlProtocol, t as buildSearchParams } from "./utils-Cx61GFMC.js";
|
|
126
3
|
//#region ../../plugins/acryl-router/src/core/client/client.ts
|
|
127
4
|
const createProxy = (callback, path) => {
|
|
128
5
|
return new Proxy(() => {}, {
|
|
@@ -263,4 +140,4 @@ const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
|
263
140
|
return req;
|
|
264
141
|
}, []);
|
|
265
142
|
//#endregion
|
|
266
|
-
export {
|
|
143
|
+
export { hc as t };
|
package/lib/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ClientResponse, c as InferRequestType, i as ClientRequestOptions, l as InferResponseType, o as Fetch, r as ClientRequest, t as ApplyGlobalResponse, u as PickResponseByStatusCode } from "./types-
|
|
2
|
-
import { n as DetailedError, r as hc, t as parseResponse } from "./index-
|
|
1
|
+
import { a as ClientResponse, c as InferRequestType, i as ClientRequestOptions, l as InferResponseType, o as Fetch, r as ClientRequest, t as ApplyGlobalResponse, u as PickResponseByStatusCode } from "./types-zNxyEpG2.js";
|
|
2
|
+
import { n as DetailedError, r as hc, t as parseResponse } from "./index-Bb7YJKCq.js";
|
|
3
3
|
export { type ApplyGlobalResponse, type ClientRequest, type ClientRequestOptions, type ClientResponse, DetailedError, type Fetch, type InferRequestType, type InferResponseType, type PickResponseByStatusCode, hc, parseResponse };
|
package/lib/client.js
CHANGED
package/lib/combine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as MiddlewareHandler, t as Context } from "./context-DS3fYyG-.js";
|
|
2
2
|
|
|
3
3
|
//#region ../../plugins/acryl-router/src/core/middleware/combine/index.d.ts
|
|
4
4
|
type Condition = (c: Context) => boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region ../../plugins/acryl-router/src/core/helper/css/common.d.ts
|
|
2
|
+
declare const SELECTOR: unique symbol;
|
|
3
|
+
declare const CLASS_NAME: unique symbol;
|
|
4
|
+
declare const STYLE_STRING: unique symbol;
|
|
5
|
+
declare const SELECTORS: unique symbol;
|
|
6
|
+
declare const EXTERNAL_CLASS_NAMES: unique symbol;
|
|
7
|
+
declare const CSS_ESCAPED: unique symbol;
|
|
8
|
+
interface CssClassName {
|
|
9
|
+
[SELECTOR]: string;
|
|
10
|
+
[CLASS_NAME]: string;
|
|
11
|
+
[STYLE_STRING]: string;
|
|
12
|
+
[SELECTORS]: CssClassName[];
|
|
13
|
+
[EXTERNAL_CLASS_NAMES]: string[];
|
|
14
|
+
}
|
|
15
|
+
interface CssEscapedString {
|
|
16
|
+
[CSS_ESCAPED]: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @experimental
|
|
20
|
+
* `rawCssString` is an experimental feature.
|
|
21
|
+
* The API might be changed.
|
|
22
|
+
*/
|
|
23
|
+
declare const rawCssString: (value: string) => CssEscapedString;
|
|
24
|
+
type CssVariableBasicType = CssClassName | CssEscapedString | string | number | boolean | null | undefined;
|
|
25
|
+
type CssVariableAsyncType = Promise<CssVariableBasicType>;
|
|
26
|
+
type CssVariableArrayType = (CssVariableBasicType | CssVariableAsyncType)[];
|
|
27
|
+
type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType;
|
|
28
|
+
/**
|
|
29
|
+
* A function that customizes generated CSS class names.
|
|
30
|
+
*
|
|
31
|
+
* @param hash - The default hash-based class name (e.g. `css-1234567890`)
|
|
32
|
+
* @param label - The comment label extracted from the CSS template, may be empty.
|
|
33
|
+
* Whitespace is trimmed and inner spaces are replaced with hyphens.
|
|
34
|
+
* @param styleString - The minified CSS style string
|
|
35
|
+
* @returns The custom class name to use. Must be a safe CSS identifier;
|
|
36
|
+
* otherwise, the default hash is used as a fallback.
|
|
37
|
+
*/
|
|
38
|
+
type ClassNameSlug = (hash: string, label: string, styleString: string) => string;
|
|
39
|
+
/**
|
|
40
|
+
* A callback function called when an invalid slug is returned from ClassNameSlug.
|
|
41
|
+
*
|
|
42
|
+
* @param slug - The invalid slug
|
|
43
|
+
*/
|
|
44
|
+
type OnInvalidSlug = (slug: string) => void;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { rawCssString as a, OnInvalidSlug as i, CssClassName as n, CssVariableType as r, ClassNameSlug as t };
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { C as captureRenderContext, E as useContext, d as renderUntrustedObject, i as isUntrustedObject, n as JSXNode, o as jsx, t as Fragment, u as renderChildren, w as createContext } from "./base-ddiVmiE7.js";
|
|
2
|
+
import { HtmlEscapedCallbackPhase, raw, resolveCallback } from "./utils/html.js";
|
|
3
|
+
import { a as DOM_STASH, i as DOM_RENDERER } from "./constants-BR9jM9BC.js";
|
|
4
|
+
import { x as buildDataStack } from "./hooks-BMw6BAyP.js";
|
|
5
|
+
import { n as Suspense$1, t as ErrorBoundary$1 } from "./components-DdI7-ns7.js";
|
|
6
|
+
//#region ../../plugins/acryl-router/src/core/jsx/streaming.ts
|
|
7
|
+
/**
|
|
8
|
+
* @module
|
|
9
|
+
* This module enables JSX to supports streaming Response.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Used to specify nonce for scripts generated by `Suspense` and `ErrorBoundary`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <StreamingContext.Provider value={{ scriptNonce: 'test-nonce' }}>
|
|
17
|
+
* <Suspense fallback={<p>Loading...</p>}>
|
|
18
|
+
* <Content />
|
|
19
|
+
* </Suspense>
|
|
20
|
+
* </StreamingContext.Provider>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
const StreamingContext = createContext(null);
|
|
24
|
+
let suspenseCounter = 0;
|
|
25
|
+
const serializeBoundaryChild = (child) => typeof child === "string" || Array.isArray(child) ? renderChildren([child]) : child == null || typeof child === "boolean" ? "" : isUntrustedObject(child) ? renderUntrustedObject(child) : child.toString();
|
|
26
|
+
/**
|
|
27
|
+
* @experimental
|
|
28
|
+
* `Suspense` is an experimental feature.
|
|
29
|
+
* The API might be changed.
|
|
30
|
+
*/
|
|
31
|
+
const Suspense = async ({ children, fallback }) => {
|
|
32
|
+
if (!Array.isArray(children)) children = [children];
|
|
33
|
+
const nonce = useContext(StreamingContext)?.scriptNonce;
|
|
34
|
+
let resArray = [];
|
|
35
|
+
const stackNode = { [DOM_STASH]: [0, []] };
|
|
36
|
+
const popNodeStack = () => {
|
|
37
|
+
buildDataStack.pop();
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
stackNode[DOM_STASH][0] = 0;
|
|
41
|
+
buildDataStack.push([[], stackNode]);
|
|
42
|
+
resArray = children.map(serializeBoundaryChild);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
if (e instanceof Promise) {
|
|
45
|
+
const resume = captureRenderContext();
|
|
46
|
+
resArray = [e.then(() => resume(() => {
|
|
47
|
+
stackNode[DOM_STASH][0] = 0;
|
|
48
|
+
buildDataStack.push([[], stackNode]);
|
|
49
|
+
return childrenToString(children).finally(popNodeStack);
|
|
50
|
+
}))];
|
|
51
|
+
} else throw e;
|
|
52
|
+
} finally {
|
|
53
|
+
popNodeStack();
|
|
54
|
+
}
|
|
55
|
+
if (resArray.some((res) => res instanceof Promise)) {
|
|
56
|
+
const index = suspenseCounter++;
|
|
57
|
+
const fallbackStr = await (typeof fallback === "string" || Array.isArray(fallback) ? renderChildren([fallback]) : isUntrustedObject(fallback) ? renderUntrustedObject(fallback) : fallback.toString());
|
|
58
|
+
return raw(`<template id="H:${index}"></template>${fallbackStr}<!--/$-->`, [...fallbackStr.callbacks || [], ({ phase, buffer, context }) => {
|
|
59
|
+
if (phase === HtmlEscapedCallbackPhase.BeforeStream) return;
|
|
60
|
+
return Promise.all(resArray).then(async (htmlArray) => {
|
|
61
|
+
htmlArray = htmlArray.flat();
|
|
62
|
+
const content = htmlArray.join("");
|
|
63
|
+
if (buffer) buffer[0] = buffer[0].replace(new RegExp(`<template id="H:${index}"></template>.*?<!--/\\$-->`, "s"), () => content);
|
|
64
|
+
let html = buffer ? "" : `<template data-acryl-target="H:${index}">${content}</template><script${nonce ? ` nonce="${nonce}"` : ""}>
|
|
65
|
+
((d,c,n) => {
|
|
66
|
+
c=d.currentScript.previousSibling
|
|
67
|
+
d=d.getElementById('H:${index}')
|
|
68
|
+
if(!d)return
|
|
69
|
+
do{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='/$')
|
|
70
|
+
d.replaceWith(c.content)
|
|
71
|
+
})(document)
|
|
72
|
+
<\/script>`;
|
|
73
|
+
const callbacks = htmlArray.map((html) => html.callbacks || []).flat();
|
|
74
|
+
if (!callbacks.length) return html;
|
|
75
|
+
if (phase === HtmlEscapedCallbackPhase.Stream) html = await resolveCallback(html, HtmlEscapedCallbackPhase.BeforeStream, true, context);
|
|
76
|
+
return raw(html, callbacks);
|
|
77
|
+
});
|
|
78
|
+
}]);
|
|
79
|
+
} else return raw(resArray.join(""));
|
|
80
|
+
};
|
|
81
|
+
Suspense[DOM_RENDERER] = Suspense$1;
|
|
82
|
+
const textEncoder = new TextEncoder();
|
|
83
|
+
/**
|
|
84
|
+
* @experimental
|
|
85
|
+
* `renderToReadableStream()` is an experimental feature.
|
|
86
|
+
* The API might be changed.
|
|
87
|
+
*/
|
|
88
|
+
const renderToReadableStream = (content, onError = console.trace) => {
|
|
89
|
+
let cancelled = false;
|
|
90
|
+
return new ReadableStream({
|
|
91
|
+
async start(controller) {
|
|
92
|
+
try {
|
|
93
|
+
if (content instanceof JSXNode) content = content.toString();
|
|
94
|
+
const context = typeof content === "object" ? content : {};
|
|
95
|
+
const resolved = await resolveCallback(content, HtmlEscapedCallbackPhase.BeforeStream, true, context);
|
|
96
|
+
if (!cancelled) controller.enqueue(textEncoder.encode(resolved));
|
|
97
|
+
let resolvedCount = 0;
|
|
98
|
+
const callbacks = [];
|
|
99
|
+
const then = (promise) => {
|
|
100
|
+
callbacks.push(promise.catch((err) => {
|
|
101
|
+
console.log(err);
|
|
102
|
+
onError(err);
|
|
103
|
+
return "";
|
|
104
|
+
}).then(async (res) => {
|
|
105
|
+
res = await resolveCallback(res, HtmlEscapedCallbackPhase.BeforeStream, true, context);
|
|
106
|
+
res.callbacks?.map((c) => c({
|
|
107
|
+
phase: HtmlEscapedCallbackPhase.Stream,
|
|
108
|
+
context
|
|
109
|
+
})).filter(Boolean).forEach(then);
|
|
110
|
+
resolvedCount++;
|
|
111
|
+
if (!cancelled) controller.enqueue(textEncoder.encode(res));
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
resolved.callbacks?.map((c) => c({
|
|
115
|
+
phase: HtmlEscapedCallbackPhase.Stream,
|
|
116
|
+
context
|
|
117
|
+
})).filter(Boolean).forEach(then);
|
|
118
|
+
while (resolvedCount !== callbacks.length) await Promise.all(callbacks);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
onError(e);
|
|
121
|
+
}
|
|
122
|
+
if (!cancelled) controller.close();
|
|
123
|
+
},
|
|
124
|
+
cancel() {
|
|
125
|
+
cancelled = true;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region ../../plugins/acryl-router/src/core/jsx/components.ts
|
|
131
|
+
let errorBoundaryCounter = 0;
|
|
132
|
+
const childrenToString = async (children) => {
|
|
133
|
+
try {
|
|
134
|
+
return children.flat().map(resolveChildEarly);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
if (e instanceof Promise) {
|
|
137
|
+
const resume = captureRenderContext();
|
|
138
|
+
await e;
|
|
139
|
+
return resume(() => childrenToString(children));
|
|
140
|
+
} else throw e;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const resolveChildEarly = (child) => {
|
|
144
|
+
if (child == null || typeof child === "boolean") return "";
|
|
145
|
+
else if (typeof child === "string" || Array.isArray(child)) return renderChildren([child]);
|
|
146
|
+
else if (isUntrustedObject(child)) return renderUntrustedObject(child);
|
|
147
|
+
else {
|
|
148
|
+
const str = child.toString();
|
|
149
|
+
return str instanceof Promise ? str : raw(str);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* @experimental
|
|
154
|
+
* `ErrorBoundary` is an experimental feature.
|
|
155
|
+
* The API might be changed.
|
|
156
|
+
*/
|
|
157
|
+
const ErrorBoundary = async ({ children, fallback, fallbackRender, onError }) => {
|
|
158
|
+
if (!children) return raw("");
|
|
159
|
+
if (!Array.isArray(children)) children = [children];
|
|
160
|
+
const nonce = useContext(StreamingContext)?.scriptNonce;
|
|
161
|
+
let resume;
|
|
162
|
+
const getResume = () => resume ||= captureRenderContext();
|
|
163
|
+
let fallbackStrPromise;
|
|
164
|
+
const resolveFallbackStr = () => fallbackStrPromise ||= (async () => {
|
|
165
|
+
const awaitedFallback = await fallback;
|
|
166
|
+
if (awaitedFallback === null || awaitedFallback === void 0) return;
|
|
167
|
+
if (typeof awaitedFallback === "string" || Array.isArray(awaitedFallback)) return getResume()(() => renderChildren([awaitedFallback]));
|
|
168
|
+
if (isUntrustedObject(awaitedFallback)) return getResume()(() => renderUntrustedObject(awaitedFallback));
|
|
169
|
+
const fallbackResult = await getResume()(() => awaitedFallback.toString());
|
|
170
|
+
return raw(fallbackResult, fallbackResult.callbacks || awaitedFallback.callbacks);
|
|
171
|
+
})();
|
|
172
|
+
const renderFallback = async (error) => {
|
|
173
|
+
const fallbackStr = await resolveFallbackStr();
|
|
174
|
+
return getResume()(async () => {
|
|
175
|
+
onError?.(error);
|
|
176
|
+
const fallbackRes = fallbackStr !== void 0 ? fallbackStr : fallbackRender && jsx(Fragment, {}, fallbackRender(error)) || "";
|
|
177
|
+
const fallbackResString = await Fragment({ children: fallbackRes }).toString();
|
|
178
|
+
return raw(fallbackResString, fallbackResString.callbacks || fallbackRes.callbacks);
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
let resArray = [];
|
|
182
|
+
try {
|
|
183
|
+
resArray = children.map(resolveChildEarly);
|
|
184
|
+
} catch (e) {
|
|
185
|
+
const resume = getResume();
|
|
186
|
+
if (e instanceof Promise) resArray = [e.then(() => resume(() => childrenToString(children))).catch((e) => renderFallback(e))];
|
|
187
|
+
else resArray = [await renderFallback(e)];
|
|
188
|
+
}
|
|
189
|
+
if (resArray.some((res) => res instanceof Promise)) {
|
|
190
|
+
getResume();
|
|
191
|
+
const index = errorBoundaryCounter++;
|
|
192
|
+
const replaceRe = RegExp(`(<template id="E:${index}"></template>)(.*?)(<!--E:${index}-->)`, "s");
|
|
193
|
+
let caught = false;
|
|
194
|
+
const catchCallback = async ({ error, buffer }) => {
|
|
195
|
+
if (caught) return "";
|
|
196
|
+
caught = true;
|
|
197
|
+
const fallbackResString = await renderFallback(error);
|
|
198
|
+
const fallbackCallbacks = fallbackResString.callbacks;
|
|
199
|
+
if (buffer) {
|
|
200
|
+
buffer[0] = buffer[0].replace(replaceRe, () => fallbackResString);
|
|
201
|
+
return fallbackCallbacks?.length ? raw("", fallbackCallbacks) : "";
|
|
202
|
+
}
|
|
203
|
+
return raw(`<template data-acryl-target="E:${index}">${fallbackResString}</template><script>
|
|
204
|
+
((d,c,n) => {
|
|
205
|
+
c=d.currentScript.previousSibling
|
|
206
|
+
d=d.getElementById('E:${index}')
|
|
207
|
+
if(!d)return
|
|
208
|
+
do{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='E:${index}')
|
|
209
|
+
d.replaceWith(c.content)
|
|
210
|
+
})(document)
|
|
211
|
+
<\/script>`, fallbackCallbacks);
|
|
212
|
+
};
|
|
213
|
+
let error;
|
|
214
|
+
const promiseAll = Promise.all(resArray).catch((e) => error = e);
|
|
215
|
+
return raw(`<template id="E:${index}"></template><!--E:${index}-->`, [({ phase, buffer, context }) => {
|
|
216
|
+
if (phase === HtmlEscapedCallbackPhase.BeforeStream) return;
|
|
217
|
+
return promiseAll.then(async (htmlArray) => {
|
|
218
|
+
if (error) throw error;
|
|
219
|
+
htmlArray = htmlArray.flat();
|
|
220
|
+
const content = htmlArray.join("");
|
|
221
|
+
let html = buffer ? "" : `<template data-acryl-target="E:${index}">${content}</template><script${nonce ? ` nonce="${nonce}"` : ""}>
|
|
222
|
+
((d,c) => {
|
|
223
|
+
c=d.currentScript.previousSibling
|
|
224
|
+
d=d.getElementById('E:${index}')
|
|
225
|
+
if(!d)return
|
|
226
|
+
d.parentElement.insertBefore(c.content,d.nextSibling)
|
|
227
|
+
})(document)
|
|
228
|
+
<\/script>`;
|
|
229
|
+
if (htmlArray.every((html) => !html.callbacks?.length)) {
|
|
230
|
+
if (buffer) buffer[0] = buffer[0].replace(replaceRe, () => content);
|
|
231
|
+
return html;
|
|
232
|
+
}
|
|
233
|
+
if (buffer) buffer[0] = buffer[0].replace(replaceRe, (_all, pre, _, post) => `${pre}${content}${post}`);
|
|
234
|
+
const callbacks = htmlArray.map((html) => html.callbacks || []).flat();
|
|
235
|
+
if (phase === HtmlEscapedCallbackPhase.Stream) html = await resolveCallback(html, HtmlEscapedCallbackPhase.BeforeStream, true, context);
|
|
236
|
+
let resolvedCount = 0;
|
|
237
|
+
const promises = callbacks.map((c) => (...args) => c(...args)?.then((content) => {
|
|
238
|
+
resolvedCount++;
|
|
239
|
+
if (buffer) {
|
|
240
|
+
if (resolvedCount === callbacks.length) buffer[0] = buffer[0].replace(replaceRe, (_all, _pre, content) => content);
|
|
241
|
+
buffer[0] += content;
|
|
242
|
+
return raw("", content.callbacks);
|
|
243
|
+
}
|
|
244
|
+
return raw(content + (resolvedCount !== callbacks.length ? "" : `<script>
|
|
245
|
+
((d,c,n) => {
|
|
246
|
+
d=d.getElementById('E:${index}')
|
|
247
|
+
if(!d)return
|
|
248
|
+
n=d.nextSibling
|
|
249
|
+
while(n.nodeType!=8||n.nodeValue!='E:${index}'){n=n.nextSibling}
|
|
250
|
+
n.remove()
|
|
251
|
+
d.remove()
|
|
252
|
+
})(document)
|
|
253
|
+
<\/script>`), content.callbacks);
|
|
254
|
+
}).catch((error) => catchCallback({
|
|
255
|
+
error,
|
|
256
|
+
buffer
|
|
257
|
+
})));
|
|
258
|
+
return raw(html, promises);
|
|
259
|
+
}).catch((error) => catchCallback({
|
|
260
|
+
error,
|
|
261
|
+
buffer
|
|
262
|
+
}));
|
|
263
|
+
}]);
|
|
264
|
+
} else return Fragment({ children: resArray });
|
|
265
|
+
};
|
|
266
|
+
ErrorBoundary[DOM_RENDERER] = ErrorBoundary$1;
|
|
267
|
+
//#endregion
|
|
268
|
+
export { renderToReadableStream as i, StreamingContext as n, Suspense as r, ErrorBoundary as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as DOM_ERROR_HANDLER } from "./constants-BR9jM9BC.js";
|
|
2
|
+
import { t as Fragment } from "./jsx-dev-runtime-D18Y35TI.js";
|
|
3
|
+
import "./jsx/dom/jsx-runtime.js";
|
|
4
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/components.ts
|
|
5
|
+
const ErrorBoundary = (({ children, fallback, fallbackRender, onError }) => {
|
|
6
|
+
const res = Fragment({ children });
|
|
7
|
+
res[DOM_ERROR_HANDLER] = (err) => {
|
|
8
|
+
if (err instanceof Promise) throw err;
|
|
9
|
+
onError?.(err);
|
|
10
|
+
return fallbackRender?.(err) || fallback;
|
|
11
|
+
};
|
|
12
|
+
return res;
|
|
13
|
+
});
|
|
14
|
+
const Suspense = (({ children, fallback }) => {
|
|
15
|
+
const res = Fragment({ children });
|
|
16
|
+
res[DOM_ERROR_HANDLER] = (err, retry) => {
|
|
17
|
+
if (!(err instanceof Promise)) throw err;
|
|
18
|
+
err.finally(retry);
|
|
19
|
+
return fallback;
|
|
20
|
+
};
|
|
21
|
+
return res;
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Suspense as n, ErrorBoundary as t };
|
package/lib/compress.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as MiddlewareHandler } from "./context-DS3fYyG-.js";
|
|
2
2
|
import { COMPRESSIBLE_CONTENT_TYPE_REGEX } from "./utils/compress.js";
|
|
3
3
|
|
|
4
4
|
//#region ../../plugins/acryl-router/src/core/middleware/compress/index.d.ts
|
package/lib/conninfo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Context } from "./context-
|
|
2
|
-
import { i as NetAddrInfo, n as ConnInfo, r as GetConnInfo, t as AddressType } from "./types-
|
|
1
|
+
import { t as Context } from "./context-DS3fYyG-.js";
|
|
2
|
+
import { i as NetAddrInfo, n as ConnInfo, r as GetConnInfo, t as AddressType } from "./types-Dv_nV2cv.js";
|
|
3
3
|
|
|
4
4
|
//#region ../../plugins/acryl-router/src/connection.d.ts
|
|
5
5
|
/** An in-process caller (the terminal UI, a test) passes nothing, so a handler that needs a trusted peer must refuse an empty one. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../../plugins/acryl-router/src/core/jsx/constants.ts
|
|
2
|
+
const DOM_RENDERER = Symbol("RENDERER");
|
|
3
|
+
const DOM_ERROR_HANDLER = Symbol("ERROR_HANDLER");
|
|
4
|
+
const DOM_STASH = Symbol("STASH");
|
|
5
|
+
const DOM_INTERNAL_TAG = Symbol("INTERNAL");
|
|
6
|
+
const DOM_MEMO = Symbol("MEMO");
|
|
7
|
+
const PERMALINK = Symbol("PERMALINK");
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DOM_STASH as a, DOM_RENDERER as i, DOM_INTERNAL_TAG as n, PERMALINK as o, DOM_MEMO as r, DOM_ERROR_HANDLER as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as Result, l as Router } from "./router-CvUxUTOq.js";
|
|
2
2
|
import { i as ResponseHeader, n as CustomHeader, r as RequestHeader } from "./headers-tu2YYN8T.js";
|
|
3
3
|
import { c as StatusCode, n as ContentfulStatusCode, o as RedirectStatusCode } from "./http-status-DaAwGAFL.js";
|
|
4
|
-
import {
|
|
4
|
+
import { D as UnionToIntersection, S as RemoveBlankRecord, f as InvalidJSONValue, g as JSONParsed, p as IsAny, u as IfAnyThenEmptyObject, v as JSONValue, w as Simplify } from "./types-Lqx5BxQF.js";
|
|
5
5
|
import { t as BaseMime } from "./mime-BQOYHl-l.js";
|
|
6
6
|
|
|
7
7
|
//#region ../../plugins/acryl-router/src/core/request/constants.d.ts
|
|
@@ -1231,4 +1231,4 @@ declare class Context<E extends Env = any, P extends string = any, I extends Inp
|
|
|
1231
1231
|
notFound: () => ReturnType<NotFoundHandler>;
|
|
1232
1232
|
}
|
|
1233
1233
|
//#endregion
|
|
1234
|
-
export {
|
|
1234
|
+
export { Variables as $, HandlerResponse as A, NotFoundHandler as B, ExtractSchemaForStatusCode as C, HTTPResponseError as D, H as E, MergePath as F, ParsedFormValue as G, OnHandlerInterface as H, MergeSchemaPath as I, RouterRoute as J, RemoveQuestion as K, MiddlewareHandler as L, InputToDataByTarget as M, IntersectNonAnyTypes as N, Handler as O, KnownResponseFormat as P, ValidationTargets as Q, MiddlewareHandlerInterface as R, ExtractSchema as S, FormValue as T, ParamKeyToRecord as U, NotFoundResponse as V, ParamKeys as W, ToSchema as X, Schema as Y, TypedResponse as Z, Endpoint as _, ExecutionContext as a, ExtractHandlerResponse as b, cloneRawRequest as c, parseBody as d, Acryl as et, AddParam as f, BlankSchema as g, BlankInput as h, Data as i, Input as j, HandlerInterface as k, BodyData as l, BlankEnv as m, ContextRenderer as n, PropsForRenderer as o, Bindings as p, ResponseFormat as q, ContextVariableMap as r, AcrylRequest as s, Context as t, AcrylOptions as tt, ParseBodyOptions as u, Env as v, FetchEventLike as w, ExtractInput as x, ErrorHandler as y, Next as z };
|