@kubb/agent 0.0.0-canary-20260217115709
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/.output/nitro.json +15 -0
- package/.output/server/chunks/_/package.mjs +4 -0
- package/.output/server/chunks/_/package.mjs.map +1 -0
- package/.output/server/chunks/nitro/nitro.mjs +6685 -0
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -0
- package/.output/server/chunks/routes/api/generate.options.mjs +31 -0
- package/.output/server/chunks/routes/api/generate.options.mjs.map +1 -0
- package/.output/server/chunks/routes/api/generate.post.mjs +120 -0
- package/.output/server/chunks/routes/api/generate.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/health.get.mjs +36 -0
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/info.get.mjs +63 -0
- package/.output/server/chunks/routes/api/info.get.mjs.map +1 -0
- package/.output/server/index.mjs +25 -0
- package/.output/server/index.mjs.map +1 -0
- package/.output/server/node_modules/.nitro/path-key@3.1.1/index.js +16 -0
- package/.output/server/node_modules/.nitro/path-key@3.1.1/package.json +39 -0
- package/.output/server/node_modules/.nitro/path-key@4.0.0/index.js +12 -0
- package/.output/server/node_modules/.nitro/path-key@4.0.0/package.json +41 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/buffer-util.js +131 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/constants.js +18 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/event-target.js +292 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/extension.js +203 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/limiter.js +55 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/permessage-deflate.js +514 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/receiver.js +706 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/sender.js +602 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/stream.js +159 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/subprotocol.js +62 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/validation.js +152 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket-server.js +540 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket.js +1388 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/package.json +69 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/wrapper.mjs +8 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/buffer-util.js +131 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/constants.js +19 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/event-target.js +292 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/extension.js +203 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/limiter.js +55 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/permessage-deflate.js +528 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/receiver.js +706 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/sender.js +602 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/stream.js +161 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/subprotocol.js +62 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/validation.js +152 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/websocket-server.js +554 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/lib/websocket.js +1393 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/package.json +69 -0
- package/.output/server/node_modules/.nitro/ws@8.19.0/wrapper.mjs +8 -0
- package/.output/server/node_modules/@clack/core/dist/index.mjs +18 -0
- package/.output/server/node_modules/@clack/core/package.json +61 -0
- package/.output/server/node_modules/@clack/prompts/dist/index.mjs +135 -0
- package/.output/server/node_modules/@clack/prompts/package.json +66 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/Root-BQX3eHqb.js +830 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-BVHe6Par.js +22 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/defaultParser-BD_N68Bo.js +16 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/getRelativePath-C4Au07ON.js +58 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +668 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +102 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +18 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +620 -0
- package/.output/server/node_modules/@kubb/fabric-core/package.json +120 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/chunk-DbZtQ4qb.js +47 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +535 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime-CQFBnRKx.js +265 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +13 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/parsers.js +3 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +7 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/react--draJ5Pm.js +1192 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/reactPlugin-DqJsInTf.js +17931 -0
- package/.output/server/node_modules/@kubb/react-fabric/package.json +140 -0
- package/.output/server/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.js +89 -0
- package/.output/server/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.js +34 -0
- package/.output/server/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.js +6 -0
- package/.output/server/node_modules/@sec-ant/readable-stream/package.json +98 -0
- package/.output/server/node_modules/@sindresorhus/merge-streams/index.js +265 -0
- package/.output/server/node_modules/@sindresorhus/merge-streams/package.json +49 -0
- package/.output/server/node_modules/balanced-match/index.js +62 -0
- package/.output/server/node_modules/balanced-match/package.json +48 -0
- package/.output/server/node_modules/brace-expansion/index.js +201 -0
- package/.output/server/node_modules/brace-expansion/package.json +50 -0
- package/.output/server/node_modules/buffer-from/index.js +72 -0
- package/.output/server/node_modules/buffer-from/package.json +19 -0
- package/.output/server/node_modules/bytes/index.js +159 -0
- package/.output/server/node_modules/bytes/package.json +39 -0
- package/.output/server/node_modules/concat-map/index.js +13 -0
- package/.output/server/node_modules/concat-map/package.json +59 -0
- package/.output/server/node_modules/content-disposition/index.js +445 -0
- package/.output/server/node_modules/content-disposition/package.json +39 -0
- package/.output/server/node_modules/cross-spawn/index.js +39 -0
- package/.output/server/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/.output/server/node_modules/cross-spawn/lib/parse.js +91 -0
- package/.output/server/node_modules/cross-spawn/lib/util/escape.js +47 -0
- package/.output/server/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
- package/.output/server/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
- package/.output/server/node_modules/cross-spawn/package.json +73 -0
- package/.output/server/node_modules/execa/index.js +28 -0
- package/.output/server/node_modules/execa/lib/arguments/command.js +20 -0
- package/.output/server/node_modules/execa/lib/arguments/cwd.js +39 -0
- package/.output/server/node_modules/execa/lib/arguments/encoding-option.js +50 -0
- package/.output/server/node_modules/execa/lib/arguments/escape.js +88 -0
- package/.output/server/node_modules/execa/lib/arguments/fd-options.js +108 -0
- package/.output/server/node_modules/execa/lib/arguments/file-url.js +25 -0
- package/.output/server/node_modules/execa/lib/arguments/options.js +96 -0
- package/.output/server/node_modules/execa/lib/arguments/shell.js +11 -0
- package/.output/server/node_modules/execa/lib/arguments/specific.js +111 -0
- package/.output/server/node_modules/execa/lib/convert/add.js +15 -0
- package/.output/server/node_modules/execa/lib/convert/concurrent.js +33 -0
- package/.output/server/node_modules/execa/lib/convert/duplex.js +69 -0
- package/.output/server/node_modules/execa/lib/convert/iterable.js +34 -0
- package/.output/server/node_modules/execa/lib/convert/readable.js +113 -0
- package/.output/server/node_modules/execa/lib/convert/shared.js +46 -0
- package/.output/server/node_modules/execa/lib/convert/writable.js +90 -0
- package/.output/server/node_modules/execa/lib/io/contents.js +116 -0
- package/.output/server/node_modules/execa/lib/io/input-sync.js +44 -0
- package/.output/server/node_modules/execa/lib/io/iterate.js +110 -0
- package/.output/server/node_modules/execa/lib/io/max-buffer.js +89 -0
- package/.output/server/node_modules/execa/lib/io/output-async.js +80 -0
- package/.output/server/node_modules/execa/lib/io/output-sync.js +135 -0
- package/.output/server/node_modules/execa/lib/io/pipeline.js +48 -0
- package/.output/server/node_modules/execa/lib/io/strip-newline.js +12 -0
- package/.output/server/node_modules/execa/lib/ipc/array.js +4 -0
- package/.output/server/node_modules/execa/lib/ipc/buffer-messages.js +47 -0
- package/.output/server/node_modules/execa/lib/ipc/forward.js +56 -0
- package/.output/server/node_modules/execa/lib/ipc/get-each.js +89 -0
- package/.output/server/node_modules/execa/lib/ipc/get-one.js +69 -0
- package/.output/server/node_modules/execa/lib/ipc/graceful.js +72 -0
- package/.output/server/node_modules/execa/lib/ipc/incoming.js +79 -0
- package/.output/server/node_modules/execa/lib/ipc/ipc-input.js +44 -0
- package/.output/server/node_modules/execa/lib/ipc/methods.js +49 -0
- package/.output/server/node_modules/execa/lib/ipc/outgoing.js +47 -0
- package/.output/server/node_modules/execa/lib/ipc/reference.js +44 -0
- package/.output/server/node_modules/execa/lib/ipc/send.js +91 -0
- package/.output/server/node_modules/execa/lib/ipc/strict.js +113 -0
- package/.output/server/node_modules/execa/lib/ipc/validation.js +111 -0
- package/.output/server/node_modules/execa/lib/methods/bind.js +23 -0
- package/.output/server/node_modules/execa/lib/methods/command.js +43 -0
- package/.output/server/node_modules/execa/lib/methods/create.js +65 -0
- package/.output/server/node_modules/execa/lib/methods/main-async.js +194 -0
- package/.output/server/node_modules/execa/lib/methods/main-sync.js +163 -0
- package/.output/server/node_modules/execa/lib/methods/node.js +51 -0
- package/.output/server/node_modules/execa/lib/methods/parameters.js +31 -0
- package/.output/server/node_modules/execa/lib/methods/promise.js +15 -0
- package/.output/server/node_modules/execa/lib/methods/script.js +22 -0
- package/.output/server/node_modules/execa/lib/methods/template.js +153 -0
- package/.output/server/node_modules/execa/lib/pipe/abort.js +20 -0
- package/.output/server/node_modules/execa/lib/pipe/pipe-arguments.js +91 -0
- package/.output/server/node_modules/execa/lib/pipe/sequence.js +24 -0
- package/.output/server/node_modules/execa/lib/pipe/setup.js +72 -0
- package/.output/server/node_modules/execa/lib/pipe/streaming.js +51 -0
- package/.output/server/node_modules/execa/lib/pipe/throw.js +58 -0
- package/.output/server/node_modules/execa/lib/resolve/all-async.js +46 -0
- package/.output/server/node_modules/execa/lib/resolve/all-sync.js +33 -0
- package/.output/server/node_modules/execa/lib/resolve/exit-async.js +54 -0
- package/.output/server/node_modules/execa/lib/resolve/exit-sync.js +25 -0
- package/.output/server/node_modules/execa/lib/resolve/stdio.js +47 -0
- package/.output/server/node_modules/execa/lib/resolve/wait-stream.js +96 -0
- package/.output/server/node_modules/execa/lib/resolve/wait-subprocess.js +146 -0
- package/.output/server/node_modules/execa/lib/return/duration.js +8 -0
- package/.output/server/node_modules/execa/lib/return/early-error.js +60 -0
- package/.output/server/node_modules/execa/lib/return/final-error.js +40 -0
- package/.output/server/node_modules/execa/lib/return/message.js +157 -0
- package/.output/server/node_modules/execa/lib/return/reject.js +13 -0
- package/.output/server/node_modules/execa/lib/return/result.js +186 -0
- package/.output/server/node_modules/execa/lib/stdio/direction.js +76 -0
- package/.output/server/node_modules/execa/lib/stdio/duplicate.js +116 -0
- package/.output/server/node_modules/execa/lib/stdio/handle-async.js +52 -0
- package/.output/server/node_modules/execa/lib/stdio/handle-sync.js +57 -0
- package/.output/server/node_modules/execa/lib/stdio/handle.js +214 -0
- package/.output/server/node_modules/execa/lib/stdio/input-option.js +50 -0
- package/.output/server/node_modules/execa/lib/stdio/native.js +106 -0
- package/.output/server/node_modules/execa/lib/stdio/stdio-option.js +60 -0
- package/.output/server/node_modules/execa/lib/stdio/type.js +173 -0
- package/.output/server/node_modules/execa/lib/terminate/cancel.js +20 -0
- package/.output/server/node_modules/execa/lib/terminate/cleanup.js +16 -0
- package/.output/server/node_modules/execa/lib/terminate/graceful.js +71 -0
- package/.output/server/node_modules/execa/lib/terminate/kill.js +93 -0
- package/.output/server/node_modules/execa/lib/terminate/signal.js +70 -0
- package/.output/server/node_modules/execa/lib/terminate/timeout.js +21 -0
- package/.output/server/node_modules/execa/lib/transform/encoding-transform.js +51 -0
- package/.output/server/node_modules/execa/lib/transform/generator.js +107 -0
- package/.output/server/node_modules/execa/lib/transform/normalize.js +111 -0
- package/.output/server/node_modules/execa/lib/transform/object-mode.js +41 -0
- package/.output/server/node_modules/execa/lib/transform/run-async.js +60 -0
- package/.output/server/node_modules/execa/lib/transform/run-sync.js +50 -0
- package/.output/server/node_modules/execa/lib/transform/split.js +110 -0
- package/.output/server/node_modules/execa/lib/transform/validate.js +43 -0
- package/.output/server/node_modules/execa/lib/utils/abort-signal.js +8 -0
- package/.output/server/node_modules/execa/lib/utils/deferred.js +7 -0
- package/.output/server/node_modules/execa/lib/utils/max-listeners.js +14 -0
- package/.output/server/node_modules/execa/lib/utils/standard-stream.js +6 -0
- package/.output/server/node_modules/execa/lib/utils/uint-array.js +69 -0
- package/.output/server/node_modules/execa/lib/verbose/complete.js +24 -0
- package/.output/server/node_modules/execa/lib/verbose/custom.js +26 -0
- package/.output/server/node_modules/execa/lib/verbose/default.js +54 -0
- package/.output/server/node_modules/execa/lib/verbose/error.js +13 -0
- package/.output/server/node_modules/execa/lib/verbose/info.js +39 -0
- package/.output/server/node_modules/execa/lib/verbose/ipc.js +15 -0
- package/.output/server/node_modules/execa/lib/verbose/log.js +54 -0
- package/.output/server/node_modules/execa/lib/verbose/output.js +60 -0
- package/.output/server/node_modules/execa/lib/verbose/start.js +15 -0
- package/.output/server/node_modules/execa/lib/verbose/values.js +33 -0
- package/.output/server/node_modules/execa/package.json +105 -0
- package/.output/server/node_modules/figures/index.js +292 -0
- package/.output/server/node_modules/figures/package.json +49 -0
- package/.output/server/node_modules/fs-extra/lib/copy/copy-sync.js +176 -0
- package/.output/server/node_modules/fs-extra/lib/copy/copy.js +180 -0
- package/.output/server/node_modules/fs-extra/lib/copy/index.js +7 -0
- package/.output/server/node_modules/fs-extra/lib/empty/index.js +39 -0
- package/.output/server/node_modules/fs-extra/lib/ensure/file.js +66 -0
- package/.output/server/node_modules/fs-extra/lib/ensure/index.js +23 -0
- package/.output/server/node_modules/fs-extra/lib/ensure/link.js +64 -0
- package/.output/server/node_modules/fs-extra/lib/ensure/symlink-paths.js +101 -0
- package/.output/server/node_modules/fs-extra/lib/ensure/symlink-type.js +34 -0
- package/.output/server/node_modules/fs-extra/lib/ensure/symlink.js +67 -0
- package/.output/server/node_modules/fs-extra/lib/fs/index.js +146 -0
- package/.output/server/node_modules/fs-extra/lib/index.js +16 -0
- package/.output/server/node_modules/fs-extra/lib/json/index.js +16 -0
- package/.output/server/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
- package/.output/server/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
- package/.output/server/node_modules/fs-extra/lib/json/output-json.js +12 -0
- package/.output/server/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
- package/.output/server/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
- package/.output/server/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
- package/.output/server/node_modules/fs-extra/lib/move/index.js +7 -0
- package/.output/server/node_modules/fs-extra/lib/move/move-sync.js +55 -0
- package/.output/server/node_modules/fs-extra/lib/move/move.js +59 -0
- package/.output/server/node_modules/fs-extra/lib/output-file/index.js +31 -0
- package/.output/server/node_modules/fs-extra/lib/path-exists/index.js +12 -0
- package/.output/server/node_modules/fs-extra/lib/remove/index.js +17 -0
- package/.output/server/node_modules/fs-extra/lib/util/async.js +29 -0
- package/.output/server/node_modules/fs-extra/lib/util/stat.js +159 -0
- package/.output/server/node_modules/fs-extra/lib/util/utimes.js +36 -0
- package/.output/server/node_modules/fs-extra/package.json +71 -0
- package/.output/server/node_modules/get-stream/package.json +60 -0
- package/.output/server/node_modules/get-stream/source/array-buffer.js +84 -0
- package/.output/server/node_modules/get-stream/source/array.js +32 -0
- package/.output/server/node_modules/get-stream/source/buffer.js +19 -0
- package/.output/server/node_modules/get-stream/source/contents.js +121 -0
- package/.output/server/node_modules/get-stream/source/exports.js +5 -0
- package/.output/server/node_modules/get-stream/source/index.js +13 -0
- package/.output/server/node_modules/get-stream/source/stream.js +65 -0
- package/.output/server/node_modules/get-stream/source/string.js +41 -0
- package/.output/server/node_modules/get-stream/source/utils.js +11 -0
- package/.output/server/node_modules/graceful-fs/clone.js +23 -0
- package/.output/server/node_modules/graceful-fs/graceful-fs.js +448 -0
- package/.output/server/node_modules/graceful-fs/legacy-streams.js +118 -0
- package/.output/server/node_modules/graceful-fs/package.json +53 -0
- package/.output/server/node_modules/graceful-fs/polyfills.js +355 -0
- package/.output/server/node_modules/human-signals/build/src/core.js +273 -0
- package/.output/server/node_modules/human-signals/build/src/main.js +70 -0
- package/.output/server/node_modules/human-signals/build/src/realtime.js +16 -0
- package/.output/server/node_modules/human-signals/build/src/signals.js +34 -0
- package/.output/server/node_modules/human-signals/package.json +66 -0
- package/.output/server/node_modules/is-plain-obj/index.js +8 -0
- package/.output/server/node_modules/is-plain-obj/package.json +41 -0
- package/.output/server/node_modules/is-stream/index.js +37 -0
- package/.output/server/node_modules/is-stream/package.json +48 -0
- package/.output/server/node_modules/is-unicode-supported/index.js +21 -0
- package/.output/server/node_modules/is-unicode-supported/package.json +47 -0
- package/.output/server/node_modules/isexe/index.js +57 -0
- package/.output/server/node_modules/isexe/mode.js +41 -0
- package/.output/server/node_modules/isexe/package.json +31 -0
- package/.output/server/node_modules/isexe/windows.js +42 -0
- package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -0
- package/.output/server/node_modules/jiti/lib/jiti.mjs +29 -0
- package/.output/server/node_modules/jiti/package.json +133 -0
- package/.output/server/node_modules/js-runtime/dist/index.js +5 -0
- package/.output/server/node_modules/js-runtime/package.json +72 -0
- package/.output/server/node_modules/jsonfile/index.js +88 -0
- package/.output/server/node_modules/jsonfile/package.json +40 -0
- package/.output/server/node_modules/jsonfile/utils.js +14 -0
- package/.output/server/node_modules/mime-db/db.json +7088 -0
- package/.output/server/node_modules/mime-db/index.js +11 -0
- package/.output/server/node_modules/mime-db/package.json +57 -0
- package/.output/server/node_modules/mime-types/index.js +188 -0
- package/.output/server/node_modules/mime-types/package.json +43 -0
- package/.output/server/node_modules/minimatch/minimatch.js +947 -0
- package/.output/server/node_modules/minimatch/package.json +33 -0
- package/.output/server/node_modules/natural-orderby/dist/main.js +19 -0
- package/.output/server/node_modules/natural-orderby/dist/umd/natural-orderby.development.js +420 -0
- package/.output/server/node_modules/natural-orderby/dist/umd/natural-orderby.production.min.js +11 -0
- package/.output/server/node_modules/natural-orderby/package.json +119 -0
- package/.output/server/node_modules/npm-run-path/index.js +55 -0
- package/.output/server/node_modules/npm-run-path/package.json +52 -0
- package/.output/server/node_modules/p-limit/index.js +127 -0
- package/.output/server/node_modules/p-limit/package.json +58 -0
- package/.output/server/node_modules/parse-ms/index.js +45 -0
- package/.output/server/node_modules/parse-ms/package.json +47 -0
- package/.output/server/node_modules/path-is-inside/lib/path-is-inside.js +28 -0
- package/.output/server/node_modules/path-is-inside/package.json +27 -0
- package/.output/server/node_modules/path-to-regexp/index.js +421 -0
- package/.output/server/node_modules/path-to-regexp/package.json +46 -0
- package/.output/server/node_modules/picocolors/package.json +25 -0
- package/.output/server/node_modules/picocolors/picocolors.js +75 -0
- package/.output/server/node_modules/pretty-ms/index.js +149 -0
- package/.output/server/node_modules/pretty-ms/package.json +55 -0
- package/.output/server/node_modules/range-parser/index.js +158 -0
- package/.output/server/node_modules/range-parser/package.json +40 -0
- package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
- package/.output/server/node_modules/react-devtools-core/package.json +38 -0
- package/.output/server/node_modules/remeda/dist/add.js +2 -0
- package/.output/server/node_modules/remeda/dist/addProp.js +2 -0
- package/.output/server/node_modules/remeda/dist/allPass.js +2 -0
- package/.output/server/node_modules/remeda/dist/anyPass.js +2 -0
- package/.output/server/node_modules/remeda/dist/binarySearchCutoffIndex-CLQRwIY1.js +2 -0
- package/.output/server/node_modules/remeda/dist/capitalize.js +2 -0
- package/.output/server/node_modules/remeda/dist/ceil.js +2 -0
- package/.output/server/node_modules/remeda/dist/chunk.js +2 -0
- package/.output/server/node_modules/remeda/dist/clamp.js +2 -0
- package/.output/server/node_modules/remeda/dist/clone.js +2 -0
- package/.output/server/node_modules/remeda/dist/concat.js +2 -0
- package/.output/server/node_modules/remeda/dist/conditional.js +2 -0
- package/.output/server/node_modules/remeda/dist/constant.js +2 -0
- package/.output/server/node_modules/remeda/dist/countBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/debounce.js +2 -0
- package/.output/server/node_modules/remeda/dist/defaultTo.js +2 -0
- package/.output/server/node_modules/remeda/dist/difference.js +2 -0
- package/.output/server/node_modules/remeda/dist/differenceWith.js +2 -0
- package/.output/server/node_modules/remeda/dist/divide.js +2 -0
- package/.output/server/node_modules/remeda/dist/doNothing.js +2 -0
- package/.output/server/node_modules/remeda/dist/drop.js +2 -0
- package/.output/server/node_modules/remeda/dist/dropFirstBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/dropLast.js +2 -0
- package/.output/server/node_modules/remeda/dist/dropLastWhile.js +2 -0
- package/.output/server/node_modules/remeda/dist/dropWhile.js +2 -0
- package/.output/server/node_modules/remeda/dist/endsWith.js +2 -0
- package/.output/server/node_modules/remeda/dist/entries.js +2 -0
- package/.output/server/node_modules/remeda/dist/evolve.js +2 -0
- package/.output/server/node_modules/remeda/dist/filter.js +2 -0
- package/.output/server/node_modules/remeda/dist/find.js +2 -0
- package/.output/server/node_modules/remeda/dist/findIndex.js +2 -0
- package/.output/server/node_modules/remeda/dist/findLast.js +2 -0
- package/.output/server/node_modules/remeda/dist/findLastIndex.js +2 -0
- package/.output/server/node_modules/remeda/dist/first.js +2 -0
- package/.output/server/node_modules/remeda/dist/firstBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/flat.js +2 -0
- package/.output/server/node_modules/remeda/dist/flatMap.js +2 -0
- package/.output/server/node_modules/remeda/dist/floor.js +2 -0
- package/.output/server/node_modules/remeda/dist/forEach.js +2 -0
- package/.output/server/node_modules/remeda/dist/forEachObj.js +2 -0
- package/.output/server/node_modules/remeda/dist/fromEntries.js +2 -0
- package/.output/server/node_modules/remeda/dist/fromKeys.js +2 -0
- package/.output/server/node_modules/remeda/dist/funnel.js +2 -0
- package/.output/server/node_modules/remeda/dist/groupBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/groupByProp.js +2 -0
- package/.output/server/node_modules/remeda/dist/hasAtLeast.js +2 -0
- package/.output/server/node_modules/remeda/dist/hasSubObject.js +2 -0
- package/.output/server/node_modules/remeda/dist/heap-OOe_F8_z.js +2 -0
- package/.output/server/node_modules/remeda/dist/identity.js +2 -0
- package/.output/server/node_modules/remeda/dist/index.js +1 -0
- package/.output/server/node_modules/remeda/dist/indexBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/intersection.js +2 -0
- package/.output/server/node_modules/remeda/dist/intersectionWith.js +2 -0
- package/.output/server/node_modules/remeda/dist/invert.js +2 -0
- package/.output/server/node_modules/remeda/dist/isArray.js +2 -0
- package/.output/server/node_modules/remeda/dist/isBigInt.js +2 -0
- package/.output/server/node_modules/remeda/dist/isBoolean.js +2 -0
- package/.output/server/node_modules/remeda/dist/isDate.js +2 -0
- package/.output/server/node_modules/remeda/dist/isDeepEqual.js +2 -0
- package/.output/server/node_modules/remeda/dist/isDefined.js +2 -0
- package/.output/server/node_modules/remeda/dist/isEmpty.js +2 -0
- package/.output/server/node_modules/remeda/dist/isEmptyish.js +2 -0
- package/.output/server/node_modules/remeda/dist/isError.js +2 -0
- package/.output/server/node_modules/remeda/dist/isFunction.js +2 -0
- package/.output/server/node_modules/remeda/dist/isIncludedIn.js +2 -0
- package/.output/server/node_modules/remeda/dist/isNonNull.js +2 -0
- package/.output/server/node_modules/remeda/dist/isNonNullish.js +2 -0
- package/.output/server/node_modules/remeda/dist/isNot.js +2 -0
- package/.output/server/node_modules/remeda/dist/isNullish.js +2 -0
- package/.output/server/node_modules/remeda/dist/isNumber.js +2 -0
- package/.output/server/node_modules/remeda/dist/isObjectType.js +2 -0
- package/.output/server/node_modules/remeda/dist/isPlainObject.js +2 -0
- package/.output/server/node_modules/remeda/dist/isPromise.js +2 -0
- package/.output/server/node_modules/remeda/dist/isShallowEqual.js +2 -0
- package/.output/server/node_modules/remeda/dist/isStrictEqual.js +2 -0
- package/.output/server/node_modules/remeda/dist/isString.js +2 -0
- package/.output/server/node_modules/remeda/dist/isSymbol.js +2 -0
- package/.output/server/node_modules/remeda/dist/isTruthy.js +2 -0
- package/.output/server/node_modules/remeda/dist/join.js +2 -0
- package/.output/server/node_modules/remeda/dist/keys.js +2 -0
- package/.output/server/node_modules/remeda/dist/last.js +2 -0
- package/.output/server/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js +2 -0
- package/.output/server/node_modules/remeda/dist/length.js +2 -0
- package/.output/server/node_modules/remeda/dist/map.js +2 -0
- package/.output/server/node_modules/remeda/dist/mapKeys.js +2 -0
- package/.output/server/node_modules/remeda/dist/mapToObj.js +2 -0
- package/.output/server/node_modules/remeda/dist/mapValues.js +2 -0
- package/.output/server/node_modules/remeda/dist/mapWithFeedback.js +2 -0
- package/.output/server/node_modules/remeda/dist/mean.js +2 -0
- package/.output/server/node_modules/remeda/dist/meanBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/median.js +2 -0
- package/.output/server/node_modules/remeda/dist/merge.js +2 -0
- package/.output/server/node_modules/remeda/dist/mergeAll.js +2 -0
- package/.output/server/node_modules/remeda/dist/mergeDeep.js +2 -0
- package/.output/server/node_modules/remeda/dist/multiply.js +2 -0
- package/.output/server/node_modules/remeda/dist/nthBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/objOf.js +2 -0
- package/.output/server/node_modules/remeda/dist/omit.js +2 -0
- package/.output/server/node_modules/remeda/dist/omitBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/once.js +2 -0
- package/.output/server/node_modules/remeda/dist/only.js +2 -0
- package/.output/server/node_modules/remeda/dist/partialBind.js +2 -0
- package/.output/server/node_modules/remeda/dist/partialLastBind.js +2 -0
- package/.output/server/node_modules/remeda/dist/partition.js +2 -0
- package/.output/server/node_modules/remeda/dist/pathOr.js +2 -0
- package/.output/server/node_modules/remeda/dist/pick.js +2 -0
- package/.output/server/node_modules/remeda/dist/pickBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/pipe.js +2 -0
- package/.output/server/node_modules/remeda/dist/piped.js +2 -0
- package/.output/server/node_modules/remeda/dist/product.js +2 -0
- package/.output/server/node_modules/remeda/dist/prop.js +2 -0
- package/.output/server/node_modules/remeda/dist/pullObject.js +2 -0
- package/.output/server/node_modules/remeda/dist/purry.js +2 -0
- package/.output/server/node_modules/remeda/dist/purryFromLazy-B-_oTxzb.js +2 -0
- package/.output/server/node_modules/remeda/dist/purryOn-D4wFIFMT.js +2 -0
- package/.output/server/node_modules/remeda/dist/purryOrderRules-4JgY6z4X.js +2 -0
- package/.output/server/node_modules/remeda/dist/quickSelect-B4eZ0JeB.js +2 -0
- package/.output/server/node_modules/remeda/dist/randomBigInt.js +2 -0
- package/.output/server/node_modules/remeda/dist/randomInteger.js +2 -0
- package/.output/server/node_modules/remeda/dist/randomString.js +2 -0
- package/.output/server/node_modules/remeda/dist/range.js +2 -0
- package/.output/server/node_modules/remeda/dist/rankBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/reduce.js +2 -0
- package/.output/server/node_modules/remeda/dist/reverse.js +2 -0
- package/.output/server/node_modules/remeda/dist/round.js +2 -0
- package/.output/server/node_modules/remeda/dist/sample.js +2 -0
- package/.output/server/node_modules/remeda/dist/set.js +2 -0
- package/.output/server/node_modules/remeda/dist/setPath.js +2 -0
- package/.output/server/node_modules/remeda/dist/shuffle.js +2 -0
- package/.output/server/node_modules/remeda/dist/sliceString.js +2 -0
- package/.output/server/node_modules/remeda/dist/sort.js +2 -0
- package/.output/server/node_modules/remeda/dist/sortBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/sortedIndex.js +2 -0
- package/.output/server/node_modules/remeda/dist/sortedIndexBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/sortedIndexWith.js +2 -0
- package/.output/server/node_modules/remeda/dist/sortedLastIndex.js +2 -0
- package/.output/server/node_modules/remeda/dist/sortedLastIndexBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/splice.js +2 -0
- package/.output/server/node_modules/remeda/dist/split.js +2 -0
- package/.output/server/node_modules/remeda/dist/splitAt.js +2 -0
- package/.output/server/node_modules/remeda/dist/splitWhen.js +2 -0
- package/.output/server/node_modules/remeda/dist/startsWith.js +2 -0
- package/.output/server/node_modules/remeda/dist/stringToPath.js +2 -0
- package/.output/server/node_modules/remeda/dist/subtract.js +2 -0
- package/.output/server/node_modules/remeda/dist/sum.js +2 -0
- package/.output/server/node_modules/remeda/dist/sumBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/swapInPlace-BrVgf3c3.js +2 -0
- package/.output/server/node_modules/remeda/dist/swapIndices.js +2 -0
- package/.output/server/node_modules/remeda/dist/swapProps.js +2 -0
- package/.output/server/node_modules/remeda/dist/take.js +2 -0
- package/.output/server/node_modules/remeda/dist/takeFirstBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/takeLast.js +2 -0
- package/.output/server/node_modules/remeda/dist/takeLastWhile.js +2 -0
- package/.output/server/node_modules/remeda/dist/takeWhile.js +2 -0
- package/.output/server/node_modules/remeda/dist/tap.js +2 -0
- package/.output/server/node_modules/remeda/dist/times.js +2 -0
- package/.output/server/node_modules/remeda/dist/toCamelCase.js +2 -0
- package/.output/server/node_modules/remeda/dist/toKebabCase.js +2 -0
- package/.output/server/node_modules/remeda/dist/toLowerCase.js +2 -0
- package/.output/server/node_modules/remeda/dist/toSingle-qs9PC5sP.js +2 -0
- package/.output/server/node_modules/remeda/dist/toSnakeCase.js +2 -0
- package/.output/server/node_modules/remeda/dist/toTitleCase.js +2 -0
- package/.output/server/node_modules/remeda/dist/toUpperCase.js +2 -0
- package/.output/server/node_modules/remeda/dist/truncate.js +2 -0
- package/.output/server/node_modules/remeda/dist/uncapitalize.js +2 -0
- package/.output/server/node_modules/remeda/dist/unique.js +2 -0
- package/.output/server/node_modules/remeda/dist/uniqueBy.js +2 -0
- package/.output/server/node_modules/remeda/dist/uniqueWith.js +2 -0
- package/.output/server/node_modules/remeda/dist/utilityEvaluators-BQqW5Ir5.js +2 -0
- package/.output/server/node_modules/remeda/dist/values.js +2 -0
- package/.output/server/node_modules/remeda/dist/when.js +2 -0
- package/.output/server/node_modules/remeda/dist/withPrecision-CDZ-Oor7.js +2 -0
- package/.output/server/node_modules/remeda/dist/words-Dv8LmnKC.js +3 -0
- package/.output/server/node_modules/remeda/dist/zip.js +2 -0
- package/.output/server/node_modules/remeda/dist/zipWith.js +2 -0
- package/.output/server/node_modules/remeda/package.json +90 -0
- package/.output/server/node_modules/semver/classes/comparator.js +143 -0
- package/.output/server/node_modules/semver/classes/range.js +557 -0
- package/.output/server/node_modules/semver/classes/semver.js +333 -0
- package/.output/server/node_modules/semver/functions/clean.js +8 -0
- package/.output/server/node_modules/semver/functions/cmp.js +54 -0
- package/.output/server/node_modules/semver/functions/coerce.js +62 -0
- package/.output/server/node_modules/semver/functions/compare-build.js +9 -0
- package/.output/server/node_modules/semver/functions/compare-loose.js +5 -0
- package/.output/server/node_modules/semver/functions/compare.js +7 -0
- package/.output/server/node_modules/semver/functions/diff.js +60 -0
- package/.output/server/node_modules/semver/functions/eq.js +5 -0
- package/.output/server/node_modules/semver/functions/gt.js +5 -0
- package/.output/server/node_modules/semver/functions/gte.js +5 -0
- package/.output/server/node_modules/semver/functions/inc.js +21 -0
- package/.output/server/node_modules/semver/functions/lt.js +5 -0
- package/.output/server/node_modules/semver/functions/lte.js +5 -0
- package/.output/server/node_modules/semver/functions/major.js +5 -0
- package/.output/server/node_modules/semver/functions/minor.js +5 -0
- package/.output/server/node_modules/semver/functions/neq.js +5 -0
- package/.output/server/node_modules/semver/functions/parse.js +18 -0
- package/.output/server/node_modules/semver/functions/patch.js +5 -0
- package/.output/server/node_modules/semver/functions/prerelease.js +8 -0
- package/.output/server/node_modules/semver/functions/rcompare.js +5 -0
- package/.output/server/node_modules/semver/functions/rsort.js +5 -0
- package/.output/server/node_modules/semver/functions/satisfies.js +12 -0
- package/.output/server/node_modules/semver/functions/sort.js +5 -0
- package/.output/server/node_modules/semver/functions/valid.js +8 -0
- package/.output/server/node_modules/semver/index.js +91 -0
- package/.output/server/node_modules/semver/internal/constants.js +37 -0
- package/.output/server/node_modules/semver/internal/debug.js +11 -0
- package/.output/server/node_modules/semver/internal/identifiers.js +29 -0
- package/.output/server/node_modules/semver/internal/lrucache.js +42 -0
- package/.output/server/node_modules/semver/internal/parse-options.js +17 -0
- package/.output/server/node_modules/semver/internal/re.js +223 -0
- package/.output/server/node_modules/semver/package.json +78 -0
- package/.output/server/node_modules/semver/preload.js +4 -0
- package/.output/server/node_modules/semver/ranges/gtr.js +6 -0
- package/.output/server/node_modules/semver/ranges/intersects.js +9 -0
- package/.output/server/node_modules/semver/ranges/ltr.js +6 -0
- package/.output/server/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/.output/server/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/.output/server/node_modules/semver/ranges/min-version.js +63 -0
- package/.output/server/node_modules/semver/ranges/outside.js +82 -0
- package/.output/server/node_modules/semver/ranges/simplify.js +49 -0
- package/.output/server/node_modules/semver/ranges/subset.js +249 -0
- package/.output/server/node_modules/semver/ranges/to-comparators.js +10 -0
- package/.output/server/node_modules/semver/ranges/valid.js +13 -0
- package/.output/server/node_modules/serve-handler/package.json +68 -0
- package/.output/server/node_modules/serve-handler/src/directory.js +16 -0
- package/.output/server/node_modules/serve-handler/src/error.js +10 -0
- package/.output/server/node_modules/serve-handler/src/glob-slash.js +9 -0
- package/.output/server/node_modules/serve-handler/src/index.js +769 -0
- package/.output/server/node_modules/shebang-command/index.js +19 -0
- package/.output/server/node_modules/shebang-command/package.json +34 -0
- package/.output/server/node_modules/shebang-regex/index.js +2 -0
- package/.output/server/node_modules/shebang-regex/package.json +35 -0
- package/.output/server/node_modules/signal-exit/dist/mjs/index.js +275 -0
- package/.output/server/node_modules/signal-exit/dist/mjs/package.json +3 -0
- package/.output/server/node_modules/signal-exit/dist/mjs/signals.js +39 -0
- package/.output/server/node_modules/signal-exit/package.json +106 -0
- package/.output/server/node_modules/sisteransi/package.json +34 -0
- package/.output/server/node_modules/sisteransi/src/index.js +58 -0
- package/.output/server/node_modules/source-map/lib/array-set.js +121 -0
- package/.output/server/node_modules/source-map/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/source-map/lib/base64.js +67 -0
- package/.output/server/node_modules/source-map/lib/binary-search.js +111 -0
- package/.output/server/node_modules/source-map/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/source-map/lib/quick-sort.js +114 -0
- package/.output/server/node_modules/source-map/lib/source-map-consumer.js +1145 -0
- package/.output/server/node_modules/source-map/lib/source-map-generator.js +425 -0
- package/.output/server/node_modules/source-map/lib/source-node.js +413 -0
- package/.output/server/node_modules/source-map/lib/util.js +488 -0
- package/.output/server/node_modules/source-map/package.json +73 -0
- package/.output/server/node_modules/source-map/source-map.js +8 -0
- package/.output/server/node_modules/source-map-support/package.json +31 -0
- package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
- package/.output/server/node_modules/string-argv/index.js +41 -0
- package/.output/server/node_modules/string-argv/package.json +51 -0
- package/.output/server/node_modules/strip-final-newline/index.js +26 -0
- package/.output/server/node_modules/strip-final-newline/package.json +49 -0
- package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
- package/.output/server/node_modules/typescript/package.json +120 -0
- package/.output/server/node_modules/unicorn-magic/default.js +14 -0
- package/.output/server/node_modules/unicorn-magic/node.js +49 -0
- package/.output/server/node_modules/unicorn-magic/package.json +62 -0
- package/.output/server/node_modules/universalify/index.js +24 -0
- package/.output/server/node_modules/universalify/package.json +34 -0
- package/.output/server/node_modules/which/package.json +43 -0
- package/.output/server/node_modules/which/which.js +125 -0
- package/.output/server/node_modules/yocto-queue/index.js +90 -0
- package/.output/server/node_modules/yocto-queue/package.json +48 -0
- package/.output/server/node_modules/yoctocolors/base.js +94 -0
- package/.output/server/node_modules/yoctocolors/index.js +2 -0
- package/.output/server/node_modules/yoctocolors/package.json +69 -0
- package/.output/server/package.json +66 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/package.json +70 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ws",
|
|
3
|
+
"version": "8.19.0",
|
|
4
|
+
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"HyBi",
|
|
7
|
+
"Push",
|
|
8
|
+
"RFC-6455",
|
|
9
|
+
"WebSocket",
|
|
10
|
+
"WebSockets",
|
|
11
|
+
"real-time"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/websockets/ws",
|
|
14
|
+
"bugs": "https://github.com/websockets/ws/issues",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/websockets/ws.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"main": "index.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"browser": "./browser.js",
|
|
25
|
+
"import": "./wrapper.mjs",
|
|
26
|
+
"require": "./index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"browser": "browser.js",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=10.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"browser.js",
|
|
36
|
+
"index.js",
|
|
37
|
+
"lib/*.js",
|
|
38
|
+
"wrapper.mjs"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js",
|
|
42
|
+
"integration": "mocha --throw-deprecation test/*.integration.js",
|
|
43
|
+
"lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"bufferutil": "^4.0.1",
|
|
47
|
+
"utf-8-validate": ">=5.0.2"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"bufferutil": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"utf-8-validate": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"benchmark": "^2.1.4",
|
|
59
|
+
"bufferutil": "^4.0.1",
|
|
60
|
+
"eslint": "^9.0.0",
|
|
61
|
+
"eslint-config-prettier": "^10.0.1",
|
|
62
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
63
|
+
"globals": "^16.0.0",
|
|
64
|
+
"mocha": "^8.4.0",
|
|
65
|
+
"nyc": "^15.0.0",
|
|
66
|
+
"prettier": "^3.0.0",
|
|
67
|
+
"utf-8-validate": "^6.0.0"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import createWebSocketStream from './lib/stream.js';
|
|
2
|
+
import Receiver from './lib/receiver.js';
|
|
3
|
+
import Sender from './lib/sender.js';
|
|
4
|
+
import WebSocket from './lib/websocket.js';
|
|
5
|
+
import WebSocketServer from './lib/websocket-server.js';
|
|
6
|
+
|
|
7
|
+
export { createWebSocketStream, Receiver, Sender, WebSocket, WebSocketServer };
|
|
8
|
+
export default WebSocket;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import D from"picocolors";import{stdout as R,stdin as q}from"node:process";import*as k from"node:readline";import ot from"node:readline";import{cursor as I,erase as N}from"sisteransi";import{ReadStream as J}from"node:tty";function B(t,e,s){if(!s.some(u=>!u.disabled))return t;const i=t+e,r=Math.max(s.length-1,0),n=i<0?r:i>r?0:i;return s[n].disabled?B(n,e<0?-1:1,s):n}const at=t=>t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109,lt=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,ht=t=>t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9800&&t<=9811||t===9855||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=19968&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101632&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129672||t>=129680&&t<=129725||t>=129727&&t<=129733||t>=129742&&t<=129755||t>=129760&&t<=129768||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141,O=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,y=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,L=/\t{1,1000}/y,P=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,M=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,ct=/\p{M}+/gu,ft={limit:1/0,ellipsis:""},X=(t,e={},s={})=>{const i=e.limit??1/0,r=e.ellipsis??"",n=e?.ellipsisWidth??(r?X(r,ft,s).width:0),u=s.ansiWidth??0,a=s.controlWidth??0,l=s.tabWidth??8,E=s.ambiguousWidth??1,g=s.emojiWidth??2,m=s.fullWidthWidth??2,A=s.regularWidth??1,V=s.wideWidth??2;let h=0,o=0,p=t.length,v=0,F=!1,d=p,b=Math.max(0,i-n),C=0,w=0,c=0,f=0;t:for(;;){if(w>C||o>=p&&o>h){const ut=t.slice(C,w)||t.slice(h,o);v=0;for(const Y of ut.replaceAll(ct,"")){const $=Y.codePointAt(0)||0;if(lt($)?f=m:ht($)?f=V:E!==A&&at($)?f=E:f=A,c+f>b&&(d=Math.min(d,Math.max(C,h)+v)),c+f>i){F=!0;break t}v+=Y.length,c+=f}C=w=0}if(o>=p)break;if(M.lastIndex=o,M.test(t)){if(v=M.lastIndex-o,f=v*A,c+f>b&&(d=Math.min(d,o+Math.floor((b-c)/A))),c+f>i){F=!0;break}c+=f,C=h,w=o,o=h=M.lastIndex;continue}if(O.lastIndex=o,O.test(t)){if(c+u>b&&(d=Math.min(d,o)),c+u>i){F=!0;break}c+=u,C=h,w=o,o=h=O.lastIndex;continue}if(y.lastIndex=o,y.test(t)){if(v=y.lastIndex-o,f=v*a,c+f>b&&(d=Math.min(d,o+Math.floor((b-c)/a))),c+f>i){F=!0;break}c+=f,C=h,w=o,o=h=y.lastIndex;continue}if(L.lastIndex=o,L.test(t)){if(v=L.lastIndex-o,f=v*l,c+f>b&&(d=Math.min(d,o+Math.floor((b-c)/l))),c+f>i){F=!0;break}c+=f,C=h,w=o,o=h=L.lastIndex;continue}if(P.lastIndex=o,P.test(t)){if(c+g>b&&(d=Math.min(d,o)),c+g>i){F=!0;break}c+=g,C=h,w=o,o=h=P.lastIndex;continue}o+=1}return{width:F?b:c,index:F?d:p,truncated:F,ellipsed:F&&i>=n}},pt={limit:1/0,ellipsis:"",ellipsisWidth:0},S=(t,e={})=>X(t,pt,e).width,W="\x1B",Z="\x9B",Ft=39,j="\x07",Q="[",dt="]",tt="m",U=`${dt}8;;`,et=new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`,"y"),mt=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},st=t=>`${W}${Q}${t}${tt}`,it=t=>`${W}${U}${t}${j}`,gt=t=>t.map(e=>S(e)),G=(t,e,s)=>{const i=e[Symbol.iterator]();let r=!1,n=!1,u=t.at(-1),a=u===void 0?0:S(u),l=i.next(),E=i.next(),g=0;for(;!l.done;){const m=l.value,A=S(m);a+A<=s?t[t.length-1]+=m:(t.push(m),a=0),(m===W||m===Z)&&(r=!0,n=e.startsWith(U,g+1)),r?n?m===j&&(r=!1,n=!1):m===tt&&(r=!1):(a+=A,a===s&&!E.done&&(t.push(""),a=0)),l=E,E=i.next(),g+=m.length}u=t.at(-1),!a&&u!==void 0&&u.length>0&&t.length>1&&(t[t.length-2]+=t.pop())},vt=t=>{const e=t.split(" ");let s=e.length;for(;s>0&&!(S(e[s-1])>0);)s--;return s===e.length?t:e.slice(0,s).join(" ")+e.slice(s).join("")},Et=(t,e,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let i="",r,n;const u=t.split(" "),a=gt(u);let l=[""];for(const[h,o]of u.entries()){s.trim!==!1&&(l[l.length-1]=(l.at(-1)??"").trimStart());let p=S(l.at(-1)??"");if(h!==0&&(p>=e&&(s.wordWrap===!1||s.trim===!1)&&(l.push(""),p=0),(p>0||s.trim===!1)&&(l[l.length-1]+=" ",p++)),s.hard&&a[h]>e){const v=e-p,F=1+Math.floor((a[h]-v-1)/e);Math.floor((a[h]-1)/e)<F&&l.push(""),G(l,o,e);continue}if(p+a[h]>e&&p>0&&a[h]>0){if(s.wordWrap===!1&&p<e){G(l,o,e);continue}l.push("")}if(p+a[h]>e&&s.wordWrap===!1){G(l,o,e);continue}l[l.length-1]+=o}s.trim!==!1&&(l=l.map(h=>vt(h)));const E=l.join(`
|
|
2
|
+
`),g=E[Symbol.iterator]();let m=g.next(),A=g.next(),V=0;for(;!m.done;){const h=m.value,o=A.value;if(i+=h,h===W||h===Z){et.lastIndex=V+1;const F=et.exec(E)?.groups;if(F?.code!==void 0){const d=Number.parseFloat(F.code);r=d===Ft?void 0:d}else F?.uri!==void 0&&(n=F.uri.length===0?void 0:F.uri)}const p=r?mt(r):void 0;o===`
|
|
3
|
+
`?(n&&(i+=it("")),r&&p&&(i+=st(p))):h===`
|
|
4
|
+
`&&(r&&p&&(i+=st(r)),n&&(i+=it(n))),V+=h.length,m=A,A=g.next()}return i};function K(t,e,s){return String(t).normalize().replaceAll(`\r
|
|
5
|
+
`,`
|
|
6
|
+
`).split(`
|
|
7
|
+
`).map(i=>Et(i,e,s)).join(`
|
|
8
|
+
`)}const At=["up","down","left","right","space","enter","cancel"],_={actions:new Set(At),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0};function It(t){if(t.aliases!==void 0){const e=t.aliases;for(const s in e){if(!Object.hasOwn(e,s))continue;const i=e[s];_.actions.has(i)&&(_.aliases.has(s)||_.aliases.set(s,i))}}if(t.messages!==void 0){const e=t.messages;e.cancel!==void 0&&(_.messages.cancel=e.cancel),e.error!==void 0&&(_.messages.error=e.error)}t.withGuide!==void 0&&(_.withGuide=t.withGuide!==!1)}function H(t,e){if(typeof t=="string")return _.aliases.get(t)===e;for(const s of t)if(s!==void 0&&H(s,e))return!0;return!1}function _t(t,e){if(t===e)return;const s=t.split(`
|
|
9
|
+
`),i=e.split(`
|
|
10
|
+
`),r=Math.max(s.length,i.length),n=[];for(let u=0;u<r;u++)s[u]!==i[u]&&n.push(u);return{lines:n,numLinesBefore:s.length,numLinesAfter:i.length,numLines:r}}const bt=globalThis.process.platform.startsWith("win"),z=Symbol("clack:cancel");function Ct(t){return t===z}function T(t,e){const s=t;s.isTTY&&s.setRawMode(e)}function Bt({input:t=q,output:e=R,overwrite:s=!0,hideCursor:i=!0}={}){const r=k.createInterface({input:t,output:e,prompt:"",tabSize:1});k.emitKeypressEvents(t,r),t instanceof J&&t.isTTY&&t.setRawMode(!0);const n=(u,{name:a,sequence:l})=>{const E=String(u);if(H([E,a,l],"cancel")){i&&e.write(I.show),process.exit(0);return}if(!s)return;const g=a==="return"?0:-1,m=a==="return"?-1:0;k.moveCursor(e,g,m,()=>{k.clearLine(e,1,()=>{t.once("keypress",n)})})};return i&&e.write(I.hide),t.once("keypress",n),()=>{t.off("keypress",n),i&&e.write(I.show),t instanceof J&&t.isTTY&&!bt&&t.setRawMode(!1),r.terminal=!1,r.close()}}const rt=t=>"columns"in t&&typeof t.columns=="number"?t.columns:80,nt=t=>"rows"in t&&typeof t.rows=="number"?t.rows:20;function xt(t,e,s,i=s){const r=rt(t??R);return K(e,r-s.length,{hard:!0,trim:!1}).split(`
|
|
11
|
+
`).map((n,u)=>`${u===0?i:s}${n}`).join(`
|
|
12
|
+
`)}class x{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,s=!0){const{input:i=q,output:r=R,render:n,signal:u,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=s,this._abortSignal=u,this.input=i,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,s){const i=this._subscribers.get(e)??[];i.push(s),this._subscribers.set(e,i)}on(e,s){this.setSubscriber(e,{cb:s})}once(e,s){this.setSubscriber(e,{cb:s,once:!0})}emit(e,...s){const i=this._subscribers.get(e)??[],r=[];for(const n of i)n.cb(...s),n.once&&r.push(()=>i.splice(i.indexOf(n),1));for(const n of r)n()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(z);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=ot.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),T(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(I.show),this.output.off("resize",this.render),T(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(I.show),this.output.off("resize",this.render),T(this.input,!1),e(z)})})}_isActionKey(e,s){return e===" "}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,s){this.userInput=e??"",this.emit("userInput",this.userInput),s&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,s){if(this._track&&s.name!=="return"&&(s.name&&this._isActionKey(e,s)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),s?.name&&(!this._track&&_.aliases.has(s.name)&&this.emit("cursor",_.aliases.get(s.name)),_.actions.has(s.name)&&this.emit("cursor",s.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),s),s?.name==="return"){if(this.opts.validate){const i=this.opts.validate(this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}H([e,s?.name,s?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
13
|
+
`),T(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const e=K(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
14
|
+
`).length-1;this.output.write(I.move(-999,e*-1))}render(){const e=K(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(I.hide);else{const s=_t(this._prevFrame,e),i=nt(this.output);if(this.restoreCursor(),s){const r=Math.max(0,s.numLinesAfter-i),n=Math.max(0,s.numLinesBefore-i);let u=s.lines.find(a=>a>=r);if(u===void 0){this._prevFrame=e;return}if(s.lines.length===1){this.output.write(I.move(0,u-n)),this.output.write(N.lines(1));const a=e.split(`
|
|
15
|
+
`);this.output.write(a[u]),this._prevFrame=e,this.output.write(I.move(0,a.length-u-1));return}else if(s.lines.length>1){if(r<n)u=r;else{const l=u-n;l>0&&this.output.write(I.move(0,l))}this.output.write(N.down());const a=e.split(`
|
|
16
|
+
`).slice(u);this.output.write(a.join(`
|
|
17
|
+
`)),this._prevFrame=e;return}}this.output.write(N.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}}function wt(t,e){if(t===void 0||e.length===0)return 0;const s=e.findIndex(i=>i.value===t);return s!==-1?s:0}function Dt(t,e){return(e.label??String(e.value)).toLowerCase().includes(t.toLowerCase())}function St(t,e){if(e)return t?e:e[0]}class Vt extends x{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#t=0;#s="";#i;#e;get cursor(){return this.#t}get userInputWithCursor(){if(!this.userInput)return D.inverse(D.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;const e=this.userInput.slice(0,this._cursor),[s,...i]=this.userInput.slice(this._cursor);return`${e}${D.inverse(s)}${i.join("")}`}get options(){return typeof this.#e=="function"?this.#e():this.#e}constructor(e){super(e),this.#e=e.options;const s=this.options;this.filteredOptions=[...s],this.multiple=e.multiple===!0,this.#i=e.filter??Dt;let i;if(e.initialValue&&Array.isArray(e.initialValue)?this.multiple?i=e.initialValue:i=e.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(i=[this.options[0].value]),i)for(const r of i){const n=s.findIndex(u=>u.value===r);n!==-1&&(this.toggleSelected(r),this.#t=n)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(r,n)=>this.#r(r,n)),this.on("userInput",r=>this.#n(r))}_isActionKey(e,s){return e===" "||this.multiple&&this.isNavigating&&s.name==="space"&&e!==void 0&&e!==""}#r(e,s){const i=s.name==="up",r=s.name==="down",n=s.name==="return";i||r?(this.#t=B(this.#t,i?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):n?this.value=St(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(s.name==="tab"||this.isNavigating&&s.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(e){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(e)?this.selectedValues=this.selectedValues.filter(s=>s!==e):this.selectedValues=[...this.selectedValues,e]:this.selectedValues=[e])}#n(e){if(e!==this.#s){this.#s=e;const s=this.options;e?this.filteredOptions=s.filter(n=>this.#i(e,n)):this.filteredOptions=[...s];const i=wt(this.focusedValue,this.filteredOptions);this.#t=B(i,0,this.filteredOptions);const r=this.filteredOptions[this.#t];r&&!r.disabled?this.focusedValue=r.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}}class kt extends x{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(I.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class yt extends x{options;cursor=0;#t;getGroupItems(e){return this.options.filter(s=>s.group===e)}isGroupSelected(e){const s=this.getGroupItems(e),i=this.value;return i===void 0?!1:s.every(r=>i.includes(r.value))}toggleValue(){const e=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),e.group===!0){const s=e.value,i=this.getGroupItems(s);this.isGroupSelected(s)?this.value=this.value.filter(r=>i.findIndex(n=>n.value===r)===-1):this.value=[...this.value,...i.map(r=>r.value)],this.value=Array.from(new Set(this.value))}else{const s=this.value.includes(e.value);this.value=s?this.value.filter(i=>i!==e.value):[...this.value,e.value]}}constructor(e){super(e,!1);const{options:s}=e;this.#t=e.selectableGroups!==!1,this.options=Object.entries(s).flatMap(([i,r])=>[{value:i,group:!0,label:i},...r.map(n=>({...n,group:i}))]),this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:i})=>i===e.cursorAt),this.#t?0:1),this.on("cursor",i=>{switch(i){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;const r=this.options[this.cursor]?.group===!0;!this.#t&&r&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;const r=this.options[this.cursor]?.group===!0;!this.#t&&r&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}}class Lt extends x{options;cursor=0;get _value(){return this.options[this.cursor].value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){const e=this._enabledOptions,s=this.value!==void 0&&this.value.length===e.length;this.value=s?[]:e.map(i=>i.value)}toggleInvert(){const e=this.value;if(!e)return;const s=this._enabledOptions.filter(i=>!e.includes(i.value));this.value=s.map(i=>i.value)}toggleValue(){this.value===void 0&&(this.value=[]);const e=this.value.includes(this._value);this.value=e?this.value.filter(s=>s!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];const s=Math.max(this.options.findIndex(({value:i})=>i===e.cursorAt),0);this.cursor=this.options[s].disabled?B(s,1,this.options):s,this.on("key",i=>{i==="a"&&this.toggleAll(),i==="i"&&this.toggleInvert()}),this.on("cursor",i=>{switch(i){case"left":case"up":this.cursor=B(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=B(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}}let Mt=class extends x{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;const e=this.userInput;if(this.cursor>=e.length)return`${this.masked}${D.inverse(D.hidden("_"))}`;const s=this.masked,i=s.slice(0,this.cursor),r=s.slice(this.cursor);return`${i}${D.inverse(r[0])}${r.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:e,...s}){super(s),this._mask=e??"\u2022",this.on("userInput",i=>{this._setValue(i)})}};class Wt extends x{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;const s=this.options.findIndex(({value:r})=>r===e.initialValue),i=s===-1?0:s;this.cursor=this.options[i].disabled?B(i,1,this.options):i,this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=B(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=B(this.cursor,1,this.options);break}this.changeValue()})}}class Tt extends x{options;cursor=0;constructor(e){super(e,!1),this.options=e.options;const s=e.caseSensitive===!0,i=this.options.map(({value:[r]})=>s?r:r?.toLowerCase());this.cursor=Math.max(i.indexOf(e.initialValue),0),this.on("key",(r,n)=>{if(!r)return;const u=s&&n.shift?r.toUpperCase():r;if(!i.includes(u))return;const a=this.options.find(({value:[l]})=>s?l===u:l?.toLowerCase()===r);a&&(this.value=a.value,this.state="submit",this.emit("submit"))})}}class $t extends x{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;const s=e.slice(0,this.cursor),[i,...r]=e.slice(this.cursor);return`${s}${D.inverse(i)}${r.join("")}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.value===void 0&&(this.value="")})}}export{Vt as AutocompletePrompt,kt as ConfirmPrompt,yt as GroupMultiSelectPrompt,Lt as MultiSelectPrompt,Mt as PasswordPrompt,x as Prompt,Tt as SelectKeyPrompt,Wt as SelectPrompt,$t as TextPrompt,Bt as block,rt as getColumns,nt as getRows,Ct as isCancel,_ as settings,It as updateSettings,xt as wrapTextWithPrefix};
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clack/core",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.mjs",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"default": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"types": "./dist/index.d.mts",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/bombshell-dev/clack.git",
|
|
18
|
+
"directory": "packages/core"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/bombshell-dev/clack/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/bombshell-dev/clack/tree/main/packages/core#readme",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"CHANGELOG.md"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"ask",
|
|
30
|
+
"clack",
|
|
31
|
+
"cli",
|
|
32
|
+
"command-line",
|
|
33
|
+
"command",
|
|
34
|
+
"input",
|
|
35
|
+
"interact",
|
|
36
|
+
"interface",
|
|
37
|
+
"menu",
|
|
38
|
+
"prompt",
|
|
39
|
+
"prompts",
|
|
40
|
+
"stdin",
|
|
41
|
+
"ui"
|
|
42
|
+
],
|
|
43
|
+
"author": {
|
|
44
|
+
"name": "Nate Moore",
|
|
45
|
+
"email": "nate@natemoo.re",
|
|
46
|
+
"url": "https://twitter.com/n_moore"
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"picocolors": "^1.0.0",
|
|
51
|
+
"sisteransi": "^1.0.5"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"vitest": "^3.2.4",
|
|
55
|
+
"fast-wrap-ansi": "^0.1.3"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "unbuild",
|
|
59
|
+
"test": "vitest run"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import{getColumns as z,getRows as ee,AutocompletePrompt as Bt,settings as P,ConfirmPrompt as se,isCancel as re,GroupMultiSelectPrompt as ie,MultiSelectPrompt as ne,wrapTextWithPrefix as k,PasswordPrompt as ae,block as oe,SelectPrompt as le,SelectKeyPrompt as ue,TextPrompt as ce}from"@clack/core";export{isCancel,settings,updateSettings}from"@clack/core";import e from"picocolors";import N from"node:process";import{readdirSync as de,existsSync as $e,lstatSync as xt}from"node:fs";import{dirname as _t,join as he}from"node:path";import{cursor as Dt,erase as Tt}from"sisteransi";import{stripVTControlCharacters as ut}from"node:util";function me(){return N.platform!=="win32"?N.env.TERM!=="linux":!!N.env.CI||!!N.env.WT_SESSION||!!N.env.TERMINUS_SUBLIME||N.env.ConEmuTask==="{cmd::Cmder}"||N.env.TERM_PROGRAM==="Terminus-Sublime"||N.env.TERM_PROGRAM==="vscode"||N.env.TERM==="xterm-256color"||N.env.TERM==="alacritty"||N.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const et=me(),ct=()=>process.env.CI==="true",Mt=t=>t.isTTY===!0,C=(t,r)=>et?t:r,Rt=C("\u25C6","*"),dt=C("\u25A0","x"),$t=C("\u25B2","x"),V=C("\u25C7","o"),ht=C("\u250C","T"),d=C("\u2502","|"),x=C("\u2514","\u2014"),Ot=C("\u2510","T"),Pt=C("\u2518","\u2014"),Q=C("\u25CF",">"),H=C("\u25CB"," "),st=C("\u25FB","[\u2022]"),U=C("\u25FC","[+]"),q=C("\u25FB","[ ]"),Nt=C("\u25AA","\u2022"),rt=C("\u2500","-"),mt=C("\u256E","+"),Wt=C("\u251C","+"),pt=C("\u256F","+"),gt=C("\u2570","+"),Lt=C("\u256D","+"),ft=C("\u25CF","\u2022"),Ft=C("\u25C6","*"),yt=C("\u25B2","!"),Et=C("\u25A0","x"),W=t=>{switch(t){case"initial":case"active":return e.cyan(Rt);case"cancel":return e.red(dt);case"error":return e.yellow($t);case"submit":return e.green(V)}},vt=t=>{switch(t){case"initial":case"active":return e.cyan(d);case"cancel":return e.red(d);case"error":return e.yellow(d);case"submit":return e.green(d)}},pe=t=>t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109,ge=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,fe=t=>t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9800&&t<=9811||t===9855||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=19968&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101632&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129672||t>=129680&&t<=129725||t>=129727&&t<=129733||t>=129742&&t<=129755||t>=129760&&t<=129768||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141,At=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,it=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,nt=/\t{1,1000}/y,wt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,at=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,ye={limit:1/0,ellipsis:""},jt=(t,r={},s={})=>{const i=r.limit??1/0,a=r.ellipsis??"",o=r?.ellipsisWidth??(a?jt(a,ye,s).width:0),u=s.ansiWidth??0,l=s.controlWidth??0,n=s.tabWidth??8,c=s.ambiguousWidth??1,g=s.emojiWidth??2,F=s.fullWidthWidth??2,p=s.regularWidth??1,E=s.wideWidth??2;let $=0,m=0,h=t.length,y=0,f=!1,v=h,S=Math.max(0,i-o),I=0,B=0,A=0,w=0;t:for(;;){if(B>I||m>=h&&m>$){const _=t.slice(I,B)||t.slice($,m);y=0;for(const D of _.replaceAll(Fe,"")){const T=D.codePointAt(0)||0;if(ge(T)?w=F:fe(T)?w=E:c!==p&&pe(T)?w=c:w=p,A+w>S&&(v=Math.min(v,Math.max(I,$)+y)),A+w>i){f=!0;break t}y+=D.length,A+=w}I=B=0}if(m>=h)break;if(at.lastIndex=m,at.test(t)){if(y=at.lastIndex-m,w=y*p,A+w>S&&(v=Math.min(v,m+Math.floor((S-A)/p))),A+w>i){f=!0;break}A+=w,I=$,B=m,m=$=at.lastIndex;continue}if(At.lastIndex=m,At.test(t)){if(A+u>S&&(v=Math.min(v,m)),A+u>i){f=!0;break}A+=u,I=$,B=m,m=$=At.lastIndex;continue}if(it.lastIndex=m,it.test(t)){if(y=it.lastIndex-m,w=y*l,A+w>S&&(v=Math.min(v,m+Math.floor((S-A)/l))),A+w>i){f=!0;break}A+=w,I=$,B=m,m=$=it.lastIndex;continue}if(nt.lastIndex=m,nt.test(t)){if(y=nt.lastIndex-m,w=y*n,A+w>S&&(v=Math.min(v,m+Math.floor((S-A)/n))),A+w>i){f=!0;break}A+=w,I=$,B=m,m=$=nt.lastIndex;continue}if(wt.lastIndex=m,wt.test(t)){if(A+g>S&&(v=Math.min(v,m)),A+g>i){f=!0;break}A+=g,I=$,B=m,m=$=wt.lastIndex;continue}m+=1}return{width:f?S:A,index:f?v:h,truncated:f,ellipsed:f&&i>=o}},Ee={limit:1/0,ellipsis:"",ellipsisWidth:0},M=(t,r={})=>jt(t,Ee,r).width,ot="\x1B",Gt="\x9B",ve=39,Ct="\x07",kt="[",Ae="]",Vt="m",St=`${Ae}8;;`,Ht=new RegExp(`(?:\\${kt}(?<code>\\d+)m|\\${St}(?<uri>.*)${Ct})`,"y"),we=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},Ut=t=>`${ot}${kt}${t}${Vt}`,Kt=t=>`${ot}${St}${t}${Ct}`,Ce=t=>t.map(r=>M(r)),It=(t,r,s)=>{const i=r[Symbol.iterator]();let a=!1,o=!1,u=t.at(-1),l=u===void 0?0:M(u),n=i.next(),c=i.next(),g=0;for(;!n.done;){const F=n.value,p=M(F);l+p<=s?t[t.length-1]+=F:(t.push(F),l=0),(F===ot||F===Gt)&&(a=!0,o=r.startsWith(St,g+1)),a?o?F===Ct&&(a=!1,o=!1):F===Vt&&(a=!1):(l+=p,l===s&&!c.done&&(t.push(""),l=0)),n=c,c=i.next(),g+=F.length}u=t.at(-1),!l&&u!==void 0&&u.length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Se=t=>{const r=t.split(" ");let s=r.length;for(;s>0&&!(M(r[s-1])>0);)s--;return s===r.length?t:r.slice(0,s).join(" ")+r.slice(s).join("")},Ie=(t,r,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let i="",a,o;const u=t.split(" "),l=Ce(u);let n=[""];for(const[$,m]of u.entries()){s.trim!==!1&&(n[n.length-1]=(n.at(-1)??"").trimStart());let h=M(n.at(-1)??"");if($!==0&&(h>=r&&(s.wordWrap===!1||s.trim===!1)&&(n.push(""),h=0),(h>0||s.trim===!1)&&(n[n.length-1]+=" ",h++)),s.hard&&l[$]>r){const y=r-h,f=1+Math.floor((l[$]-y-1)/r);Math.floor((l[$]-1)/r)<f&&n.push(""),It(n,m,r);continue}if(h+l[$]>r&&h>0&&l[$]>0){if(s.wordWrap===!1&&h<r){It(n,m,r);continue}n.push("")}if(h+l[$]>r&&s.wordWrap===!1){It(n,m,r);continue}n[n.length-1]+=m}s.trim!==!1&&(n=n.map($=>Se($)));const c=n.join(`
|
|
2
|
+
`),g=c[Symbol.iterator]();let F=g.next(),p=g.next(),E=0;for(;!F.done;){const $=F.value,m=p.value;if(i+=$,$===ot||$===Gt){Ht.lastIndex=E+1;const f=Ht.exec(c)?.groups;if(f?.code!==void 0){const v=Number.parseFloat(f.code);a=v===ve?void 0:v}else f?.uri!==void 0&&(o=f.uri.length===0?void 0:f.uri)}const h=a?we(a):void 0;m===`
|
|
3
|
+
`?(o&&(i+=Kt("")),a&&h&&(i+=Ut(h))):$===`
|
|
4
|
+
`&&(a&&h&&(i+=Ut(a)),o&&(i+=Kt(o))),E+=$.length,F=p,p=g.next()}return i};function J(t,r,s){return String(t).normalize().replaceAll(`\r
|
|
5
|
+
`,`
|
|
6
|
+
`).split(`
|
|
7
|
+
`).map(i=>Ie(i,r,s)).join(`
|
|
8
|
+
`)}const be=(t,r,s,i,a)=>{let o=r,u=0;for(let l=s;l<i;l++){const n=t[l];if(o=o-n.length,u++,o<=a)break}return{lineCount:o,removals:u}},X=t=>{const{cursor:r,options:s,style:i}=t,a=t.output??process.stdout,o=z(a),u=t.columnPadding??0,l=t.rowPadding??4,n=o-u,c=ee(a),g=e.dim("..."),F=t.maxItems??Number.POSITIVE_INFINITY,p=Math.max(c-l,0),E=Math.max(Math.min(F,p),5);let $=0;r>=E-3&&($=Math.max(Math.min(r-E+3,s.length-E),0));let m=E<s.length&&$>0,h=E<s.length&&$+E<s.length;const y=Math.min($+E,s.length),f=[];let v=0;m&&v++,h&&v++;const S=$+(m?1:0),I=y-(h?1:0);for(let A=S;A<I;A++){const w=J(i(s[A],A===r),n,{hard:!0,trim:!1}).split(`
|
|
9
|
+
`);f.push(w),v+=w.length}if(v>p){let A=0,w=0,_=v;const D=r-S,T=(Y,L)=>be(f,_,Y,L,p);m?({lineCount:_,removals:A}=T(0,D),_>p&&({lineCount:_,removals:w}=T(D+1,f.length))):({lineCount:_,removals:w}=T(D+1,f.length),_>p&&({lineCount:_,removals:A}=T(0,D))),A>0&&(m=!0,f.splice(0,A)),w>0&&(h=!0,f.splice(f.length-w,w))}const B=[];m&&B.push(g);for(const A of f)for(const w of A)B.push(w);return h&&B.push(g),B};function qt(t){return t.label??String(t.value??"")}function Jt(t,r){if(!t)return!0;const s=(r.label??String(r.value??"")).toLowerCase(),i=(r.hint??"").toLowerCase(),a=String(r.value).toLowerCase(),o=t.toLowerCase();return s.includes(o)||i.includes(o)||a.includes(o)}function Be(t,r){const s=[];for(const i of r)t.includes(i.value)&&s.push(i);return s}const Xt=t=>new Bt({options:t.options,initialValue:t.initialValue?[t.initialValue]:void 0,initialUserInput:t.initialUserInput,filter:t.filter??((r,s)=>Jt(r,s)),signal:t.signal,input:t.input,output:t.output,validate:t.validate,render(){const r=t.withGuide??P.withGuide,s=r?[`${e.gray(d)}`,`${W(this.state)} ${t.message}`]:[`${W(this.state)} ${t.message}`],i=this.userInput,a=this.options,o=t.placeholder,u=i===""&&o!==void 0,l=(n,c)=>{const g=qt(n),F=n.hint&&n.value===this.focusedValue?e.dim(` (${n.hint})`):"";switch(c){case"active":return`${e.green(Q)} ${g}${F}`;case"inactive":return`${e.dim(H)} ${e.dim(g)}`;case"disabled":return`${e.gray(H)} ${e.strikethrough(e.gray(g))}`}};switch(this.state){case"submit":{const n=Be(this.selectedValues,a),c=n.length>0?` ${e.dim(n.map(qt).join(", "))}`:"",g=r?e.gray(d):"";return`${s.join(`
|
|
10
|
+
`)}
|
|
11
|
+
${g}${c}`}case"cancel":{const n=i?` ${e.strikethrough(e.dim(i))}`:"",c=r?e.gray(d):"";return`${s.join(`
|
|
12
|
+
`)}
|
|
13
|
+
${c}${n}`}default:{const n=this.state==="error"?e.yellow:e.cyan,c=r?`${n(d)} `:"",g=r?n(x):"";let F="";if(this.isNavigating||u){const f=u?o:i;F=f!==""?` ${e.dim(f)}`:""}else F=` ${this.userInputWithCursor}`;const p=this.filteredOptions.length!==a.length?e.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",E=this.filteredOptions.length===0&&i?[`${c}${e.yellow("No matches found")}`]:[],$=this.state==="error"?[`${c}${e.yellow(this.error)}`]:[];r&&s.push(`${c.trimEnd()}`),s.push(`${c}${e.dim("Search:")}${F}${p}`,...E,...$);const m=[`${e.dim("\u2191/\u2193")} to select`,`${e.dim("Enter:")} confirm`,`${e.dim("Type:")} to search`],h=[`${c}${m.join(" \u2022 ")}`,g],y=this.filteredOptions.length===0?[]:X({cursor:this.cursor,options:this.filteredOptions,columnPadding:r?3:0,rowPadding:s.length+h.length,style:(f,v)=>l(f,f.disabled?"disabled":v?"active":"inactive"),maxItems:t.maxItems,output:t.output});return[...s,...y.map(f=>`${c}${f}`),...h].join(`
|
|
14
|
+
`)}}}}).prompt(),xe=t=>{const r=(i,a,o,u)=>{const l=o.includes(i.value),n=i.label??String(i.value??""),c=i.hint&&u!==void 0&&i.value===u?e.dim(` (${i.hint})`):"",g=l?e.green(U):e.dim(q);return i.disabled?`${e.gray(q)} ${e.strikethrough(e.gray(n))}`:a?`${g} ${n}${c}`:`${g} ${e.dim(n)}`},s=new Bt({options:t.options,multiple:!0,filter:t.filter??((i,a)=>Jt(i,a)),validate:()=>{if(t.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:t.initialValues,signal:t.signal,input:t.input,output:t.output,render(){const i=`${e.gray(d)}
|
|
15
|
+
${W(this.state)} ${t.message}
|
|
16
|
+
`,a=this.userInput,o=t.placeholder,u=a===""&&o!==void 0,l=this.isNavigating||u?e.dim(u?o:a):this.userInputWithCursor,n=this.options,c=this.filteredOptions.length!==n.length?e.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${i}${e.gray(d)} ${e.dim(`${this.selectedValues.length} items selected`)}`;case"cancel":return`${i}${e.gray(d)} ${e.strikethrough(e.dim(a))}`;default:{const g=this.state==="error"?e.yellow:e.cyan,F=[`${e.dim("\u2191/\u2193")} to navigate`,`${e.dim(this.isNavigating?"Space/Tab:":"Tab:")} select`,`${e.dim("Enter:")} confirm`,`${e.dim("Type:")} to search`],p=this.filteredOptions.length===0&&a?[`${g(d)} ${e.yellow("No matches found")}`]:[],E=this.state==="error"?[`${g(d)} ${e.yellow(this.error)}`]:[],$=[...`${i}${g(d)}`.split(`
|
|
17
|
+
`),`${g(d)} ${e.dim("Search:")} ${l}${c}`,...p,...E],m=[`${g(d)} ${F.join(" \u2022 ")}`,`${g(x)}`],h=X({cursor:this.cursor,options:this.filteredOptions,style:(y,f)=>r(y,f,this.selectedValues,this.focusedValue),maxItems:t.maxItems,output:t.output,rowPadding:$.length+m.length});return[...$,...h.map(y=>`${g(d)} ${y}`),...m].join(`
|
|
18
|
+
`)}}}});return s.prompt()},_e=[Lt,mt,gt,pt],De=[ht,Ot,x,Pt];function Yt(t,r,s,i){let a=s,o=s;return i==="center"?a=Math.floor((r-t)/2):i==="right"&&(a=r-t-s),o=r-a-t,[a,o]}const Te=t=>t,Me=(t="",r="",s)=>{const i=s?.output??process.stdout,a=z(i),o=2,u=s?.titlePadding??1,l=s?.contentPadding??2,n=s?.width===void 0||s.width==="auto"?1:Math.min(1,s.width),c=s?.withGuide??P.withGuide?`${d} `:"",g=s?.formatBorder??Te,F=(s?.rounded?_e:De).map(g),p=g(rt),E=g(d),$=M(c),m=M(r),h=a-$;let y=Math.floor(a*n)-$;if(s?.width==="auto"){const _=t.split(`
|
|
19
|
+
`);let D=m+u*2;for(const Y of _){const L=M(Y)+l*2;L>D&&(D=L)}const T=D+o;T<y&&(y=T)}y%2!==0&&(y<h?y++:y--);const f=y-o,v=f-u*2,S=m>v?`${r.slice(0,v-3)}...`:r,[I,B]=Yt(M(S),f,u,s?.titleAlign),A=J(t,f-l*2,{hard:!0,trim:!1});i.write(`${c}${F[0]}${p.repeat(I)}${S}${p.repeat(B)}${F[1]}
|
|
20
|
+
`);const w=A.split(`
|
|
21
|
+
`);for(const _ of w){const[D,T]=Yt(M(_),f,l,s?.contentAlign);i.write(`${c}${E}${" ".repeat(D)}${_}${" ".repeat(T)}${E}
|
|
22
|
+
`)}i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
|
|
23
|
+
`)},Re=t=>{const r=t.active??"Yes",s=t.inactive??"No";return new se({active:r,inactive:s,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue??!0,render(){const i=t.withGuide??P.withGuide,a=`${i?`${e.gray(d)}
|
|
24
|
+
`:""}${W(this.state)} ${t.message}
|
|
25
|
+
`,o=this.value?r:s;switch(this.state){case"submit":{const u=i?`${e.gray(d)} `:"";return`${a}${u}${e.dim(o)}`}case"cancel":{const u=i?`${e.gray(d)} `:"";return`${a}${u}${e.strikethrough(e.dim(o))}${i?`
|
|
26
|
+
${e.gray(d)}`:""}`}default:{const u=i?`${e.cyan(d)} `:"",l=i?e.cyan(x):"";return`${a}${u}${this.value?`${e.green(Q)} ${r}`:`${e.dim(H)} ${e.dim(r)}`}${t.vertical?i?`
|
|
27
|
+
${e.cyan(d)} `:`
|
|
28
|
+
`:` ${e.dim("/")} `}${this.value?`${e.dim(H)} ${e.dim(s)}`:`${e.green(Q)} ${s}`}
|
|
29
|
+
${l}
|
|
30
|
+
`}}}}).prompt()},Oe=async(t,r)=>{const s={},i=Object.keys(t);for(const a of i){const o=t[a],u=await o({results:s})?.catch(l=>{throw l});if(typeof r?.onCancel=="function"&&re(u)){s[a]="canceled",r.onCancel({results:s});continue}s[a]=u}return s},Pe=t=>{const{selectableGroups:r=!0,groupSpacing:s=0}=t,i=(o,u,l=[])=>{const n=o.label??String(o.value),c=typeof o.group=="string",g=c&&(l[l.indexOf(o)+1]??{group:!0}),F=c&&g&&g.group===!0,p=c?r?`${F?x:d} `:" ":"";let E="";if(s>0&&!c){const m=`
|
|
31
|
+
${e.cyan(d)}`;E=`${m.repeat(s-1)}${m} `}if(u==="active")return`${E}${e.dim(p)}${e.cyan(st)} ${n}${o.hint?` ${e.dim(`(${o.hint})`)}`:""}`;if(u==="group-active")return`${E}${p}${e.cyan(st)} ${e.dim(n)}`;if(u==="group-active-selected")return`${E}${p}${e.green(U)} ${e.dim(n)}`;if(u==="selected"){const m=c||r?e.green(U):"";return`${E}${e.dim(p)}${m} ${e.dim(n)}${o.hint?` ${e.dim(`(${o.hint})`)}`:""}`}if(u==="cancelled")return`${e.strikethrough(e.dim(n))}`;if(u==="active-selected")return`${E}${e.dim(p)}${e.green(U)} ${n}${o.hint?` ${e.dim(`(${o.hint})`)}`:""}`;if(u==="submitted")return`${e.dim(n)}`;const $=c||r?e.dim(q):"";return`${E}${e.dim(p)}${$} ${e.dim(n)}`},a=t.required??!0;return new ie({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValues:t.initialValues,required:a,cursorAt:t.cursorAt,selectableGroups:r,validate(o){if(a&&(o===void 0||o.length===0))return`Please select at least one option.
|
|
32
|
+
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`},render(){const o=`${e.gray(d)}
|
|
33
|
+
${W(this.state)} ${t.message}
|
|
34
|
+
`,u=this.value??[];switch(this.state){case"submit":{const l=this.options.filter(({value:c})=>u.includes(c)).map(c=>i(c,"submitted")),n=l.length===0?"":` ${l.join(e.dim(", "))}`;return`${o}${e.gray(d)}${n}`}case"cancel":{const l=this.options.filter(({value:n})=>u.includes(n)).map(n=>i(n,"cancelled")).join(e.dim(", "));return`${o}${e.gray(d)} ${l.trim()?`${l}
|
|
35
|
+
${e.gray(d)}`:""}`}case"error":{const l=this.error.split(`
|
|
36
|
+
`).map((n,c)=>c===0?`${e.yellow(x)} ${e.yellow(n)}`:` ${n}`).join(`
|
|
37
|
+
`);return`${o}${e.yellow(d)} ${this.options.map((n,c,g)=>{const F=u.includes(n.value)||n.group===!0&&this.isGroupSelected(`${n.value}`),p=c===this.cursor;return!p&&typeof n.group=="string"&&this.options[this.cursor].value===n.group?i(n,F?"group-active-selected":"group-active",g):p&&F?i(n,"active-selected",g):F?i(n,"selected",g):i(n,p?"active":"inactive",g)}).join(`
|
|
38
|
+
${e.yellow(d)} `)}
|
|
39
|
+
${l}
|
|
40
|
+
`}default:{const l=this.options.map((c,g,F)=>{const p=u.includes(c.value)||c.group===!0&&this.isGroupSelected(`${c.value}`),E=g===this.cursor,$=!E&&typeof c.group=="string"&&this.options[this.cursor].value===c.group;let m="";return $?m=i(c,p?"group-active-selected":"group-active",F):E&&p?m=i(c,"active-selected",F):p?m=i(c,"selected",F):m=i(c,E?"active":"inactive",F),`${g!==0&&!m.startsWith(`
|
|
41
|
+
`)?" ":""}${m}`}).join(`
|
|
42
|
+
${e.cyan(d)}`),n=l.startsWith(`
|
|
43
|
+
`)?"":" ";return`${o}${e.cyan(d)}${n}${l}
|
|
44
|
+
${e.cyan(x)}
|
|
45
|
+
`}}}}).prompt()},R={message:(t=[],{symbol:r=e.gray(d),secondarySymbol:s=e.gray(d),output:i=process.stdout,spacing:a=1,withGuide:o}={})=>{const u=[],l=o??P.withGuide,n=l?s:"",c=l?`${r} `:"",g=l?`${s} `:"";for(let p=0;p<a;p++)u.push(n);const F=Array.isArray(t)?t:t.split(`
|
|
46
|
+
`);if(F.length>0){const[p,...E]=F;p.length>0?u.push(`${c}${p}`):u.push(l?r:"");for(const $ of E)$.length>0?u.push(`${g}${$}`):u.push(l?s:"")}i.write(`${u.join(`
|
|
47
|
+
`)}
|
|
48
|
+
`)},info:(t,r)=>{R.message(t,{...r,symbol:e.blue(ft)})},success:(t,r)=>{R.message(t,{...r,symbol:e.green(Ft)})},step:(t,r)=>{R.message(t,{...r,symbol:e.green(V)})},warn:(t,r)=>{R.message(t,{...r,symbol:e.yellow(yt)})},warning:(t,r)=>{R.warn(t,r)},error:(t,r)=>{R.message(t,{...r,symbol:e.red(Et)})}},Ne=(t="",r)=>{(r?.output??process.stdout).write(`${e.gray(x)} ${e.red(t)}
|
|
49
|
+
|
|
50
|
+
`)},We=(t="",r)=>{(r?.output??process.stdout).write(`${e.gray(ht)} ${t}
|
|
51
|
+
`)},Le=(t="",r)=>{(r?.output??process.stdout).write(`${e.gray(d)}
|
|
52
|
+
${e.gray(x)} ${t}
|
|
53
|
+
|
|
54
|
+
`)},Z=(t,r)=>t.split(`
|
|
55
|
+
`).map(s=>r(s)).join(`
|
|
56
|
+
`),je=t=>{const r=(i,a)=>{const o=i.label??String(i.value);return a==="disabled"?`${e.gray(q)} ${Z(o,u=>e.strikethrough(e.gray(u)))}${i.hint?` ${e.dim(`(${i.hint??"disabled"})`)}`:""}`:a==="active"?`${e.cyan(st)} ${o}${i.hint?` ${e.dim(`(${i.hint})`)}`:""}`:a==="selected"?`${e.green(U)} ${Z(o,e.dim)}${i.hint?` ${e.dim(`(${i.hint})`)}`:""}`:a==="cancelled"?`${Z(o,u=>e.strikethrough(e.dim(u)))}`:a==="active-selected"?`${e.green(U)} ${o}${i.hint?` ${e.dim(`(${i.hint})`)}`:""}`:a==="submitted"?`${Z(o,e.dim)}`:`${e.dim(q)} ${Z(o,e.dim)}`},s=t.required??!0;return new ne({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValues:t.initialValues,required:s,cursorAt:t.cursorAt,validate(i){if(s&&(i===void 0||i.length===0))return`Please select at least one option.
|
|
57
|
+
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`},render(){const i=k(t.output,t.message,`${vt(this.state)} `,`${W(this.state)} `),a=`${e.gray(d)}
|
|
58
|
+
${i}
|
|
59
|
+
`,o=this.value??[],u=(l,n)=>{if(l.disabled)return r(l,"disabled");const c=o.includes(l.value);return n&&c?r(l,"active-selected"):c?r(l,"selected"):r(l,n?"active":"inactive")};switch(this.state){case"submit":{const l=this.options.filter(({value:c})=>o.includes(c)).map(c=>r(c,"submitted")).join(e.dim(", "))||e.dim("none"),n=k(t.output,l,`${e.gray(d)} `);return`${a}${n}`}case"cancel":{const l=this.options.filter(({value:c})=>o.includes(c)).map(c=>r(c,"cancelled")).join(e.dim(", "));if(l.trim()==="")return`${a}${e.gray(d)}`;const n=k(t.output,l,`${e.gray(d)} `);return`${a}${n}
|
|
60
|
+
${e.gray(d)}`}case"error":{const l=`${e.yellow(d)} `,n=this.error.split(`
|
|
61
|
+
`).map((F,p)=>p===0?`${e.yellow(x)} ${e.yellow(F)}`:` ${F}`).join(`
|
|
62
|
+
`),c=a.split(`
|
|
63
|
+
`).length,g=n.split(`
|
|
64
|
+
`).length+1;return`${a}${l}${X({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:l.length,rowPadding:c+g,style:u}).join(`
|
|
65
|
+
${l}`)}
|
|
66
|
+
${n}
|
|
67
|
+
`}default:{const l=`${e.cyan(d)} `,n=a.split(`
|
|
68
|
+
`).length;return`${a}${l}${X({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:l.length,rowPadding:n+2,style:u}).join(`
|
|
69
|
+
${l}`)}
|
|
70
|
+
${e.cyan(x)}
|
|
71
|
+
`}}}}).prompt()},Ge=t=>e.dim(t),ke=(t,r,s)=>{const i={hard:!0,trim:!1},a=J(t,r,i).split(`
|
|
72
|
+
`),o=a.reduce((n,c)=>Math.max(M(c),n),0),u=a.map(s).reduce((n,c)=>Math.max(M(c),n),0),l=r-(u-o);return J(t,l,i)},Ve=(t="",r="",s)=>{const i=s?.output??N.stdout,a=s?.withGuide??P.withGuide,o=s?.format??Ge,u=["",...ke(t,z(i)-6,o).split(`
|
|
73
|
+
`).map(o),""],l=M(r),n=Math.max(u.reduce((p,E)=>{const $=M(E);return $>p?$:p},0),l)+2,c=u.map(p=>`${e.gray(d)} ${p}${" ".repeat(n-M(p))}${e.gray(d)}`).join(`
|
|
74
|
+
`),g=a?`${e.gray(d)}
|
|
75
|
+
`:"",F=a?Wt:gt;i.write(`${g}${e.green(V)} ${e.reset(r)} ${e.gray(rt.repeat(Math.max(n-l-1,1))+mt)}
|
|
76
|
+
${c}
|
|
77
|
+
${e.gray(F+rt.repeat(n+2)+pt)}
|
|
78
|
+
`)},He=t=>new ae({validate:t.validate,mask:t.mask??Nt,signal:t.signal,input:t.input,output:t.output,render(){const r=t.withGuide??P.withGuide,s=`${r?`${e.gray(d)}
|
|
79
|
+
`:""}${W(this.state)} ${t.message}
|
|
80
|
+
`,i=this.userInputWithCursor,a=this.masked;switch(this.state){case"error":{const o=r?`${e.yellow(d)} `:"",u=r?`${e.yellow(x)} `:"",l=a??"";return t.clearOnError&&this.clear(),`${s.trim()}
|
|
81
|
+
${o}${l}
|
|
82
|
+
${u}${e.yellow(this.error)}
|
|
83
|
+
`}case"submit":{const o=r?`${e.gray(d)} `:"",u=a?e.dim(a):"";return`${s}${o}${u}`}case"cancel":{const o=r?`${e.gray(d)} `:"",u=a?e.strikethrough(e.dim(a)):"";return`${s}${o}${u}${a&&r?`
|
|
84
|
+
${e.gray(d)}`:""}`}default:{const o=r?`${e.cyan(d)} `:"",u=r?e.cyan(x):"";return`${s}${o}${i}
|
|
85
|
+
${u}
|
|
86
|
+
`}}}}).prompt(),Ue=t=>{const r=t.validate;return Xt({...t,initialUserInput:t.initialValue??t.root??process.cwd(),maxItems:5,validate(s){if(!Array.isArray(s)){if(!s)return"Please select a path";if(r)return r(s)}},options(){const s=this.userInput;if(s==="")return[];try{let i;return $e(s)?xt(s).isDirectory()?i=s:i=_t(s):i=_t(s),de(i).map(a=>{const o=he(i,a),u=xt(o);return{name:a,path:o,isDirectory:u.isDirectory()}}).filter(({path:a,isDirectory:o})=>a.startsWith(s)&&(t.directory||!o)).map(a=>({value:a.path}))}catch{return[]}}})},Ke=e.magenta,bt=({indicator:t="dots",onCancel:r,output:s=process.stdout,cancelMessage:i,errorMessage:a,frames:o=et?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:u=et?80:120,signal:l,...n}={})=>{const c=ct();let g,F,p=!1,E=!1,$="",m,h=performance.now();const y=z(s),f=n?.styleFrame??Ke,v=b=>{const O=b>1?a??P.messages.error:i??P.messages.cancel;E=b===1,p&&(L(O,b),E&&typeof r=="function"&&r())},S=()=>v(2),I=()=>v(1),B=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",I),process.on("SIGTERM",I),process.on("exit",v),l&&l.addEventListener("abort",I)},A=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",I),process.removeListener("SIGTERM",I),process.removeListener("exit",v),l&&l.removeEventListener("abort",I)},w=()=>{if(m===void 0)return;c&&s.write(`
|
|
87
|
+
`);const b=J(m,y,{hard:!0,trim:!1}).split(`
|
|
88
|
+
`);b.length>1&&s.write(Dt.up(b.length-1)),s.write(Dt.to(0)),s.write(Tt.down())},_=b=>b.replace(/\.+$/,""),D=b=>{const O=(performance.now()-b)/1e3,j=Math.floor(O/60),G=Math.floor(O%60);return j>0?`[${j}m ${G}s]`:`[${G}s]`},T=n.withGuide??P.withGuide,Y=(b="")=>{p=!0,g=oe({output:s}),$=_(b),h=performance.now(),T&&s.write(`${e.gray(d)}
|
|
89
|
+
`);let O=0,j=0;B(),F=setInterval(()=>{if(c&&$===m)return;w(),m=$;const G=f(o[O]);let tt;if(c)tt=`${G} ${$}...`;else if(t==="timer")tt=`${G} ${$} ${D(h)}`;else{const te=".".repeat(Math.floor(j)).slice(0,3);tt=`${G} ${$}${te}`}const Zt=J(tt,y,{hard:!0,trim:!1});s.write(Zt),O=O+1<o.length?O+1:0,j=j<4?j+.125:0},u)},L=(b="",O=0,j=!1)=>{if(!p)return;p=!1,clearInterval(F),w();const G=O===0?e.green(V):O===1?e.red(dt):e.red($t);$=b??$,j||(t==="timer"?s.write(`${G} ${$} ${D(h)}
|
|
90
|
+
`):s.write(`${G} ${$}
|
|
91
|
+
`)),A(),g()};return{start:Y,stop:(b="")=>L(b,0),message:(b="")=>{$=_(b??$)},cancel:(b="")=>L(b,1),error:(b="")=>L(b,2),clear:()=>L("",0,!0),get isCancelled(){return E}}},zt={light:C("\u2500","-"),heavy:C("\u2501","="),block:C("\u2588","#")};function qe({style:t="heavy",max:r=100,size:s=40,...i}={}){const a=bt(i);let o=0,u="";const l=Math.max(1,r),n=Math.max(1,s),c=E=>{switch(E){case"initial":case"active":return e.magenta;case"error":case"cancel":return e.red;case"submit":return e.green;default:return e.magenta}},g=(E,$)=>{const m=Math.floor(o/l*n);return`${c(E)(zt[t].repeat(m))}${e.dim(zt[t].repeat(n-m))} ${$}`},F=(E="")=>{u=E,a.start(g("initial",E))},p=(E=1,$)=>{o=Math.min(l,E+o),a.message(g("active",$??u)),u=$??u};return{start:F,stop:a.stop,cancel:a.cancel,error:a.error,clear:a.clear,advance:p,isCancelled:a.isCancelled,message:E=>p(0,E)}}const lt=(t,r)=>t.includes(`
|
|
92
|
+
`)?t.split(`
|
|
93
|
+
`).map(s=>r(s)).join(`
|
|
94
|
+
`):r(t),Je=t=>{const r=(s,i)=>{const a=s.label??String(s.value);switch(i){case"disabled":return`${e.gray(H)} ${lt(a,e.gray)}${s.hint?` ${e.dim(`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${lt(a,e.dim)}`;case"active":return`${e.green(Q)} ${a}${s.hint?` ${e.dim(`(${s.hint})`)}`:""}`;case"cancelled":return`${lt(a,o=>e.strikethrough(e.dim(o)))}`;default:return`${e.dim(H)} ${lt(a,e.dim)}`}};return new le({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){const s=t.withGuide??P.withGuide,i=`${W(this.state)} `,a=`${vt(this.state)} `,o=k(t.output,t.message,a,i),u=`${s?`${e.gray(d)}
|
|
95
|
+
`:""}${o}
|
|
96
|
+
`;switch(this.state){case"submit":{const l=s?`${e.gray(d)} `:"",n=k(t.output,r(this.options[this.cursor],"selected"),l);return`${u}${n}`}case"cancel":{const l=s?`${e.gray(d)} `:"",n=k(t.output,r(this.options[this.cursor],"cancelled"),l);return`${u}${n}${s?`
|
|
97
|
+
${e.gray(d)}`:""}`}default:{const l=s?`${e.cyan(d)} `:"",n=s?e.cyan(x):"",c=u.split(`
|
|
98
|
+
`).length,g=s?2:1;return`${u}${l}${X({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:l.length,rowPadding:c+g,style:(F,p)=>r(F,F.disabled?"disabled":p?"active":"inactive")}).join(`
|
|
99
|
+
${l}`)}
|
|
100
|
+
${n}
|
|
101
|
+
`}}}}).prompt()},Xe=t=>{const r=(s,i="inactive")=>{const a=s.label??String(s.value);return i==="selected"?`${e.dim(a)}`:i==="cancelled"?`${e.strikethrough(e.dim(a))}`:i==="active"?`${e.bgCyan(e.gray(` ${s.value} `))} ${a}${s.hint?` ${e.dim(`(${s.hint})`)}`:""}`:`${e.gray(e.bgWhite(e.inverse(` ${s.value} `)))} ${a}${s.hint?` ${e.dim(`(${s.hint})`)}`:""}`};return new ue({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,caseSensitive:t.caseSensitive,render(){const s=t.withGuide??P.withGuide,i=`${s?`${e.gray(d)}
|
|
102
|
+
`:""}${W(this.state)} ${t.message}
|
|
103
|
+
`;switch(this.state){case"submit":{const a=s?`${e.gray(d)} `:"",o=this.options.find(l=>l.value===this.value)??t.options[0],u=k(t.output,r(o,"selected"),a);return`${i}${u}`}case"cancel":{const a=s?`${e.gray(d)} `:"",o=k(t.output,r(this.options[0],"cancelled"),a);return`${i}${o}${s?`
|
|
104
|
+
${e.gray(d)}`:""}`}default:{const a=s?`${e.cyan(d)} `:"",o=s?e.cyan(x):"",u=this.options.map((l,n)=>k(t.output,r(l,n===this.cursor?"active":"inactive"),a)).join(`
|
|
105
|
+
`);return`${i}${u}
|
|
106
|
+
${o}
|
|
107
|
+
`}}}}).prompt()},Qt=`${e.gray(d)} `,K={message:async(t,{symbol:r=e.gray(d)}={})=>{process.stdout.write(`${e.gray(d)}
|
|
108
|
+
${r} `);let s=3;for await(let i of t){i=i.replace(/\n/g,`
|
|
109
|
+
${Qt}`),i.includes(`
|
|
110
|
+
`)&&(s=3+ut(i.slice(i.lastIndexOf(`
|
|
111
|
+
`))).length);const a=ut(i).length;s+a<process.stdout.columns?(s+=a,process.stdout.write(i)):(process.stdout.write(`
|
|
112
|
+
${Qt}${i.trimStart()}`),s=3+ut(i.trimStart()).length)}process.stdout.write(`
|
|
113
|
+
`)},info:t=>K.message(t,{symbol:e.blue(ft)}),success:t=>K.message(t,{symbol:e.green(Ft)}),step:t=>K.message(t,{symbol:e.green(V)}),warn:t=>K.message(t,{symbol:e.yellow(yt)}),warning:t=>K.warn(t),error:t=>K.message(t,{symbol:e.red(Et)})},Ye=async(t,r)=>{for(const s of t){if(s.enabled===!1)continue;const i=bt(r);i.start(s.title);const a=await s.task(i.message);i.stop(a||s.title)}},ze=t=>t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,""),Qe=t=>{const r=t.output??process.stdout,s=z(r),i=e.gray(d),a=t.spacing??1,o=3,u=t.retainLog===!0,l=!ct()&&Mt(r);r.write(`${i}
|
|
114
|
+
`),r.write(`${e.green(V)} ${t.title}
|
|
115
|
+
`);for(let h=0;h<a;h++)r.write(`${i}
|
|
116
|
+
`);const n=[{value:"",full:""}];let c=!1;const g=h=>{if(n.length===0)return;let y=0;h&&(y+=a+2);for(const f of n){const{value:v,result:S}=f;let I=S?.message??v;if(I.length===0)continue;S===void 0&&f.header!==void 0&&f.header!==""&&(I+=`
|
|
117
|
+
${f.header}`);const B=I.split(`
|
|
118
|
+
`).reduce((A,w)=>w===""?A+1:A+Math.ceil((w.length+o)/s),0);y+=B}y>0&&(y+=1,r.write(Tt.lines(y)))},F=(h,y,f)=>{const v=f?`${h.full}
|
|
119
|
+
${h.value}`:h.value;h.header!==void 0&&h.header!==""&&R.message(h.header.split(`
|
|
120
|
+
`).map(e.bold),{output:r,secondarySymbol:i,symbol:i,spacing:0}),R.message(v.split(`
|
|
121
|
+
`).map(e.dim),{output:r,secondarySymbol:i,symbol:i,spacing:y??a})},p=()=>{for(const h of n){const{header:y,value:f,full:v}=h;(y===void 0||y.length===0)&&f.length===0||F(h,void 0,u===!0&&v.length>0)}},E=(h,y,f)=>{if(g(!1),(f?.raw!==!0||!c)&&h.value!==""&&(h.value+=`
|
|
122
|
+
`),h.value+=ze(y),c=f?.raw===!0,t.limit!==void 0){const v=h.value.split(`
|
|
123
|
+
`),S=v.length-t.limit;if(S>0){const I=v.splice(0,S);u&&(h.full+=(h.full===""?"":`
|
|
124
|
+
`)+I.join(`
|
|
125
|
+
`))}h.value=v.join(`
|
|
126
|
+
`)}l&&$()},$=()=>{for(const h of n)h.result?h.result.status==="error"?R.error(h.result.message,{output:r,secondarySymbol:i,spacing:0}):R.success(h.result.message,{output:r,secondarySymbol:i,spacing:0}):h.value!==""&&F(h,0)},m=(h,y)=>{g(!1),h.result=y,l&&$()};return{message(h,y){E(n[0],h,y)},group(h){const y={header:h,value:"",full:""};return n.push(y),{message(f,v){E(y,f,v)},error(f){m(y,{status:"error",message:f})},success(f){m(y,{status:"success",message:f})}}},error(h,y){g(!0),R.error(h,{output:r,secondarySymbol:i,spacing:1}),y?.showLog!==!1&&p(),n.splice(1,n.length-1),n[0].value="",n[0].full=""},success(h,y){g(!0),R.success(h,{output:r,secondarySymbol:i,spacing:1}),y?.showLog===!0&&p(),n.splice(1,n.length-1),n[0].value="",n[0].full=""}}},Ze=t=>new ce({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){const r=t?.withGuide??P.withGuide,s=`${`${r?`${e.gray(d)}
|
|
127
|
+
`:""}${W(this.state)} `}${t.message}
|
|
128
|
+
`,i=t.placeholder?e.inverse(t.placeholder[0])+e.dim(t.placeholder.slice(1)):e.inverse(e.hidden("_")),a=this.userInput?this.userInputWithCursor:i,o=this.value??"";switch(this.state){case"error":{const u=this.error?` ${e.yellow(this.error)}`:"",l=r?`${e.yellow(d)} `:"",n=r?e.yellow(x):"";return`${s.trim()}
|
|
129
|
+
${l}${a}
|
|
130
|
+
${n}${u}
|
|
131
|
+
`}case"submit":{const u=o?` ${e.dim(o)}`:"",l=r?e.gray(d):"";return`${s}${l}${u}`}case"cancel":{const u=o?` ${e.strikethrough(e.dim(o))}`:"",l=r?e.gray(d):"";return`${s}${l}${u}${o.trim()?`
|
|
132
|
+
${l}`:""}`}default:{const u=r?`${e.cyan(d)} `:"",l=r?e.cyan(x):"";return`${s}${u}${a}
|
|
133
|
+
${l}
|
|
134
|
+
`}}}}).prompt();export{d as S_BAR,x as S_BAR_END,Pt as S_BAR_END_RIGHT,rt as S_BAR_H,ht as S_BAR_START,Ot as S_BAR_START_RIGHT,st as S_CHECKBOX_ACTIVE,q as S_CHECKBOX_INACTIVE,U as S_CHECKBOX_SELECTED,Wt as S_CONNECT_LEFT,gt as S_CORNER_BOTTOM_LEFT,pt as S_CORNER_BOTTOM_RIGHT,Lt as S_CORNER_TOP_LEFT,mt as S_CORNER_TOP_RIGHT,Et as S_ERROR,ft as S_INFO,Nt as S_PASSWORD_MASK,Q as S_RADIO_ACTIVE,H as S_RADIO_INACTIVE,Rt as S_STEP_ACTIVE,dt as S_STEP_CANCEL,$t as S_STEP_ERROR,V as S_STEP_SUBMIT,Ft as S_SUCCESS,yt as S_WARN,Xt as autocomplete,xe as autocompleteMultiselect,Me as box,Ne as cancel,Re as confirm,Oe as group,Pe as groupMultiselect,We as intro,ct as isCI,Mt as isTTY,X as limitOptions,R as log,je as multiselect,Ve as note,Le as outro,He as password,Ue as path,qe as progress,Je as select,Xe as selectKey,bt as spinner,K as stream,W as symbol,vt as symbolBar,Qe as taskLog,Ye as tasks,Ze as text,et as unicode,C as unicodeOr};
|
|
135
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clack/prompts",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.mjs",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"default": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"types": "./dist/index.d.mts",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/bombshell-dev/clack.git",
|
|
18
|
+
"directory": "packages/prompts"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/bombshell-dev/clack/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/bombshell-dev/clack/tree/main/packages/prompts#readme",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"CHANGELOG.md"
|
|
27
|
+
],
|
|
28
|
+
"author": {
|
|
29
|
+
"name": "Nate Moore",
|
|
30
|
+
"email": "nate@natemoo.re",
|
|
31
|
+
"url": "https://twitter.com/n_moore"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"keywords": [
|
|
35
|
+
"ask",
|
|
36
|
+
"clack",
|
|
37
|
+
"cli",
|
|
38
|
+
"command-line",
|
|
39
|
+
"command",
|
|
40
|
+
"input",
|
|
41
|
+
"interact",
|
|
42
|
+
"interface",
|
|
43
|
+
"menu",
|
|
44
|
+
"prompt",
|
|
45
|
+
"prompts",
|
|
46
|
+
"stdin",
|
|
47
|
+
"ui"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"picocolors": "^1.0.0",
|
|
51
|
+
"sisteransi": "^1.0.5",
|
|
52
|
+
"@clack/core": "1.0.1"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"fast-string-width": "^1.1.0",
|
|
56
|
+
"fast-wrap-ansi": "^0.1.3",
|
|
57
|
+
"is-unicode-supported": "^1.3.0",
|
|
58
|
+
"memfs": "^4.17.2",
|
|
59
|
+
"vitest": "^3.2.4",
|
|
60
|
+
"vitest-ansi-serializer": "^0.1.2"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "unbuild",
|
|
64
|
+
"test": "vitest run"
|
|
65
|
+
}
|
|
66
|
+
}
|