@kjanat/dreamcli 3.0.0-rc.2 → 3.0.0-rc.20
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/CHANGELOG.md +374 -1
- package/README.md +3 -3
- package/dist/core/cli/dispatch.d.mts +6 -5
- package/dist/core/cli/dispatch.mjs +7 -16
- package/dist/core/cli/help-links.d.mts +0 -1
- package/dist/core/cli/index.d.mts +213 -16
- package/dist/core/cli/index.mjs +174 -43
- package/dist/core/cli/planner.d.mts +5 -1
- package/dist/core/cli/planner.mjs +19 -13
- package/dist/core/cli/plugin.d.mts +1 -1
- package/dist/core/cli/propagate.d.mts +1 -1
- package/dist/core/cli/root-help.d.mts +2 -1
- package/dist/core/cli/root-help.mjs +45 -22
- package/dist/core/cli/root-surface.d.mts +12 -1
- package/dist/core/cli/root-surface.mjs +2 -1
- package/dist/core/cli/runtime-preflight.d.mts +18 -2
- package/dist/core/cli/runtime-preflight.mjs +10 -7
- package/dist/core/completion/index.d.mts +0 -1
- package/dist/core/completion/index.mjs +1 -1
- package/dist/core/completion/shells/bash.d.mts +0 -1
- package/dist/core/completion/shells/bash.mjs +8 -4
- package/dist/core/completion/shells/fish.d.mts +0 -1
- package/dist/core/completion/shells/fish.mjs +6 -3
- package/dist/core/completion/shells/powershell.d.mts +0 -1
- package/dist/core/completion/shells/powershell.mjs +10 -5
- package/dist/core/completion/shells/shared.d.mts +13 -2
- package/dist/core/completion/shells/shared.mjs +25 -2
- package/dist/core/completion/shells/zsh.d.mts +0 -1
- package/dist/core/completion/shells/zsh.mjs +11 -4
- package/dist/core/config/index.d.mts +44 -14
- package/dist/core/config/index.mjs +57 -18
- package/dist/core/config/package-json.d.mts +28 -4
- package/dist/core/config/package-json.mjs +20 -19
- package/dist/core/errors/index.d.mts +3 -3
- package/dist/core/execution/index.d.mts +0 -1
- package/dist/core/execution/index.mjs +20 -4
- package/dist/core/help/ansi.d.mts +11 -5
- package/dist/core/help/ansi.mjs +15 -16
- package/dist/core/help/index.d.mts +44 -3
- package/dist/core/help/index.mjs +130 -68
- package/dist/core/help/theme.d.mts +68 -0
- package/dist/core/help/theme.mjs +46 -0
- package/dist/core/json-schema/index.d.mts +21 -9
- package/dist/core/json-schema/index.mjs +316 -87
- package/dist/core/json-schema/meta-descriptions.generated.d.mts +55 -38
- package/dist/core/json-schema/meta-descriptions.generated.mjs +14 -5
- package/dist/core/output/activity.d.mts +0 -1
- package/dist/core/output/contracts.d.mts +5 -6
- package/dist/core/output/contracts.mjs +2 -2
- package/dist/core/output/index.d.mts +38 -2
- package/dist/core/output/index.mjs +37 -2
- package/dist/core/output/renderers.d.mts +0 -1
- package/dist/core/parse/index.d.mts +40 -7
- package/dist/core/parse/index.mjs +212 -40
- package/dist/core/prompt/index.d.mts +1 -0
- package/dist/core/resolve/args.d.mts +1 -1
- package/dist/core/resolve/coerce.d.mts +1 -1
- package/dist/core/resolve/coerce.mjs +71 -14
- package/dist/core/resolve/contracts.d.mts +14 -4
- package/dist/core/resolve/errors.d.mts +0 -1
- package/dist/core/resolve/flags.d.mts +9 -2
- package/dist/core/resolve/flags.mjs +78 -6
- package/dist/core/resolve/index.d.mts +2 -2
- package/dist/core/resolve/index.mjs +6 -1
- package/dist/core/resolve/property.d.mts +4 -1
- package/dist/core/resolve/property.mjs +11 -3
- package/dist/core/resolve/standard.d.mts +24 -0
- package/dist/core/resolve/standard.mjs +114 -0
- package/dist/core/schema/activity.d.mts +31 -11
- package/dist/core/schema/arg.d.mts +38 -4
- package/dist/core/schema/arg.mjs +5 -2
- package/dist/core/schema/command.d.mts +57 -13
- package/dist/core/schema/command.mjs +41 -17
- package/dist/core/schema/flag.d.mts +553 -19
- package/dist/core/schema/flag.mjs +261 -5
- package/dist/core/schema/index.d.mts +6 -3
- package/dist/core/schema/middleware.d.mts +4 -3
- package/dist/core/schema/prompt.d.mts +6 -3
- package/dist/core/schema/run.d.mts +27 -1
- package/dist/core/schema/standard.d.mts +100 -0
- package/dist/core/schema/standard.mjs +15 -0
- package/dist/core/schema/string-constraints.d.mts +97 -0
- package/dist/core/schema/string-constraints.mjs +69 -0
- package/dist/core/schema/value-parsers.d.mts +78 -0
- package/dist/core/schema/value-parsers.mjs +142 -0
- package/dist/core/testkit/index.d.mts +0 -31
- package/dist/core/testkit/index.mjs +1 -1
- package/dist/index.d.mts +12 -7
- package/dist/index.mjs +9 -9
- package/dist/runtime/adapter.d.mts +71 -2
- package/dist/runtime/adapter.mjs +11 -1
- package/dist/runtime/auto.d.mts +2 -3
- package/dist/runtime/auto.mjs +4 -5
- package/dist/runtime/deno.d.mts +28 -5
- package/dist/runtime/deno.mjs +49 -1
- package/dist/runtime/index.d.mts +3 -4
- package/dist/runtime/node.d.mts +8 -2
- package/dist/runtime/node.mjs +60 -1
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +2 -3
- package/dist/testkit.d.mts +1 -0
- package/dist/version.d.mts +7 -3
- package/dist/version.mjs +2 -2
- package/dreamcli.schema.json +118 -7
- package/examples/gh/node_modules/typescript/LICENSE +55 -0
- package/examples/gh/node_modules/typescript/NOTICE.txt +436 -0
- package/examples/gh/node_modules/typescript/README.md +49 -0
- package/examples/gh/node_modules/typescript/bin/tsc +2 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts +529 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.js +1657 -0
- package/examples/gh/node_modules/typescript/dist/api/async/api.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts +39 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.js +211 -0
- package/examples/gh/node_modules/typescript/dist/api/async/client.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts +310 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.js +2 -0
- package/examples/gh/node_modules/typescript/dist/api/async/types.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts +109 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js +2 -0
- package/examples/gh/node_modules/typescript/dist/api/compilerOptions.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.d.ts +23 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.js +109 -0
- package/examples/gh/node_modules/typescript/dist/api/fs.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts +15 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js +74 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.js +287 -0
- package/examples/gh/node_modules/typescript/dist/api/node/encoder.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts +32 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js +213 -0
- package/examples/gh/node_modules/typescript/dist/api/node/msgpack.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts +76 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts +182 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js +835 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts +62 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js +122 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.infrastructure.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.js +298 -0
- package/examples/gh/node_modules/typescript/dist/api/node/node.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts +29 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts +4 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js +241 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.js +30 -0
- package/examples/gh/node_modules/typescript/dist/api/node/protocol.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts +6 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js +61 -0
- package/examples/gh/node_modules/typescript/dist/api/node/wtf8.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/options.d.ts +32 -0
- package/examples/gh/node_modules/typescript/dist/api/options.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/options.js +11 -0
- package/examples/gh/node_modules/typescript/dist/api/options.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/path.d.ts +110 -0
- package/examples/gh/node_modules/typescript/dist/api/path.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/path.js +508 -0
- package/examples/gh/node_modules/typescript/dist/api/path.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.d.ts +239 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.js +37 -0
- package/examples/gh/node_modules/typescript/dist/api/proto.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts +79 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js +169 -0
- package/examples/gh/node_modules/typescript/dist/api/sourceFileCache.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts +529 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.js +1665 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/api.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts +30 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.js +124 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/client.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts +310 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.js +2 -0
- package/examples/gh/node_modules/typescript/dist/api/sync/types.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts +114 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.js +508 -0
- package/examples/gh/node_modules/typescript/dist/api/syncChannel.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.d.ts +175 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.js +149 -0
- package/examples/gh/node_modules/typescript/dist/api/timing.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts +100 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts +1161 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js +4 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.js +7 -0
- package/examples/gh/node_modules/typescript/dist/ast/ast.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts +19 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.js +596 -0
- package/examples/gh/node_modules/typescript/dist/ast/astnav.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts +16 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.js +104 -0
- package/examples/gh/node_modules/typescript/dist/ast/clone.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts +520 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js +3057 -0
- package/examples/gh/node_modules/typescript/dist/ast/factory.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.d.ts +20 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.js +20 -0
- package/examples/gh/node_modules/typescript/dist/ast/index.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.d.ts +35 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts +329 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.js +1103 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.js +233 -0
- package/examples/gh/node_modules/typescript/dist/ast/is.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts +11 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js +202 -0
- package/examples/gh/node_modules/typescript/dist/ast/jsdoc.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts +97 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.js +2230 -0
- package/examples/gh/node_modules/typescript/dist/ast/scanner.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts +17 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.js +67 -0
- package/examples/gh/node_modules/typescript/dist/ast/utils.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts +14 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts +50 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js +978 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.generated.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.js +47 -0
- package/examples/gh/node_modules/typescript/dist/ast/visitor.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts +129 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js +132 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js +130 -0
- package/examples/gh/node_modules/typescript/dist/enums/characterCodes.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/commentDirectiveType.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts +28 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js +30 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js +30 -0
- package/examples/gh/node_modules/typescript/dist/enums/completionItemKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/diagnosticCategory.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts +12 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/elementFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts +23 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js +25 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js +25 -0
- package/examples/gh/node_modules/typescript/dist/enums/internalSymbolName.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/jsxEmit.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/languageVariant.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts +42 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js +44 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js +44 -0
- package/examples/gh/node_modules/typescript/dist/enums/modifierFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleDetectionKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js +19 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js +19 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/moduleResolutionKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts +6 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js +8 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js +8 -0
- package/examples/gh/node_modules/typescript/dist/enums/newLineKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts +36 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js +38 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js +38 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeBuilderFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts +44 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js +46 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js +46 -0
- package/examples/gh/node_modules/typescript/dist/enums/nodeFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts +50 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js +52 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js +52 -0
- package/examples/gh/node_modules/typescript/dist/enums/objectFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts +16 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/outerExpressionKinds.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts +13 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js +14 -0
- package/examples/gh/node_modules/typescript/dist/enums/regularExpressionFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts +11 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js +12 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js +12 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js +18 -0
- package/examples/gh/node_modules/typescript/dist/enums/scriptTarget.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts +15 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js +17 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts +5 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/signatureKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts +71 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js +73 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js +73 -0
- package/examples/gh/node_modules/typescript/dist/enums/symbolFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts +389 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js +391 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js +391 -0
- package/examples/gh/node_modules/typescript/dist/enums/syntaxKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts +30 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js +32 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js +32 -0
- package/examples/gh/node_modules/typescript/dist/enums/tokenFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts +76 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js +78 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js +78 -0
- package/examples/gh/node_modules/typescript/dist/enums/typeFlags.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts +2 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts +7 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.enum.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js +9 -0
- package/examples/gh/node_modules/typescript/dist/enums/typePredicateKind.js.map +1 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts +23 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.d.ts.map +1 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.js +25 -0
- package/examples/gh/node_modules/typescript/dist/internal/utils.js.map +1 -0
- package/examples/gh/node_modules/typescript/lib/getExePath.d.ts +2 -0
- package/examples/gh/node_modules/typescript/lib/getExePath.js +70 -0
- package/examples/gh/node_modules/typescript/lib/tsc.js +28 -0
- package/examples/gh/node_modules/typescript/lib/version.cjs +3 -0
- package/examples/gh/node_modules/typescript/lib/version.d.cts +2 -0
- package/examples/gh/node_modules/typescript/package.json +87 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/License.txt +11 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/README.md +54 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.d.ts +17 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/main.js +83 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.d.ts +22 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/browser/ril.js +210 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.d.ts +14 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/api.js +87 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.d.ts +32 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/cancellation.js +132 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.d.ts +367 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/connection.js +1271 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.d.ts +9 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/disposable.js +16 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.d.ts +52 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/encoding.js +70 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.d.ts +39 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/events.js +135 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.d.ts +7 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/is.js +34 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.d.ts +55 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/linkedMap.js +412 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.d.ts +18 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageBuffer.js +155 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.d.ts +77 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageReader.js +246 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.d.ts +60 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messageWriter.js +157 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.d.ts +369 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/messages.js +436 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.d.ts +74 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/ral.js +23 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.d.ts +10 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/semaphore.js +74 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +15 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +77 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.d.ts +58 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/main.js +289 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.d.ts +12 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/lib/node/ril.js +163 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/package.json +54 -0
- package/examples/gh/node_modules/typescript/vendor/vscode-jsonrpc/typings/thenable.d.ts +5 -0
- package/examples/gh/package.json +11 -5
- package/examples/gh/src/main.ts +10 -4
- package/examples/pwsh-demo/package.json +1 -1
- package/examples/pwsh-demo/src/main.ts +1 -1
- package/package.json +45 -41
- package/dist/core/schema-dsl/runtime.d.mts +0 -144
- package/dist/core/schema-dsl/runtime.mjs +0 -271
- package/dist/core/schema-dsl/to-json-schema.d.mts +0 -30
- package/dist/core/schema-dsl/to-json-schema.mjs +0 -74
- package/dist/runtime/bun.d.mts +0 -28
- package/dist/runtime/bun.mjs +0 -28
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//#region src/core/schema/string-constraints.ts
|
|
2
|
+
/**
|
|
3
|
+
* Validate a string value against constraints.
|
|
4
|
+
*
|
|
5
|
+
* The single source of truth for string-constraint checks, shared by the
|
|
6
|
+
* parse and coerce paths. Checks run in a fixed order — **nonEmpty →
|
|
7
|
+
* minLength → maxLength → pattern** — and the first failure is returned.
|
|
8
|
+
* Stateful regexes (`g` / `y` flags) are tested from index 0 every time, so
|
|
9
|
+
* repeated validations cannot flip-flop on `lastIndex`.
|
|
10
|
+
*
|
|
11
|
+
* @param value - The string value to validate.
|
|
12
|
+
* @param constraints - Constraints to enforce, or `undefined` for none.
|
|
13
|
+
* @returns The first {@link StringConstraintViolation}, or `undefined` if valid.
|
|
14
|
+
*/
|
|
15
|
+
function validateStringConstraints(value, constraints) {
|
|
16
|
+
if (constraints === void 0) return;
|
|
17
|
+
if (constraints.nonEmpty === true && value.length === 0) return { kind: "nonEmpty" };
|
|
18
|
+
if (constraints.minLength !== void 0 && value.length < constraints.minLength) return {
|
|
19
|
+
kind: "minLength",
|
|
20
|
+
bound: constraints.minLength
|
|
21
|
+
};
|
|
22
|
+
if (constraints.maxLength !== void 0 && value.length > constraints.maxLength) return {
|
|
23
|
+
kind: "maxLength",
|
|
24
|
+
bound: constraints.maxLength
|
|
25
|
+
};
|
|
26
|
+
if (constraints.pattern !== void 0) {
|
|
27
|
+
constraints.pattern.lastIndex = 0;
|
|
28
|
+
if (!constraints.pattern.test(value)) return {
|
|
29
|
+
kind: "pattern",
|
|
30
|
+
pattern: String(constraints.pattern)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Render a terse, human-readable reason for a constraint violation.
|
|
36
|
+
*
|
|
37
|
+
* @param violation - The violation to describe.
|
|
38
|
+
* @returns A message suffix such as `must not be empty` or `must match /^ghp_/`.
|
|
39
|
+
*/
|
|
40
|
+
function describeStringConstraintViolation(violation) {
|
|
41
|
+
switch (violation.kind) {
|
|
42
|
+
case "nonEmpty": return "must not be empty";
|
|
43
|
+
case "minLength": return `must be at least ${violation.bound} characters`;
|
|
44
|
+
case "maxLength": return `must be at most ${violation.bound} characters`;
|
|
45
|
+
case "pattern": return `must match ${violation.pattern}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Assert that a constraints object is well-formed at schema-construction time.
|
|
50
|
+
*
|
|
51
|
+
* Length bounds must be non-negative integers — a fractional or negative
|
|
52
|
+
* length is meaningless (omit the field for "no bound"). An inverted range
|
|
53
|
+
* (`minLength > maxLength`) is also rejected, since it makes the flag/arg
|
|
54
|
+
* permanently unsatisfiable. Throws so the misconfiguration surfaces where
|
|
55
|
+
* the flag/arg is declared, not at parse time.
|
|
56
|
+
*
|
|
57
|
+
* @param constraints - The constraints to validate.
|
|
58
|
+
* @throws RangeError if `minLength` or `maxLength` is negative, fractional, or
|
|
59
|
+
* non-finite, or if `minLength` exceeds `maxLength`.
|
|
60
|
+
*/
|
|
61
|
+
function assertStringConstraints(constraints) {
|
|
62
|
+
for (const field of ["minLength", "maxLength"]) {
|
|
63
|
+
const bound = constraints[field];
|
|
64
|
+
if (bound !== void 0 && (!Number.isInteger(bound) || bound < 0)) throw new RangeError(`string constraint '${field}' must be a non-negative integer (got ${bound}); omit it for no bound`);
|
|
65
|
+
}
|
|
66
|
+
if (constraints.minLength !== void 0 && constraints.maxLength !== void 0 && constraints.minLength > constraints.maxLength) throw new RangeError(`string constraint 'minLength' (${constraints.minLength}) must not exceed 'maxLength' (${constraints.maxLength})`);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { assertStringConstraints, describeStringConstraintViolation, validateStringConstraints };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/core/schema/value-parsers.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Parse functions backing the sugar flag factories (`flag.url()`,
|
|
4
|
+
* `flag.date()`, `flag.duration()`, `flag.bytes()`).
|
|
5
|
+
*
|
|
6
|
+
* Each parser converts a raw CLI/env/config value into a typed value and
|
|
7
|
+
* throws a plain `Error` with a human-readable reason on invalid input. The
|
|
8
|
+
* parse and resolve pipelines wrap thrown errors with flag context
|
|
9
|
+
* (`Failed to parse flag --x: <reason>`), so parsers only describe the value
|
|
10
|
+
* problem itself.
|
|
11
|
+
*
|
|
12
|
+
* @module dreamcli/core/schema/value-parsers
|
|
13
|
+
*/
|
|
14
|
+
/** Options accepted by `flag.url()`. */
|
|
15
|
+
interface UrlFlagOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Allowed URL protocols, without the trailing colon (e.g. `['https']`).
|
|
18
|
+
* @defaultValue `undefined` (any protocol)
|
|
19
|
+
*/
|
|
20
|
+
readonly protocols?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** Options accepted by `flag.date()`. */
|
|
23
|
+
interface DateFlagOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Inclusive earliest allowed date.
|
|
26
|
+
* @defaultValue `undefined` (no lower bound)
|
|
27
|
+
*/
|
|
28
|
+
readonly min?: Date;
|
|
29
|
+
/**
|
|
30
|
+
* Inclusive latest allowed date.
|
|
31
|
+
* @defaultValue `undefined` (no upper bound)
|
|
32
|
+
*/
|
|
33
|
+
readonly max?: Date;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parse a strict ISO-8601 date string into a `Date`.
|
|
37
|
+
*
|
|
38
|
+
* Rejects non-string input, non-ISO shapes, and calendar-invalid components
|
|
39
|
+
* (`2026-02-31` does not silently roll over to March). Offset-less datetimes
|
|
40
|
+
* are interpreted as UTC so results never depend on the machine's timezone.
|
|
41
|
+
*
|
|
42
|
+
* @param raw - Raw flag value.
|
|
43
|
+
* @param options - Optional inclusive date bounds.
|
|
44
|
+
* @returns The parsed `Date`.
|
|
45
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
46
|
+
*/
|
|
47
|
+
declare function parseDateValue(raw: unknown, options?: DateFlagOptions): Date;
|
|
48
|
+
/**
|
|
49
|
+
* Parse a URL string into a `URL`, optionally restricting protocols.
|
|
50
|
+
*
|
|
51
|
+
* @param raw - Raw flag value.
|
|
52
|
+
* @param options - Optional protocol allowlist.
|
|
53
|
+
* @returns The parsed `URL`.
|
|
54
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
55
|
+
*/
|
|
56
|
+
declare function parseUrlValue(raw: unknown, options?: UrlFlagOptions): URL;
|
|
57
|
+
/**
|
|
58
|
+
* Parse a human duration (`'30s'`, `'5m'`, `'1.5h'`, `'250ms'`, `'2d'`) into
|
|
59
|
+
* milliseconds. A bare number (`'1500'`) is treated as milliseconds. Compound
|
|
60
|
+
* values (`'1h30m'`) are supported.
|
|
61
|
+
*
|
|
62
|
+
* @param raw - Raw flag value.
|
|
63
|
+
* @returns Duration in milliseconds.
|
|
64
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
65
|
+
*/
|
|
66
|
+
declare function parseDurationValue(raw: unknown): number;
|
|
67
|
+
/**
|
|
68
|
+
* Parse a human byte size (`'512mb'`, `'1.5gb'`, `'64kb'`, `'100b'`) into a
|
|
69
|
+
* byte count. Units are binary (`1kb` = 1024 bytes) and case-insensitive; a
|
|
70
|
+
* bare number is treated as bytes.
|
|
71
|
+
*
|
|
72
|
+
* @param raw - Raw flag value.
|
|
73
|
+
* @returns Size in bytes.
|
|
74
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
75
|
+
*/
|
|
76
|
+
declare function parseBytesValue(raw: unknown): number;
|
|
77
|
+
//#endregion
|
|
78
|
+
export { type DateFlagOptions, type UrlFlagOptions, parseBytesValue, parseDateValue, parseDurationValue, parseUrlValue };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
//#region src/core/schema/value-parsers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Strict ISO-8601 shapes accepted by {@link parseDateValue}:
|
|
4
|
+
* `YYYY-MM-DD`, optionally followed by `THH:MM`, `:SS`, `.mmm`, and a
|
|
5
|
+
* `Z` / `±HH:MM` offset. Anything else — including `Date.parse`-lenient
|
|
6
|
+
* inputs like `'0'` or `'March 5'` — is rejected.
|
|
7
|
+
*/
|
|
8
|
+
const ISO_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:\d{2})?)?$/;
|
|
9
|
+
/**
|
|
10
|
+
* Parse a strict ISO-8601 date string into a `Date`.
|
|
11
|
+
*
|
|
12
|
+
* Rejects non-string input, non-ISO shapes, and calendar-invalid components
|
|
13
|
+
* (`2026-02-31` does not silently roll over to March). Offset-less datetimes
|
|
14
|
+
* are interpreted as UTC so results never depend on the machine's timezone.
|
|
15
|
+
*
|
|
16
|
+
* @param raw - Raw flag value.
|
|
17
|
+
* @param options - Optional inclusive date bounds.
|
|
18
|
+
* @returns The parsed `Date`.
|
|
19
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
20
|
+
*/
|
|
21
|
+
function parseDateValue(raw, options) {
|
|
22
|
+
if (raw instanceof Date) return validateDateBounds(raw, options);
|
|
23
|
+
if (typeof raw !== "string") throw new Error(`Invalid date '${String(raw)}': expected an ISO-8601 string`);
|
|
24
|
+
const match = ISO_DATE_PATTERN.exec(raw);
|
|
25
|
+
if (match === null) throw new Error(`Invalid date '${raw}': expected ISO-8601 (e.g. 2026-07-10 or 2026-07-10T14:30:00Z)`);
|
|
26
|
+
const [, yearPart, monthPart, dayPart, hourPart, minutePart, secondPart] = match;
|
|
27
|
+
const year = Number(yearPart);
|
|
28
|
+
const month = Number(monthPart);
|
|
29
|
+
const day = Number(dayPart);
|
|
30
|
+
if (month < 1 || month > 12) throw new Error(`Invalid date '${raw}': month must be 01-12`);
|
|
31
|
+
if (day < 1 || day > daysInMonth(year, month)) throw new Error(`Invalid date '${raw}': not a real calendar date`);
|
|
32
|
+
if (hourPart !== void 0 && Number(hourPart) > 23) throw new Error(`Invalid date '${raw}': hours must be 00-23`);
|
|
33
|
+
if (minutePart !== void 0 && Number(minutePart) > 59) throw new Error(`Invalid date '${raw}': minutes must be 00-59`);
|
|
34
|
+
if (secondPart !== void 0 && Number(secondPart) > 59) throw new Error(`Invalid date '${raw}': seconds must be 00-59`);
|
|
35
|
+
const hasTime = match[4] !== void 0;
|
|
36
|
+
const hasOffset = match[8] !== void 0;
|
|
37
|
+
const parsed = new Date(hasTime && !hasOffset ? `${raw}Z` : raw);
|
|
38
|
+
if (Number.isNaN(parsed.getTime())) throw new Error(`Invalid date '${raw}'`);
|
|
39
|
+
return validateDateBounds(parsed, options, raw);
|
|
40
|
+
}
|
|
41
|
+
/** Number of days in a month (1-12), accounting for leap years. */
|
|
42
|
+
function daysInMonth(year, month) {
|
|
43
|
+
return new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
44
|
+
}
|
|
45
|
+
/** Enforce inclusive date bounds, throwing a human-readable error on violation. */
|
|
46
|
+
function validateDateBounds(value, options, raw) {
|
|
47
|
+
const display = raw ?? value.toISOString();
|
|
48
|
+
if (options?.min !== void 0 && value.getTime() < options.min.getTime()) throw new Error(`Date '${display}' is before the earliest allowed ${options.min.toISOString()}`);
|
|
49
|
+
if (options?.max !== void 0 && value.getTime() > options.max.getTime()) throw new Error(`Date '${display}' is after the latest allowed ${options.max.toISOString()}`);
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse a URL string into a `URL`, optionally restricting protocols.
|
|
54
|
+
*
|
|
55
|
+
* @param raw - Raw flag value.
|
|
56
|
+
* @param options - Optional protocol allowlist.
|
|
57
|
+
* @returns The parsed `URL`.
|
|
58
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
59
|
+
*/
|
|
60
|
+
function parseUrlValue(raw, options) {
|
|
61
|
+
if (typeof raw !== "string" && !(raw instanceof URL)) throw new Error(`Invalid URL '${String(raw)}': expected a URL string`);
|
|
62
|
+
let parsed;
|
|
63
|
+
try {
|
|
64
|
+
parsed = raw instanceof URL ? raw : new URL(raw);
|
|
65
|
+
} catch {
|
|
66
|
+
throw new Error(`Invalid URL '${String(raw)}'`);
|
|
67
|
+
}
|
|
68
|
+
if (options?.protocols !== void 0) {
|
|
69
|
+
const protocol = parsed.protocol.replace(/:$/, "");
|
|
70
|
+
if (!options.protocols.includes(protocol)) throw new Error(`URL protocol '${protocol}' is not allowed. Allowed: ${options.protocols.join(", ")}`);
|
|
71
|
+
}
|
|
72
|
+
return parsed;
|
|
73
|
+
}
|
|
74
|
+
/** Duration unit suffixes mapped to their length in milliseconds. */
|
|
75
|
+
const DURATION_UNITS = {
|
|
76
|
+
ms: 1,
|
|
77
|
+
s: 1e3,
|
|
78
|
+
m: 6e4,
|
|
79
|
+
h: 36e5,
|
|
80
|
+
d: 864e5
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Parse a human duration (`'30s'`, `'5m'`, `'1.5h'`, `'250ms'`, `'2d'`) into
|
|
84
|
+
* milliseconds. A bare number (`'1500'`) is treated as milliseconds. Compound
|
|
85
|
+
* values (`'1h30m'`) are supported.
|
|
86
|
+
*
|
|
87
|
+
* @param raw - Raw flag value.
|
|
88
|
+
* @returns Duration in milliseconds.
|
|
89
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
90
|
+
*/
|
|
91
|
+
function parseDurationValue(raw) {
|
|
92
|
+
if (typeof raw === "number") {
|
|
93
|
+
if (!Number.isFinite(raw) || raw < 0) throw new Error(`Invalid duration '${String(raw)}': must be a non-negative number`);
|
|
94
|
+
return raw;
|
|
95
|
+
}
|
|
96
|
+
if (typeof raw !== "string" || raw.length === 0) throw new Error(`Invalid duration '${String(raw)}': expected e.g. 30s, 5m, 1h30m, or 250ms`);
|
|
97
|
+
if (/^\d+(?:\.\d+)?$/.test(raw)) return Number(raw);
|
|
98
|
+
const segmentPattern = /(\d+(?:\.\d+)?)(ms|s|m|h|d)/gy;
|
|
99
|
+
let total = 0;
|
|
100
|
+
let consumed = 0;
|
|
101
|
+
for (const segment of raw.matchAll(segmentPattern)) {
|
|
102
|
+
const [text, amount, unit] = segment;
|
|
103
|
+
const scale = unit === void 0 ? void 0 : DURATION_UNITS[unit];
|
|
104
|
+
if (amount === void 0 || scale === void 0) break;
|
|
105
|
+
total += Number(amount) * scale;
|
|
106
|
+
consumed += text.length;
|
|
107
|
+
}
|
|
108
|
+
if (consumed !== raw.length || consumed === 0) throw new Error(`Invalid duration '${raw}': expected e.g. 30s, 5m, 1h30m, or 250ms`);
|
|
109
|
+
return total;
|
|
110
|
+
}
|
|
111
|
+
/** Byte unit suffixes mapped to their size (binary, 1 kb = 1024 bytes). */
|
|
112
|
+
const BYTE_UNITS = {
|
|
113
|
+
b: 1,
|
|
114
|
+
kb: 1024,
|
|
115
|
+
mb: 1024 ** 2,
|
|
116
|
+
gb: 1024 ** 3,
|
|
117
|
+
tb: 1024 ** 4
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Parse a human byte size (`'512mb'`, `'1.5gb'`, `'64kb'`, `'100b'`) into a
|
|
121
|
+
* byte count. Units are binary (`1kb` = 1024 bytes) and case-insensitive; a
|
|
122
|
+
* bare number is treated as bytes.
|
|
123
|
+
*
|
|
124
|
+
* @param raw - Raw flag value.
|
|
125
|
+
* @returns Size in bytes.
|
|
126
|
+
* @throws Error with a human-readable reason on invalid input.
|
|
127
|
+
*/
|
|
128
|
+
function parseBytesValue(raw) {
|
|
129
|
+
if (typeof raw === "number") {
|
|
130
|
+
if (!Number.isFinite(raw) || raw < 0) throw new Error(`Invalid size '${String(raw)}': must be a non-negative number`);
|
|
131
|
+
return raw;
|
|
132
|
+
}
|
|
133
|
+
if (typeof raw !== "string" || raw.length === 0) throw new Error(`Invalid size '${String(raw)}': expected e.g. 512mb, 1.5gb, or 64kb`);
|
|
134
|
+
const match = /^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb|tb)?$/i.exec(raw);
|
|
135
|
+
if (match === null || match[1] === void 0) throw new Error(`Invalid size '${raw}': expected e.g. 512mb, 1.5gb, or 64kb`);
|
|
136
|
+
const unit = (match[2] ?? "b").toLowerCase();
|
|
137
|
+
const scale = BYTE_UNITS[unit];
|
|
138
|
+
if (scale === void 0) throw new Error(`Invalid size '${raw}': unknown unit '${match[2] ?? ""}'`);
|
|
139
|
+
return Math.round(Number(match[1]) * scale);
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
export { parseBytesValue, parseDateValue, parseDurationValue, parseUrlValue };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RunOptions, RunResult } from "../schema/run.mjs";
|
|
2
2
|
import { RunnableCommand } from "../schema/command.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/core/testkit/index.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Run a command builder against the given argv with injected options.
|
|
@@ -24,35 +23,5 @@ import { RunnableCommand } from "../schema/command.mjs";
|
|
|
24
23
|
* @returns Structured run result with exit code and captured output
|
|
25
24
|
*/
|
|
26
25
|
declare function runCommand(cmd: RunnableCommand, argv: readonly string[], options?: RunOptions): Promise<RunResult>;
|
|
27
|
-
/**
|
|
28
|
-
* Options for {@linkcode runCommand} — process-free command execution.
|
|
29
|
-
*
|
|
30
|
-
* Every field is optional. Inject env, config, prompt answers, and
|
|
31
|
-
* output capture without touching process state.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* const result = await runCommand(cmd, ['--verbose'], {
|
|
36
|
-
* env: { LOG_LEVEL: 'debug' },
|
|
37
|
-
* config: { theme: 'dark' },
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
/**
|
|
42
|
-
* Structured result from {@linkcode runCommand}.
|
|
43
|
-
*
|
|
44
|
-
* Contains the exit code, captured stdout/stderr output, recorded
|
|
45
|
-
* {@linkcode ActivityEvent | activity events}, and an `error` field
|
|
46
|
-
* that is `undefined` on success and a {@linkcode CLIError} on failure.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* const result = await runCommand(greetCmd, ['World']);
|
|
51
|
-
*
|
|
52
|
-
* expect(result.exitCode).toBe(0);
|
|
53
|
-
* expect(result.stdout).toContain('Hello, World!');
|
|
54
|
-
* expect(result.error).toBeUndefined();
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
26
|
//#endregion
|
|
58
27
|
export { type RunOptions, type RunResult, runCommand };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createCaptureOutput } from "../output/index.mjs";
|
|
2
1
|
import { includesBeforeSeparator, stripBeforeSeparator } from "../parse/index.mjs";
|
|
2
|
+
import { createCaptureOutput } from "../output/index.mjs";
|
|
3
3
|
import { buildRunResult, executeCommand } from "../execution/index.mjs";
|
|
4
4
|
//#region src/core/testkit/index.ts
|
|
5
5
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ActivityEvent, Fallback, ProgressHandle, ProgressOptions, SpinnerHandle, SpinnerOptions, TableColumn, TableFormat, TableOptions, TableStream } from "./core/schema/activity.mjs";
|
|
2
2
|
import { NumberConstraintViolation, NumberConstraints } from "./core/schema/number-constraints.mjs";
|
|
3
|
+
import { InferStandardInput, InferStandardOutput, StandardSchemaV1, StandardSchemaV1FailureResult, StandardSchemaV1Issue, StandardSchemaV1Options, StandardSchemaV1PathSegment, StandardSchemaV1Props, StandardSchemaV1Result, StandardSchemaV1SuccessResult, StandardSchemaV1Types } from "./core/schema/standard.mjs";
|
|
3
4
|
import { ArgBuilder, ArgConfig, ArgFactory, ArgKind, ArgParseFn, ArgPresence, ArgSchema, InferArg, InferArgs, ResolvedArgValue, WithArgPresence, WithVariadic, arg, createArgSchema } from "./core/schema/arg.mjs";
|
|
4
5
|
import { ConfirmPromptConfig, InputPromptConfig, MultiselectPromptConfig, PromptConfig, PromptConfigBase, PromptKind, PromptResult, SelectChoice, SelectPromptConfig } from "./core/schema/prompt.mjs";
|
|
5
|
-
import {
|
|
6
|
+
import { StringConstraintViolation, StringConstraints } from "./core/schema/string-constraints.mjs";
|
|
7
|
+
import { DateFlagOptions, UrlFlagOptions } from "./core/schema/value-parsers.mjs";
|
|
8
|
+
import { DuplicatePolicy, FlagBuilder, FlagConfig, FlagFactory, FlagKind, FlagNegation, FlagParseFn, FlagPresence, FlagSchema, InferFlag, InferFlags, PathChecks, PathFlagOptions, ResolvedValue, WithPresence, createSchema, flag, getFlagNegatedName } from "./core/schema/flag.mjs";
|
|
6
9
|
import { Middleware, MiddlewareHandler, MiddlewareParams, middleware } from "./core/schema/middleware.mjs";
|
|
7
|
-
import { ParseResult, Token, parse, tokenize } from "./core/parse/index.mjs";
|
|
8
10
|
import { WriteFn } from "./core/output/writer.mjs";
|
|
9
11
|
import { Verbosity } from "./core/output/contracts.mjs";
|
|
10
12
|
import { OutputOptions, createOutput } from "./core/output/index.mjs";
|
|
@@ -13,11 +15,14 @@ import { DeprecationWarning, ResolveOptions, ResolveResult } from "./core/resolv
|
|
|
13
15
|
import { resolve } from "./core/resolve/index.mjs";
|
|
14
16
|
import { BeforeParseParams, CLIPlugin, CLIPluginHooks, PluginCommandContext, ResolvedCommandParams, plugin } from "./core/cli/plugin.mjs";
|
|
15
17
|
import { CLIError, CLIErrorJSON, CLIErrorOptions, ErrorCode, ParseError, ParseErrorCode, ParseErrorOptions, ValidationError, ValidationErrorCode, ValidationErrorOptions, isCLIError, isParseError, isValidationError } from "./core/errors/index.mjs";
|
|
18
|
+
import { HelpTheme, HelpThemeFactory } from "./core/help/theme.mjs";
|
|
16
19
|
import { osc8, visibleWidth } from "./core/help/ansi.mjs";
|
|
17
20
|
import { HelpOptions, formatHelp } from "./core/help/index.mjs";
|
|
18
21
|
import { RunResult } from "./core/schema/run.mjs";
|
|
19
|
-
import { ActionHandler, ActionParams, AnyCommandBuilder, CommandArgEntry, CommandBuilder, CommandConfig, CommandExample, CommandMeta, CommandSchema, DeriveHandler, DeriveParams, InteractiveParams, InteractiveResolver, InteractiveResult, Out, command, group } from "./core/schema/command.mjs";
|
|
20
|
-
import
|
|
22
|
+
import { ActionHandler, ActionParams, AnyCommandBuilder, CommandArgEntry, CommandBuilder, CommandConfig, CommandExample, CommandMeta, CommandSchema, DeriveHandler, DeriveParams, ExampleCommand, ExampleMeta, InteractiveParams, InteractiveResolver, InteractiveResult, Out, command, group, resolveExampleCommand } from "./core/schema/command.mjs";
|
|
23
|
+
import "./core/schema/index.mjs";
|
|
24
|
+
import { ParseOptions, ParseResult, Token, includesBeforeSeparator, parse, stripBeforeSeparator, tokenize } from "./core/parse/index.mjs";
|
|
25
|
+
import { ManifestDiscoveryOptions, PackageJsonAdapter, PackageJsonData, PackageRepository, PackageRepositoryUrlOptions, discoverManifest, discoverPackageJson, inferCliName, packageRepositoryUrl } from "./core/config/package-json.mjs";
|
|
21
26
|
import { HelpLinks } from "./core/cli/help-links.mjs";
|
|
22
27
|
import { CompletionOptions } from "./core/completion/shells/shared.mjs";
|
|
23
28
|
import { generateBashCompletion } from "./core/completion/shells/bash.mjs";
|
|
@@ -26,7 +31,7 @@ import { generatePowerShellCompletion } from "./core/completion/shells/powershel
|
|
|
26
31
|
import { generateZshCompletion } from "./core/completion/shells/zsh.mjs";
|
|
27
32
|
import { SHELLS, Shell, generateCompletion } from "./core/completion/index.mjs";
|
|
28
33
|
import { ConfigAdapter, ConfigDiscoveryOptions, ConfigDiscoveryResult, ConfigFound, ConfigNotFound, FormatLoader, buildConfigSearchPaths, configFormat, discoverConfig } from "./core/config/index.mjs";
|
|
29
|
-
import { CLIBuilder, CLIOptions, CLIRunOptions, CLISchema, ConfigSettings, InferNameOption, ManifestPresetSettings, ManifestSettings, PackageJsonSettings, ResolvedManifestSettings, cli } from "./core/cli/index.mjs";
|
|
30
|
-
import { JsonSchemaOptions, definitionMetaSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
|
|
34
|
+
import { CLIBuilder, CLIOptions, CLIRunOptions, CLISchema, ConfigSettings, DefaultCommandOptions, InferNameOption, ManifestPresetSettings, ManifestSettings, PackageJsonSettings, RenderContext, RenderContextOptions, ResolvedManifestSettings, cli, isMainModule, resolveRenderContext } from "./core/cli/index.mjs";
|
|
35
|
+
import { JsonSchemaOptions, definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
|
|
31
36
|
import { Colors } from "ansispeck";
|
|
32
|
-
export { type ActionHandler, type ActionParams, type ActivityEvent, type AnyCommandBuilder, ArgBuilder, type ArgConfig, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type BeforeParseParams, CLIBuilder, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type Colors, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type CompletionOptions, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSettings, type ConfirmPromptConfig, type DeprecationWarning, type DeriveHandler, type DeriveParams, type ErrorCode, type Fallback, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagParseFn, type FlagPresence, type FlagSchema, type FormatLoader, type HelpLinks, type HelpOptions, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferNameOption, type InputPromptConfig, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type ManifestDiscoveryOptions, type ManifestPresetSettings, type ManifestSettings, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberConstraintViolation, type NumberConstraints, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageJsonSettings, type PackageRepository, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseResult, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptConfig, type PromptConfigBase, type PromptEngine, type PromptKind, type PromptResult, type ReadFn, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedManifestSettings, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, type SelectChoice, type SelectPromptConfig, type Shell, type SpinnerHandle, type SpinnerOptions, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WriteFn, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, group, inferCliName, isCLIError, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolvePromptConfig, tokenize, visibleWidth };
|
|
37
|
+
export { type ActionHandler, type ActionParams, type ActivityEvent, type AnyCommandBuilder, ArgBuilder, type ArgConfig, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type BeforeParseParams, CLIBuilder, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type Colors, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type CompletionOptions, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSettings, type ConfirmPromptConfig, type DateFlagOptions, type DefaultCommandOptions, type DeprecationWarning, type DeriveHandler, type DeriveParams, type DuplicatePolicy, type ErrorCode, type ExampleCommand, type ExampleMeta, type Fallback, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagNegation, type FlagParseFn, type FlagPresence, type FlagSchema, type FormatLoader, type HelpLinks, type HelpOptions, type HelpTheme, type HelpThemeFactory, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferNameOption, type InferStandardInput, type InferStandardOutput, type InputPromptConfig, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type ManifestDiscoveryOptions, type ManifestPresetSettings, type ManifestSettings, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberConstraintViolation, type NumberConstraints, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageJsonSettings, type PackageRepository, type PackageRepositoryUrlOptions, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseOptions, type ParseResult, type PathChecks, type PathFlagOptions, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptConfig, type PromptConfigBase, type PromptEngine, type PromptKind, type PromptResult, type ReadFn, type RenderContext, type RenderContextOptions, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedManifestSettings, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, type SelectChoice, type SelectPromptConfig, type Shell, type SpinnerHandle, type SpinnerOptions, type StandardSchemaV1, type StandardSchemaV1FailureResult, type StandardSchemaV1Issue, type StandardSchemaV1Options, type StandardSchemaV1PathSegment, type StandardSchemaV1Props, type StandardSchemaV1Result, type StandardSchemaV1SuccessResult, type StandardSchemaV1Types, type StringConstraintViolation, type StringConstraints, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, type UrlFlagOptions, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WriteFn, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCommandSchema, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, includesBeforeSeparator, inferCliName, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolveExampleCommand, resolvePromptConfig, resolveRenderContext, stripBeforeSeparator, tokenize, visibleWidth };
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CLIError, ParseError, ValidationError, isCLIError, isParseError, isValidationError } from "./core/errors/index.mjs";
|
|
2
|
+
import { FlagBuilder, createSchema, flag, getFlagNegatedName } from "./core/schema/flag.mjs";
|
|
3
|
+
import { ArgBuilder, arg, createArgSchema } from "./core/schema/arg.mjs";
|
|
4
|
+
import { CommandBuilder, command, group, resolveExampleCommand } from "./core/schema/command.mjs";
|
|
5
|
+
import { middleware } from "./core/schema/middleware.mjs";
|
|
6
|
+
import { includesBeforeSeparator, parse, stripBeforeSeparator, tokenize } from "./core/parse/index.mjs";
|
|
2
7
|
import { generateBashCompletion } from "./core/completion/shells/bash.mjs";
|
|
3
8
|
import { generateFishCompletion } from "./core/completion/shells/fish.mjs";
|
|
4
9
|
import { generatePowerShellCompletion } from "./core/completion/shells/powershell.mjs";
|
|
5
|
-
import { CLIError, ParseError, ValidationError, isCLIError, isParseError, isValidationError } from "./core/errors/index.mjs";
|
|
6
10
|
import { generateZshCompletion } from "./core/completion/shells/zsh.mjs";
|
|
7
11
|
import { SHELLS, generateCompletion } from "./core/completion/index.mjs";
|
|
8
12
|
import { osc8, visibleWidth } from "./core/help/ansi.mjs";
|
|
9
13
|
import { formatHelp } from "./core/help/index.mjs";
|
|
14
|
+
import { definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
|
|
10
15
|
import { createOutput } from "./core/output/index.mjs";
|
|
11
|
-
import { ArgBuilder, arg, createArgSchema } from "./core/schema/arg.mjs";
|
|
12
|
-
import { CommandBuilder, command, group } from "./core/schema/command.mjs";
|
|
13
|
-
import { middleware } from "./core/schema/middleware.mjs";
|
|
14
|
-
import { parse, tokenize } from "./core/parse/index.mjs";
|
|
15
16
|
import { createTerminalPrompter, resolvePromptConfig } from "./core/prompt/index.mjs";
|
|
16
17
|
import { resolve } from "./core/resolve/index.mjs";
|
|
17
18
|
import { discoverManifest, discoverPackageJson, inferCliName, packageRepositoryUrl } from "./core/config/package-json.mjs";
|
|
18
19
|
import { plugin } from "./core/cli/plugin.mjs";
|
|
19
20
|
import { buildConfigSearchPaths, configFormat, discoverConfig } from "./core/config/index.mjs";
|
|
20
|
-
import { CLIBuilder, cli } from "./core/cli/index.mjs";
|
|
21
|
-
|
|
22
|
-
export { ArgBuilder, CLIBuilder, CLIError, CommandBuilder, FlagBuilder, ParseError, SHELLS, ValidationError, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, group, inferCliName, isCLIError, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolvePromptConfig, tokenize, visibleWidth };
|
|
21
|
+
import { CLIBuilder, cli, isMainModule, resolveRenderContext } from "./core/cli/index.mjs";
|
|
22
|
+
export { ArgBuilder, CLIBuilder, CLIError, CommandBuilder, FlagBuilder, ParseError, SHELLS, ValidationError, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCommandSchema, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, includesBeforeSeparator, inferCliName, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolveExampleCommand, resolvePromptConfig, resolveRenderContext, stripBeforeSeparator, tokenize, visibleWidth };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WriteFn } from "../core/output/writer.mjs";
|
|
2
|
+
import "../core/output/index.mjs";
|
|
2
3
|
import { ReadFn } from "../core/prompt/index.mjs";
|
|
3
|
-
|
|
4
4
|
//#region src/runtime/adapter.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Runtime adapter interface.
|
|
@@ -62,6 +62,10 @@ interface RuntimeAdapter {
|
|
|
62
62
|
readonly isTTY: boolean;
|
|
63
63
|
/** Whether stdin is connected to a TTY (used for prompt gating). */
|
|
64
64
|
readonly stdinIsTTY: boolean;
|
|
65
|
+
/** Read current terminal dimensions for stdout, if available. */
|
|
66
|
+
readonly getTerminalSize: () => TerminalSize | undefined;
|
|
67
|
+
/** Subscribe to terminal resize events when the runtime supports them. */
|
|
68
|
+
readonly onTerminalResize: (listener: () => void) => (() => void) | undefined;
|
|
65
69
|
/**
|
|
66
70
|
* Exit the process with the given code.
|
|
67
71
|
* Must not return (divergent function).
|
|
@@ -78,6 +82,24 @@ interface RuntimeAdapter {
|
|
|
78
82
|
* Used by config file discovery to probe multiple candidate paths.
|
|
79
83
|
*/
|
|
80
84
|
readonly readFile: (path: string) => Promise<string | null>;
|
|
85
|
+
/**
|
|
86
|
+
* Probe what exists at a filesystem path.
|
|
87
|
+
*
|
|
88
|
+
* Returns `'file'` or `'directory'` for existing paths (other kinds such
|
|
89
|
+
* as sockets report `'file'`), or `null` when nothing exists there.
|
|
90
|
+
*
|
|
91
|
+
* Used by `flag.path()` existence/type checks after resolution.
|
|
92
|
+
*/
|
|
93
|
+
readonly stat: (path: string) => Promise<'file' | 'directory' | null>;
|
|
94
|
+
/**
|
|
95
|
+
* Create a directory, including missing parents.
|
|
96
|
+
*
|
|
97
|
+
* Succeeds when the directory already exists. Throws on other I/O errors
|
|
98
|
+
* (permission denied, existing file at the path, etc.).
|
|
99
|
+
*
|
|
100
|
+
* Used by `flag.path()` `create` checks after resolution.
|
|
101
|
+
*/
|
|
102
|
+
readonly mkdir: (path: string) => Promise<void>;
|
|
81
103
|
/**
|
|
82
104
|
* User home directory (absolute path).
|
|
83
105
|
*
|
|
@@ -94,6 +116,28 @@ interface RuntimeAdapter {
|
|
|
94
116
|
* Config discovery appends the app-specific subdirectory.
|
|
95
117
|
*/
|
|
96
118
|
readonly configDir: string;
|
|
119
|
+
/**
|
|
120
|
+
* User-scope config roots for discovery, highest priority first.
|
|
121
|
+
*
|
|
122
|
+
* - Unix: `[configDir]`
|
|
123
|
+
* - macOS: `[configDir, ~/Library/Application Support]`
|
|
124
|
+
* - Windows: `[configDir]`
|
|
125
|
+
*
|
|
126
|
+
* When absent, discovery falls back to `[configDir]`.
|
|
127
|
+
*/
|
|
128
|
+
readonly userConfigDirs?: readonly string[];
|
|
129
|
+
/**
|
|
130
|
+
* System-scope config roots for discovery (`['/etc']` on Linux and
|
|
131
|
+
* macOS, `[]` on Windows). When absent, discovery probes none.
|
|
132
|
+
*/
|
|
133
|
+
readonly systemConfigDirs?: readonly string[];
|
|
134
|
+
}
|
|
135
|
+
/** Current terminal dimensions in columns and rows. */
|
|
136
|
+
interface TerminalSize {
|
|
137
|
+
/** Terminal width in columns. */
|
|
138
|
+
readonly columns: number;
|
|
139
|
+
/** Terminal height in rows. */
|
|
140
|
+
readonly rows: number;
|
|
97
141
|
}
|
|
98
142
|
/**
|
|
99
143
|
* Options for creating a test adapter.
|
|
@@ -138,6 +182,10 @@ interface TestAdapterOptions {
|
|
|
138
182
|
readonly isTTY?: boolean;
|
|
139
183
|
/** TTY flag for stdin (defaults to `false`). */
|
|
140
184
|
readonly stdinIsTTY?: boolean;
|
|
185
|
+
/** Terminal dimensions returned by `getTerminalSize()`. */
|
|
186
|
+
readonly terminalSize?: TerminalSize;
|
|
187
|
+
/** Resize subscription hook returned by `onTerminalResize()`. */
|
|
188
|
+
readonly onTerminalResize?: (listener: () => void) => (() => void) | undefined;
|
|
141
189
|
/**
|
|
142
190
|
* Exit function (defaults to throwing {@linkcode ExitError}).
|
|
143
191
|
* The default throw-based exit allows tests to catch the exit code.
|
|
@@ -158,10 +206,31 @@ interface TestAdapterOptions {
|
|
|
158
206
|
* ```
|
|
159
207
|
*/
|
|
160
208
|
readonly readFile?: (path: string) => Promise<string | null>;
|
|
209
|
+
/**
|
|
210
|
+
* Filesystem probe stub for `flag.path()` checks (defaults to returning
|
|
211
|
+
* `null` — nothing exists).
|
|
212
|
+
*
|
|
213
|
+
* Supply a custom function to simulate a virtual filesystem in tests:
|
|
214
|
+
* ```ts
|
|
215
|
+
* createTestAdapter({
|
|
216
|
+
* stat: (path) => Promise.resolve(path === '/data' ? 'directory' : null),
|
|
217
|
+
* })
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
readonly stat?: (path: string) => Promise<'file' | 'directory' | null>;
|
|
221
|
+
/**
|
|
222
|
+
* Directory creation stub for `flag.path()` `create` checks (defaults to
|
|
223
|
+
* a noop that resolves without creating anything).
|
|
224
|
+
*/
|
|
225
|
+
readonly mkdir?: (path: string) => Promise<void>;
|
|
161
226
|
/** Home directory (defaults to `'/home/test'`). */
|
|
162
227
|
readonly homedir?: string;
|
|
163
228
|
/** Config directory (defaults to `'/home/test/.config'`). */
|
|
164
229
|
readonly configDir?: string;
|
|
230
|
+
/** User-scope config roots for discovery (defaults to `[configDir]`). */
|
|
231
|
+
readonly userConfigDirs?: readonly string[];
|
|
232
|
+
/** System-scope config roots for discovery (defaults to `[]`). */
|
|
233
|
+
readonly systemConfigDirs?: readonly string[];
|
|
165
234
|
}
|
|
166
235
|
/**
|
|
167
236
|
* Error thrown by adapter implementations that model process exit as an
|
|
@@ -209,4 +278,4 @@ declare class ExitError extends Error {
|
|
|
209
278
|
*/
|
|
210
279
|
declare function createTestAdapter(options?: TestAdapterOptions): RuntimeAdapter;
|
|
211
280
|
//#endregion
|
|
212
|
-
export { ExitError, type RuntimeAdapter, type TestAdapterOptions, createTestAdapter };
|
|
281
|
+
export { ExitError, type RuntimeAdapter, type TerminalSize, type TestAdapterOptions, createTestAdapter };
|
package/dist/runtime/adapter.mjs
CHANGED
|
@@ -32,6 +32,10 @@ const noopWrite = () => {};
|
|
|
32
32
|
const eofRead = () => Promise.resolve(null);
|
|
33
33
|
/** Noop file reader — returns `null` (not found) for all paths. */
|
|
34
34
|
const noopReadFile = () => Promise.resolve(null);
|
|
35
|
+
/** Noop stat — reports `null` (nothing exists) for all paths. */
|
|
36
|
+
const noopStat = () => Promise.resolve(null);
|
|
37
|
+
/** Noop mkdir — resolves without creating anything. */
|
|
38
|
+
const noopMkdir = () => Promise.resolve();
|
|
35
39
|
/**
|
|
36
40
|
* Create a test runtime adapter with injectable process state.
|
|
37
41
|
*
|
|
@@ -70,12 +74,18 @@ function createTestAdapter(options) {
|
|
|
70
74
|
},
|
|
71
75
|
isTTY: options?.isTTY ?? false,
|
|
72
76
|
stdinIsTTY,
|
|
77
|
+
getTerminalSize: () => options?.terminalSize,
|
|
78
|
+
onTerminalResize: (listener) => options?.onTerminalResize?.(listener),
|
|
73
79
|
exit: options?.exit ?? ((code) => {
|
|
74
80
|
throw new ExitError(code);
|
|
75
81
|
}),
|
|
76
82
|
readFile: options?.readFile ?? noopReadFile,
|
|
83
|
+
stat: options?.stat ?? noopStat,
|
|
84
|
+
mkdir: options?.mkdir ?? noopMkdir,
|
|
77
85
|
homedir: options?.homedir ?? "/home/test",
|
|
78
|
-
configDir: options?.configDir ?? "/home/test/.config"
|
|
86
|
+
configDir: options?.configDir ?? "/home/test/.config",
|
|
87
|
+
userConfigDirs: options?.userConfigDirs ?? [options?.configDir ?? "/home/test/.config"],
|
|
88
|
+
systemConfigDirs: options?.systemConfigDirs ?? []
|
|
79
89
|
};
|
|
80
90
|
}
|
|
81
91
|
//#endregion
|
package/dist/runtime/auto.d.mts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { RuntimeAdapter } from "./adapter.mjs";
|
|
2
2
|
import { GlobalForDetect } from "./detect.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/runtime/auto.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Create a runtime adapter for the current environment.
|
|
7
6
|
*
|
|
8
7
|
* Detection order follows {@link detectRuntime}: Bun → Deno → Node → unknown.
|
|
9
|
-
*
|
|
10
|
-
* expose a Node-compatible `process` global.
|
|
8
|
+
* Only Deno needs a distinct adapter; Bun, Node, and unknown runtimes all use
|
|
9
|
+
* the Node adapter because they expose a Node-compatible `process` global.
|
|
11
10
|
*
|
|
12
11
|
* @param globals - Override `globalThis` for testing. Production callers
|
|
13
12
|
* should omit this parameter.
|
package/dist/runtime/auto.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { createNodeAdapter } from "./node.mjs";
|
|
2
|
-
import { createBunAdapter } from "./bun.mjs";
|
|
3
1
|
import { createDenoAdapter } from "./deno.mjs";
|
|
4
2
|
import { detectRuntime } from "./detect.mjs";
|
|
3
|
+
import { createNodeAdapter } from "./node.mjs";
|
|
5
4
|
//#region src/runtime/auto.ts
|
|
6
5
|
function isDenoNamespace(value) {
|
|
7
6
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -16,8 +15,8 @@ function getInjectedDenoNamespace(globals) {
|
|
|
16
15
|
* Create a runtime adapter for the current environment.
|
|
17
16
|
*
|
|
18
17
|
* Detection order follows {@link detectRuntime}: Bun → Deno → Node → unknown.
|
|
19
|
-
*
|
|
20
|
-
* expose a Node-compatible `process` global.
|
|
18
|
+
* Only Deno needs a distinct adapter; Bun, Node, and unknown runtimes all use
|
|
19
|
+
* the Node adapter because they expose a Node-compatible `process` global.
|
|
21
20
|
*
|
|
22
21
|
* @param globals - Override `globalThis` for testing. Production callers
|
|
23
22
|
* should omit this parameter.
|
|
@@ -35,8 +34,8 @@ function createAdapter(globals) {
|
|
|
35
34
|
const runtimeGlobals = globals ?? globalThis;
|
|
36
35
|
const runtime = detectRuntime(runtimeGlobals);
|
|
37
36
|
switch (runtime) {
|
|
38
|
-
case "bun": return createBunAdapter();
|
|
39
37
|
case "deno": return createDenoAdapter(getInjectedDenoNamespace(runtimeGlobals));
|
|
38
|
+
case "bun":
|
|
40
39
|
case "node":
|
|
41
40
|
case "unknown": return createNodeAdapter();
|
|
42
41
|
default: return runtime;
|