@luckylillia-dev/luckylillia 0.0.0-stage → 9.0.1
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/chunks/preload-helper-D5R8FHQt.js +342 -0
- package/chunks/preload-helper-D5R8FHQt.js.map +1 -0
- package/default_config.json +83 -0
- package/llbot-core.js +35013 -0
- package/llbot-core.js.map +1 -0
- package/llbot.js +138 -0
- package/llbot.js.map +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/commands.d.ts +86 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/commands.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/config.d.ts +14 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/config.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/ffmpeg.d.ts +41 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/ffmpeg.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/http.d.ts +88 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/http.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/index.d.ts +17 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/index.js +6 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/internal.d.ts +430 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/internal.js +7 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/manifest.d.ts +68 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/manifest.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/server.d.ts +23 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/server.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/storage.d.ts +21 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/storage.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/testing.d.ts +71 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/testing.js +1123 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/universal.d.ts +299 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/universal.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/webui.d.ts +762 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/webui.js +9 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/package.json +63 -0
- package/node_modules/@satorijs/element/jsx-dev-runtime.d.ts +3 -0
- package/node_modules/@satorijs/element/jsx-runtime.d.ts +3 -0
- package/node_modules/@satorijs/element/lib/index.cjs +447 -0
- package/node_modules/@satorijs/element/lib/index.d.ts +116 -0
- package/node_modules/@satorijs/element/lib/index.mjs +455 -0
- package/node_modules/@satorijs/element/package.json +60 -0
- package/node_modules/@satorijs/element/src/index.ts +559 -0
- package/node_modules/@satorijs/protocol/lib/index.cjs +187 -0
- package/node_modules/@satorijs/protocol/lib/index.d.ts +328 -0
- package/node_modules/@satorijs/protocol/lib/index.mjs +148 -0
- package/node_modules/@satorijs/protocol/package.json +44 -0
- package/node_modules/@satorijs/protocol/src/index.ts +513 -0
- package/node_modules/@standard-schema/spec/LICENSE +21 -0
- package/node_modules/@standard-schema/spec/README.md +198 -0
- package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
- package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.js +0 -0
- package/node_modules/@standard-schema/spec/package.json +52 -0
- package/node_modules/cordis/README.md +10 -0
- package/node_modules/cordis/bin.js +16 -0
- package/node_modules/cordis/lib/context.d.ts +32 -0
- package/node_modules/cordis/lib/events.d.ts +62 -0
- package/node_modules/cordis/lib/fiber.d.ts +85 -0
- package/node_modules/cordis/lib/index.d.ts +7 -0
- package/node_modules/cordis/lib/index.js +1577 -0
- package/node_modules/cordis/lib/logger.d.ts +74 -0
- package/node_modules/cordis/lib/reflect.d.ts +54 -0
- package/node_modules/cordis/lib/registry.d.ts +78 -0
- package/node_modules/cordis/lib/service.d.ts +19 -0
- package/node_modules/cordis/lib/utils.d.ts +50 -0
- package/node_modules/cordis/package.json +49 -0
- package/node_modules/cosmokit/LICENSE +21 -0
- package/node_modules/cosmokit/README.md +24 -0
- package/node_modules/cosmokit/lib/index.cjs +419 -0
- package/node_modules/cosmokit/lib/index.cjs.map +6 -0
- package/node_modules/cosmokit/lib/index.d.ts +142 -0
- package/node_modules/cosmokit/lib/index.mjs +357 -0
- package/node_modules/cosmokit/lib/index.mjs.map +6 -0
- package/node_modules/cosmokit/package.json +57 -0
- package/node_modules/cosmokit/src/array.ts +35 -0
- package/node_modules/cosmokit/src/index.ts +5 -0
- package/node_modules/cosmokit/src/misc.ts +57 -0
- package/node_modules/cosmokit/src/string.ts +101 -0
- package/node_modules/cosmokit/src/time.ts +91 -0
- package/node_modules/cosmokit/src/types.ts +131 -0
- package/node_modules/schemastery/README.md +342 -0
- package/node_modules/schemastery/lib/index.cjs +648 -0
- package/node_modules/schemastery/lib/index.cjs.map +6 -0
- package/node_modules/schemastery/lib/index.d.ts +138 -0
- package/node_modules/schemastery/lib/index.mjs +656 -0
- package/node_modules/schemastery/lib/index.mjs.map +6 -0
- package/node_modules/schemastery/package.json +32 -0
- package/node_modules/schemastery/src/index.ts +841 -0
- package/node_modules/undici/LICENSE +21 -0
- package/node_modules/undici/README.md +741 -0
- package/node_modules/undici/docs/docs/api/Agent.md +84 -0
- package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
- package/node_modules/undici/docs/docs/api/Client.md +290 -0
- package/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/node_modules/undici/docs/docs/api/Cookies.md +128 -0
- package/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +317 -0
- package/node_modules/undici/docs/docs/api/Dispatcher.md +1393 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +60 -0
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
- package/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/node_modules/undici/docs/docs/api/MockClient.md +81 -0
- package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/node_modules/undici/docs/docs/api/MockPool.md +555 -0
- package/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
- package/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
- package/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
- package/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
- package/node_modules/undici/index-fetch.js +65 -0
- package/node_modules/undici/index.d.ts +3 -0
- package/node_modules/undici/index.js +234 -0
- package/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/node_modules/undici/lib/api/api-connect.js +110 -0
- package/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/node_modules/undici/lib/api/api-request.js +214 -0
- package/node_modules/undici/lib/api/api-stream.js +209 -0
- package/node_modules/undici/lib/api/api-upgrade.js +111 -0
- package/node_modules/undici/lib/api/index.js +7 -0
- package/node_modules/undici/lib/api/readable.js +580 -0
- package/node_modules/undici/lib/cache/memory-cache-store.js +279 -0
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +467 -0
- package/node_modules/undici/lib/core/connect.js +159 -0
- package/node_modules/undici/lib/core/constants.js +143 -0
- package/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/node_modules/undici/lib/core/errors.js +477 -0
- package/node_modules/undici/lib/core/request.js +485 -0
- package/node_modules/undici/lib/core/socks5-client.js +422 -0
- package/node_modules/undici/lib/core/socks5-utils.js +212 -0
- package/node_modules/undici/lib/core/symbols.js +76 -0
- package/node_modules/undici/lib/core/tree.js +160 -0
- package/node_modules/undici/lib/core/util.js +992 -0
- package/node_modules/undici/lib/dispatcher/agent.js +162 -0
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +221 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +1744 -0
- package/node_modules/undici/lib/dispatcher/client-h2.js +1056 -0
- package/node_modules/undici/lib/dispatcher/client.js +669 -0
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +196 -0
- package/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
- package/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
- package/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
- package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +260 -0
- package/node_modules/undici/lib/encoding/index.js +33 -0
- package/node_modules/undici/lib/global.js +59 -0
- package/node_modules/undici/lib/handler/cache-handler.js +824 -0
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
- package/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/node_modules/undici/lib/handler/deduplication-handler.js +504 -0
- package/node_modules/undici/lib/handler/redirect-handler.js +245 -0
- package/node_modules/undici/lib/handler/retry-handler.js +504 -0
- package/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
- package/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/node_modules/undici/lib/interceptor/cache.js +621 -0
- package/node_modules/undici/lib/interceptor/decompress.js +561 -0
- package/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
- package/node_modules/undici/lib/interceptor/dns.js +571 -0
- package/node_modules/undici/lib/interceptor/dump.js +99 -0
- package/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
- package/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/node_modules/undici/lib/mock/mock-agent.js +232 -0
- package/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/node_modules/undici/lib/mock/mock-utils.js +486 -0
- package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
- package/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
- package/node_modules/undici/lib/util/cache.js +676 -0
- package/node_modules/undici/lib/util/date.js +670 -0
- package/node_modules/undici/lib/util/promise.js +28 -0
- package/node_modules/undici/lib/util/runtime-features.js +124 -0
- package/node_modules/undici/lib/util/stats.js +32 -0
- package/node_modules/undici/lib/util/timers.js +425 -0
- package/node_modules/undici/lib/web/cache/cache.js +864 -0
- package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/node_modules/undici/lib/web/cache/util.js +45 -0
- package/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/node_modules/undici/lib/web/cookies/index.js +201 -0
- package/node_modules/undici/lib/web/cookies/parse.js +315 -0
- package/node_modules/undici/lib/web/cookies/util.js +371 -0
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +575 -0
- package/node_modules/undici/lib/web/eventsource/eventsource.js +504 -0
- package/node_modules/undici/lib/web/eventsource/util.js +29 -0
- package/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/node_modules/undici/lib/web/fetch/body.js +509 -0
- package/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
- package/node_modules/undici/lib/web/fetch/formdata.js +259 -0
- package/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/node_modules/undici/lib/web/fetch/index.js +2413 -0
- package/node_modules/undici/lib/web/fetch/request.js +1115 -0
- package/node_modules/undici/lib/web/fetch/response.js +641 -0
- package/node_modules/undici/lib/web/fetch/util.js +1522 -0
- package/node_modules/undici/lib/web/infra/index.js +243 -0
- package/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
- package/node_modules/undici/lib/web/webidl/index.js +1006 -0
- package/node_modules/undici/lib/web/websocket/connection.js +339 -0
- package/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/node_modules/undici/lib/web/websocket/frame.js +133 -0
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
- package/node_modules/undici/lib/web/websocket/receiver.js +520 -0
- package/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +496 -0
- package/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/node_modules/undici/lib/web/websocket/websocket.js +758 -0
- package/node_modules/undici/package.json +152 -0
- package/node_modules/undici/scripts/strip-comments.js +10 -0
- package/node_modules/undici/types/README.md +6 -0
- package/node_modules/undici/types/agent.d.ts +32 -0
- package/node_modules/undici/types/api.d.ts +43 -0
- package/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/node_modules/undici/types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici/types/cache.d.ts +36 -0
- package/node_modules/undici/types/client-stats.d.ts +15 -0
- package/node_modules/undici/types/client.d.ts +153 -0
- package/node_modules/undici/types/connector.d.ts +36 -0
- package/node_modules/undici/types/content-type.d.ts +21 -0
- package/node_modules/undici/types/cookies.d.ts +30 -0
- package/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici/types/dispatcher.d.ts +275 -0
- package/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici/types/errors.d.ts +177 -0
- package/node_modules/undici/types/eventsource.d.ts +66 -0
- package/node_modules/undici/types/fetch.d.ts +231 -0
- package/node_modules/undici/types/formdata.d.ts +114 -0
- package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici/types/global-origin.d.ts +7 -0
- package/node_modules/undici/types/h2c-client.d.ts +73 -0
- package/node_modules/undici/types/handlers.d.ts +14 -0
- package/node_modules/undici/types/header.d.ts +160 -0
- package/node_modules/undici/types/index.d.ts +91 -0
- package/node_modules/undici/types/interceptors.d.ts +82 -0
- package/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/node_modules/undici/types/mock-client.d.ts +27 -0
- package/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/node_modules/undici/types/mock-interceptor.d.ts +94 -0
- package/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/node_modules/undici/types/patch.d.ts +29 -0
- package/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/node_modules/undici/types/pool.d.ts +41 -0
- package/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/node_modules/undici/types/readable.d.ts +68 -0
- package/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/node_modules/undici/types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici/types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici/types/util.d.ts +18 -0
- package/node_modules/undici/types/utility.d.ts +7 -0
- package/node_modules/undici/types/webidl.d.ts +347 -0
- package/node_modules/undici/types/websocket.d.ts +188 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +17 -4
- package/webui/assets/group-bot-profile-CYK81678.jpg +0 -0
- package/webui/assets/group-bot-settings-BBQBbfgh.jpg +0 -0
- package/webui/assets/index-CuH0UYYo.js +28 -0
- package/webui/assets/index-DjbPiYmB.css +2 -0
- package/webui/favicon.ico +0 -0
- package/webui/index.html +26 -0
- package/webui/logo-128.webp +0 -0
- package/webui/logo-192.webp +0 -0
- package/webui/logo-256.webp +0 -0
- package/webui/logo-64.webp +0 -0
- package/webui/logo.jpg +0 -0
- package/webui/plugin-shared/plugin-sdk-webui.js +3 -0
- package/webui/plugin-shared/react-dom.js +3 -0
- package/webui/plugin-shared/react-jsx-runtime.js +3 -0
- package/webui/plugin-shared/react.js +3 -0
- package//344/275/277/347/224/250/350/257/264/346/230/216.txt +6 -0
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +1091 -0
- package/README.md +0 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Context } from './context';
|
|
2
|
+
import { Fiber } from './fiber';
|
|
3
|
+
import { symbols } from './utils';
|
|
4
|
+
declare module './context' {
|
|
5
|
+
interface Intercept {
|
|
6
|
+
logger: LoggerService.Intercept;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export type LoggerType = 'error' | 'info' | 'warn' | 'debug';
|
|
10
|
+
export type LoggerMethod = (format: any, ...param: any[]) => void;
|
|
11
|
+
export type Formatter = (value: any, exporter: Exporter, message: Message) => any;
|
|
12
|
+
export declare const enum LoggerLevel {
|
|
13
|
+
ERROR = 0,
|
|
14
|
+
WARN = 1,
|
|
15
|
+
INFO = 2,
|
|
16
|
+
DEBUG = 3
|
|
17
|
+
}
|
|
18
|
+
export interface Message {
|
|
19
|
+
sn: number;
|
|
20
|
+
ts: number;
|
|
21
|
+
name: string;
|
|
22
|
+
type: LoggerType;
|
|
23
|
+
level: number;
|
|
24
|
+
args: any[];
|
|
25
|
+
fiber?: WeakRef<Fiber>;
|
|
26
|
+
}
|
|
27
|
+
export interface Exporter {
|
|
28
|
+
colors?: number | false;
|
|
29
|
+
maxLength?: number;
|
|
30
|
+
levels?: Record<string, number>;
|
|
31
|
+
formatters?: Record<string, Formatter>;
|
|
32
|
+
export(message: Message): void;
|
|
33
|
+
}
|
|
34
|
+
export declare const defaultFormatters: Record<string, Formatter>;
|
|
35
|
+
export interface LoggerOptions {
|
|
36
|
+
name: string;
|
|
37
|
+
meta?: Partial<Message>;
|
|
38
|
+
level?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Logger extends LoggerOptions {
|
|
41
|
+
}
|
|
42
|
+
export interface Logger extends Record<LoggerType, LoggerMethod> {
|
|
43
|
+
}
|
|
44
|
+
export declare class Logger {
|
|
45
|
+
private service;
|
|
46
|
+
static color(exporter: Exporter, code: number, value: any, decoration?: string): string;
|
|
47
|
+
static code(name: string, level?: false | number): number;
|
|
48
|
+
static format(exporter: Exporter, message: Message): string;
|
|
49
|
+
constructor(options: LoggerOptions, service: LoggerService);
|
|
50
|
+
private _method;
|
|
51
|
+
}
|
|
52
|
+
export declare const c16: number[];
|
|
53
|
+
export declare const c256: number[];
|
|
54
|
+
export declare namespace LoggerService {
|
|
55
|
+
interface Intercept {
|
|
56
|
+
name?: string;
|
|
57
|
+
level?: number;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export interface LoggerService extends Record<LoggerType, LoggerMethod> {
|
|
61
|
+
(name?: string): Logger;
|
|
62
|
+
}
|
|
63
|
+
export declare class LoggerService {
|
|
64
|
+
bufferSize: number;
|
|
65
|
+
buffer: Message[];
|
|
66
|
+
ctx: Context;
|
|
67
|
+
_snMessage: number;
|
|
68
|
+
_snExporter: number;
|
|
69
|
+
exporters: Map<number, Exporter>;
|
|
70
|
+
constructor(ctx: Context);
|
|
71
|
+
exporter(exporter: Exporter): import("./fiber").Disposable<Promise<void>>;
|
|
72
|
+
private _resolveConfig;
|
|
73
|
+
[symbols.invoke](name?: string): Logger;
|
|
74
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Dict } from 'cosmokit';
|
|
2
|
+
import { Context } from './context';
|
|
3
|
+
import { Fiber } from './fiber';
|
|
4
|
+
declare module './context' {
|
|
5
|
+
interface Context {
|
|
6
|
+
get<K extends string & keyof this>(name: K, strict?: boolean): undefined | this[K];
|
|
7
|
+
get(name: string, strict?: boolean): any;
|
|
8
|
+
set<K extends string & keyof this>(name: K, value: undefined | this[K]): void;
|
|
9
|
+
set(name: string, value: any): void;
|
|
10
|
+
provide<K extends string & keyof this>(name: K, value: undefined | this[K]): () => void;
|
|
11
|
+
provide(name: string, value?: any): () => void;
|
|
12
|
+
accessor(name: string, options: Omit<Property.Accessor, 'type'>): void;
|
|
13
|
+
mixin<K extends string & keyof this>(name: K, mixins: (keyof this & keyof this[K])[] | Dict<string>): void;
|
|
14
|
+
mixin<T extends {}>(source: T, mixins: (keyof this & keyof T)[] | Dict<string>): void;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export type Property = Property.Service | Property.Accessor;
|
|
18
|
+
export declare namespace Property {
|
|
19
|
+
interface Service {
|
|
20
|
+
type: 'service';
|
|
21
|
+
}
|
|
22
|
+
interface Accessor {
|
|
23
|
+
type: 'accessor';
|
|
24
|
+
get: (this: Context, receiver: any, error: Error) => any;
|
|
25
|
+
set?: (this: Context, value: any, receiver: any, error: Error) => boolean;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export interface Impl {
|
|
29
|
+
uid: number;
|
|
30
|
+
name: string;
|
|
31
|
+
ctx: Context;
|
|
32
|
+
dependents: Set<Fiber>;
|
|
33
|
+
release?: () => void;
|
|
34
|
+
value?: any;
|
|
35
|
+
check?: () => boolean;
|
|
36
|
+
isolate: symbol;
|
|
37
|
+
}
|
|
38
|
+
export declare class ReflectService {
|
|
39
|
+
ctx: Context;
|
|
40
|
+
static handler: ProxyHandler<Context>;
|
|
41
|
+
store: Dict<Impl, symbol>;
|
|
42
|
+
props: Dict<Property>;
|
|
43
|
+
private _implCounter;
|
|
44
|
+
constructor(ctx: Context);
|
|
45
|
+
get(name: string, strict?: boolean): any;
|
|
46
|
+
_getImpl(name: string, strict?: boolean): Impl | undefined;
|
|
47
|
+
set(name: string, value: any, error?: Error): boolean;
|
|
48
|
+
provide(name: string, value?: any, check?: () => boolean): import("./fiber").Disposable<Promise<void>>;
|
|
49
|
+
notify(names: string[], filter?: (ctx: Context, name: string) => boolean): void;
|
|
50
|
+
accessor(name: string, options: Omit<Property.Accessor, 'type'>): import("./fiber").Disposable<Promise<void>>;
|
|
51
|
+
mixin(source: any, mixins: string[] | Dict<string>): import("./fiber").Disposable<Promise<void>>;
|
|
52
|
+
trace<T>(value: T): T;
|
|
53
|
+
bind<T extends Function>(callback: T): T;
|
|
54
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Dict } from 'cosmokit';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
+
import { Context } from './context';
|
|
4
|
+
import { Fiber } from './fiber';
|
|
5
|
+
import { DisposableList, symbols } from './utils';
|
|
6
|
+
export type Inject<M = Dict> = (keyof M)[] | {
|
|
7
|
+
[K in keyof M]?: M[K];
|
|
8
|
+
};
|
|
9
|
+
export type InjectKey = keyof {
|
|
10
|
+
[K in keyof Context & string as Context[K] extends {
|
|
11
|
+
[symbols.config]: any;
|
|
12
|
+
} ? K : never]: any;
|
|
13
|
+
};
|
|
14
|
+
export declare function Inject<K extends InjectKey>(name: K, config?: Context[K] extends {
|
|
15
|
+
[symbols.config]: infer T;
|
|
16
|
+
} ? T : never): (value: any, decorator: ClassDecoratorContext<any> | ClassMethodDecoratorContext<any>) => void;
|
|
17
|
+
export declare namespace Inject {
|
|
18
|
+
function resolve(inject: Inject | null | undefined, result?: Dict): Dict;
|
|
19
|
+
}
|
|
20
|
+
export type Plugin<T = any> = Plugin.Function<T> | Plugin.Constructor<T> | Plugin.Object<T>;
|
|
21
|
+
export declare namespace Plugin {
|
|
22
|
+
interface Base<T = any> {
|
|
23
|
+
name?: string;
|
|
24
|
+
Config?: StandardSchemaV1<any, T>;
|
|
25
|
+
inject?: Inject;
|
|
26
|
+
provide?: string | string[];
|
|
27
|
+
intercept?: Dict<boolean>;
|
|
28
|
+
}
|
|
29
|
+
interface Transform<S, T> {
|
|
30
|
+
schema?: true;
|
|
31
|
+
Config: (config: S) => T;
|
|
32
|
+
}
|
|
33
|
+
interface Function<T = any> extends Base<T> {
|
|
34
|
+
(ctx: Context, config: T): any;
|
|
35
|
+
}
|
|
36
|
+
interface Constructor<T = any> extends Base<T> {
|
|
37
|
+
new (ctx: Context, config: T): any;
|
|
38
|
+
}
|
|
39
|
+
interface Object<T = any> extends Base<T> {
|
|
40
|
+
apply(ctx: Context, config: T): any;
|
|
41
|
+
}
|
|
42
|
+
interface Runtime {
|
|
43
|
+
name?: string;
|
|
44
|
+
fibers: DisposableList<Fiber>;
|
|
45
|
+
callback: globalThis.Function;
|
|
46
|
+
Config?: StandardSchemaV1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
type Spread<T> = undefined extends T ? [config?: T] : [config: T];
|
|
50
|
+
type GetPluginParameters<P> = P extends (ctx: Context, ...args: infer R) => any ? R : P extends new (ctx: Context, ...args: infer R) => any ? R : P extends {
|
|
51
|
+
apply(ctx: Context, ...args: infer R): any;
|
|
52
|
+
} ? R : never;
|
|
53
|
+
type GetPluginConfig<P> = P extends Plugin.Transform<infer S, any> ? S : GetPluginParameters<P>[0];
|
|
54
|
+
declare module './context' {
|
|
55
|
+
interface Context {
|
|
56
|
+
inject(deps: Inject, callback: Plugin.Function<void>): Fiber & PromiseLike<Fiber>;
|
|
57
|
+
plugin<P extends Plugin>(plugin: P, ...args: Spread<GetPluginConfig<P>>): Fiber & PromiseLike<Fiber>;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export declare class RegistryService {
|
|
61
|
+
ctx: Context;
|
|
62
|
+
private _counter;
|
|
63
|
+
private _internal;
|
|
64
|
+
constructor(ctx: Context);
|
|
65
|
+
get counter(): number;
|
|
66
|
+
get size(): number;
|
|
67
|
+
resolve(plugin: Plugin): Function | undefined;
|
|
68
|
+
get(plugin: Plugin): Plugin.Runtime | undefined;
|
|
69
|
+
has(plugin: Plugin): boolean;
|
|
70
|
+
delete(plugin: Plugin): Plugin.Runtime | undefined;
|
|
71
|
+
keys(): MapIterator<Function>;
|
|
72
|
+
values(): MapIterator<Plugin.Runtime>;
|
|
73
|
+
entries(): MapIterator<[Function, Plugin.Runtime]>;
|
|
74
|
+
forEach(callback: (value: Plugin.Runtime, key: Function) => void): void;
|
|
75
|
+
inject(inject: Inject, callback: Plugin.Function<void>): Fiber & PromiseLike<Fiber>;
|
|
76
|
+
plugin(plugin: Plugin, config?: any, getOuterStack?: () => string[]): Fiber & PromiseLike<Fiber>;
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from './context';
|
|
2
|
+
import { symbols } from './utils';
|
|
3
|
+
export declare abstract class Service<out T = never> {
|
|
4
|
+
protected ctx: Context;
|
|
5
|
+
static readonly init: unique symbol;
|
|
6
|
+
static readonly check: unique symbol;
|
|
7
|
+
static readonly config: unique symbol;
|
|
8
|
+
static readonly invoke: unique symbol;
|
|
9
|
+
static readonly extend: unique symbol;
|
|
10
|
+
static readonly tracker: unique symbol;
|
|
11
|
+
static readonly resolveConfig: unique symbol;
|
|
12
|
+
[symbols.config]: T;
|
|
13
|
+
name: string;
|
|
14
|
+
constructor(ctx: Context, name: string);
|
|
15
|
+
protected [symbols.filter](ctx: Context): boolean;
|
|
16
|
+
protected [symbols.extend](props?: any): any;
|
|
17
|
+
[symbols.resolveConfig](base?: T, head?: T): T;
|
|
18
|
+
static [Symbol.hasInstance](instance: any): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Context, Service } from '.';
|
|
2
|
+
export declare class DisposableList<T extends WeakKey> {
|
|
3
|
+
private sn;
|
|
4
|
+
private map;
|
|
5
|
+
private weak;
|
|
6
|
+
get length(): number;
|
|
7
|
+
push(value: T): () => boolean;
|
|
8
|
+
delete(value: T): boolean;
|
|
9
|
+
clear(): T[];
|
|
10
|
+
[Symbol.iterator](): MapIterator<T>;
|
|
11
|
+
}
|
|
12
|
+
export interface Tracker {
|
|
13
|
+
associate?: string;
|
|
14
|
+
property?: string;
|
|
15
|
+
noShadow?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const symbols: {
|
|
18
|
+
shadow: symbol;
|
|
19
|
+
caller: symbol;
|
|
20
|
+
receiver: symbol;
|
|
21
|
+
original: symbol;
|
|
22
|
+
metadata: symbol;
|
|
23
|
+
initHooks: symbol;
|
|
24
|
+
checkProto: symbol;
|
|
25
|
+
effect: typeof Context.effect;
|
|
26
|
+
filter: typeof Context.filter;
|
|
27
|
+
isolate: typeof Context.isolate;
|
|
28
|
+
intercept: typeof Context.intercept;
|
|
29
|
+
init: typeof Service.init;
|
|
30
|
+
check: typeof Service.check;
|
|
31
|
+
config: typeof Service.config;
|
|
32
|
+
invoke: typeof Service.invoke;
|
|
33
|
+
extend: typeof Service.extend;
|
|
34
|
+
tracker: typeof Service.tracker;
|
|
35
|
+
resolveConfig: typeof Service.resolveConfig;
|
|
36
|
+
};
|
|
37
|
+
export declare function isConstructor(func: any): func is new (...args: any) => any;
|
|
38
|
+
export declare function joinPrototype(proto1: {}, proto2: {}): any;
|
|
39
|
+
export declare function isObject(value: any): value is {};
|
|
40
|
+
export declare function getPropertyDescriptor(target: any, prop: string | symbol): TypedPropertyDescriptor<any> | undefined;
|
|
41
|
+
export declare function getTraceable<T>(ctx: Context, value: T): T;
|
|
42
|
+
export declare function withProps(target: any, props?: {}): any;
|
|
43
|
+
export declare function createCallable(name: string, proto: {}, tracker: Tracker): any;
|
|
44
|
+
interface StackInfo {
|
|
45
|
+
offset: number;
|
|
46
|
+
error: Error;
|
|
47
|
+
}
|
|
48
|
+
export declare function composeError<T>(callback: (info: StackInfo) => T, getOuterStack?: () => string[]): T;
|
|
49
|
+
export declare function buildOuterStack(offset?: number): () => string[];
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cordis",
|
|
3
|
+
"description": "Meta-Framework for Modern Applications",
|
|
4
|
+
"version": "4.0.0-rc.11",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "lib/index.js",
|
|
8
|
+
"types": "lib/index.d.ts",
|
|
9
|
+
"bin": "bin.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/index.d.ts",
|
|
13
|
+
"default": "./lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./src/*": "./src/*",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib",
|
|
20
|
+
"bin.js"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/cordiverse/cordis.git",
|
|
25
|
+
"directory": "packages/core"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/cordiverse/cordis/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/cordiverse/cordis",
|
|
31
|
+
"author": "Shigma <shigma10826@gmail.com>",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@cordisjs/plugin-include": "^1.1.1",
|
|
35
|
+
"@cordisjs/plugin-loader": "^1.0.0-rc.8"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@cordisjs/plugin-include": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
41
|
+
"@cordisjs/plugin-loader": {
|
|
42
|
+
"optional": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@standard-schema/spec": "^1.1.0",
|
|
47
|
+
"cosmokit": "^1.8.1"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present Shigma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# cosmokit
|
|
2
|
+
|
|
3
|
+
[](https://codecov.io/gh/shigma/cosmokit)
|
|
4
|
+
[](https://www.npmjs.com/package/cosmokit)
|
|
5
|
+
|
|
6
|
+
A collection of common utilities.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
### Node.js
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install cosmokit
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import cosmokit from 'cosmokit'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Deno
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import cosmokit from 'npm:cosmokit@latest'
|
|
24
|
+
```
|