@mks2508/better-logger 0.14.0-alpha.2 → 0.18.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -244
- package/dist/Logger.d.ts +662 -202
- package/dist/Logger.d.ts.map +1 -1
- package/dist/ScopedLogger.d.ts +434 -175
- package/dist/ScopedLogger.d.ts.map +1 -1
- package/dist/chunks/HookBridge-C-AvXmPD.cjs +504 -0
- package/dist/chunks/HookBridge-C-AvXmPD.cjs.map +1 -0
- package/dist/chunks/HookBridge-CI2PH79S.js +487 -0
- package/dist/chunks/HookBridge-CI2PH79S.js.map +1 -0
- package/dist/chunks/LogContext-BaMXleWj.cjs +105 -0
- package/dist/chunks/LogContext-BaMXleWj.cjs.map +1 -0
- package/dist/chunks/LogContext-DjlITOzZ.js +100 -0
- package/dist/chunks/LogContext-DjlITOzZ.js.map +1 -0
- package/dist/chunks/SerializerBridge-Ba43Mk7j.js +393 -0
- package/dist/chunks/SerializerBridge-Ba43Mk7j.js.map +1 -0
- package/dist/chunks/SerializerBridge-C4a9Z37F.cjs +410 -0
- package/dist/chunks/SerializerBridge-C4a9Z37F.cjs.map +1 -0
- package/dist/chunks/StyleManager-DQ6UNRB-.cjs +118 -0
- package/dist/chunks/StyleManager-DQ6UNRB-.cjs.map +1 -0
- package/dist/chunks/StyleManager-DjwAYbxE.js +113 -0
- package/dist/chunks/StyleManager-DjwAYbxE.js.map +1 -0
- package/dist/chunks/core-Blfi2klP.js +31 -0
- package/dist/chunks/core-Blfi2klP.js.map +1 -0
- package/dist/chunks/core-CqS_UBzJ.cjs +36 -0
- package/dist/chunks/core-CqS_UBzJ.cjs.map +1 -0
- package/dist/chunks/environment-detector-7NvnYUfr.js +110 -0
- package/dist/chunks/environment-detector-7NvnYUfr.js.map +1 -0
- package/dist/chunks/environment-detector-D-tHkKWA.cjs +163 -0
- package/dist/chunks/environment-detector-D-tHkKWA.cjs.map +1 -0
- package/dist/chunks/server-fallback-CaCPjWby.cjs +119 -0
- package/dist/chunks/server-fallback-CaCPjWby.cjs.map +1 -0
- package/dist/chunks/server-fallback-jj0T6XaK.js +114 -0
- package/dist/chunks/server-fallback-jj0T6XaK.js.map +1 -0
- package/dist/chunks/spinner-BHyYEXsM.cjs +1029 -0
- package/dist/chunks/spinner-BHyYEXsM.cjs.map +1 -0
- package/dist/chunks/spinner-BtkwpzYv.js +982 -0
- package/dist/chunks/spinner-BtkwpzYv.js.map +1 -0
- package/dist/chunks/styling-CRw3KQW4.js +1592 -0
- package/dist/chunks/styling-CRw3KQW4.js.map +1 -0
- package/dist/chunks/styling-Cel2wPRy.cjs +1645 -0
- package/dist/chunks/styling-Cel2wPRy.cjs.map +1 -0
- package/dist/chunks/transports-BGfwwakw.js +1237 -0
- package/dist/chunks/transports-BGfwwakw.js.map +1 -0
- package/dist/chunks/transports-yK6CL0Ml.cjs +1278 -0
- package/dist/chunks/transports-yK6CL0Ml.cjs.map +1 -0
- package/dist/chunks/utils-W_cxqriN.cjs +705 -0
- package/dist/chunks/utils-W_cxqriN.cjs.map +1 -0
- package/dist/chunks/utils-tKfBAWUM.js +586 -0
- package/dist/chunks/utils-tKfBAWUM.js.map +1 -0
- package/dist/cli/CommandProcessor.d.ts +166 -19
- package/dist/cli/CommandProcessor.d.ts.map +1 -1
- package/dist/cli/commands/ConfigCommand.d.ts +36 -1
- package/dist/cli/commands/ConfigCommand.d.ts.map +1 -1
- package/dist/cli/commands/ExportCommand.d.ts +54 -26
- package/dist/cli/commands/ExportCommand.d.ts.map +1 -1
- package/dist/cli/commands/ThemeCommand.d.ts +62 -3
- package/dist/cli/commands/ThemeCommand.d.ts.map +1 -1
- package/dist/cli/help.d.ts +30 -2
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/index.d.ts +30 -4
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli-module.d.ts +13 -0
- package/dist/cli-module.d.ts.map +1 -0
- package/dist/cli.cjs +11 -0
- package/dist/cli.js +3 -0
- package/dist/constants.d.ts +16 -47
- package/dist/constants.d.ts.map +1 -1
- package/dist/context/LogContext.d.ts +245 -0
- package/dist/context/LogContext.d.ts.map +1 -0
- package/dist/context/index.d.ts +6 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context-module.d.ts +6 -0
- package/dist/context-module.d.ts.map +1 -0
- package/dist/context.cjs +3 -0
- package/dist/context.js +2 -0
- package/dist/core.cjs +304 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +56 -34
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +281 -314
- package/dist/core.js.map +1 -1
- package/dist/hooks/HookBridge.d.ts +32 -0
- package/dist/hooks/HookBridge.d.ts.map +1 -0
- package/dist/hooks/HookManager.d.ts +319 -0
- package/dist/hooks/HookManager.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks-module.d.ts +7 -0
- package/dist/hooks-module.d.ts.map +1 -0
- package/dist/hooks.cjs +5 -0
- package/dist/hooks.js +2 -0
- package/dist/index.cjs +3402 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +42 -130
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3327 -158
- package/dist/index.js.map +1 -1
- package/dist/node-module.d.ts +10 -0
- package/dist/node-module.d.ts.map +1 -0
- package/dist/node.cjs +13 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.js +12 -0
- package/dist/node.js.map +1 -0
- package/dist/playground/TerminalBridge.d.ts +53 -0
- package/dist/playground/TerminalBridge.d.ts.map +1 -0
- package/dist/playground/box.d.ts +45 -0
- package/dist/playground/box.d.ts.map +1 -0
- package/dist/playground/cli-table.d.ts +50 -0
- package/dist/playground/cli-table.d.ts.map +1 -0
- package/dist/playground/divider.d.ts +29 -0
- package/dist/playground/divider.d.ts.map +1 -0
- package/dist/playground/header.d.ts +28 -0
- package/dist/playground/header.d.ts.map +1 -0
- package/dist/playground/index.d.ts +11 -0
- package/dist/playground/index.d.ts.map +1 -0
- package/dist/playground/server-fallback.d.ts +114 -0
- package/dist/playground/server-fallback.d.ts.map +1 -0
- package/dist/playground/spinner.d.ts +197 -0
- package/dist/playground/spinner.d.ts.map +1 -0
- package/dist/playground/step.d.ts +33 -0
- package/dist/playground/step.d.ts.map +1 -0
- package/dist/playground-module.d.ts +11 -0
- package/dist/playground-module.d.ts.map +1 -0
- package/dist/playground.cjs +9 -0
- package/dist/playground.js +2 -0
- package/dist/serializers/SerializerBridge.d.ts +28 -0
- package/dist/serializers/SerializerBridge.d.ts.map +1 -0
- package/dist/serializers/SerializerRegistry.d.ts +252 -0
- package/dist/serializers/SerializerRegistry.d.ts.map +1 -0
- package/dist/serializers/index.d.ts +7 -0
- package/dist/serializers/index.d.ts.map +1 -0
- package/dist/serializers-module.d.ts +7 -0
- package/dist/serializers-module.d.ts.map +1 -0
- package/dist/serializers.cjs +5 -0
- package/dist/serializers.js +2 -0
- package/dist/styles/StyleManager.d.ts +190 -0
- package/dist/styles/StyleManager.d.ts.map +1 -0
- package/dist/styles/index.d.ts +7 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles-module.d.ts +7 -0
- package/dist/styles-module.d.ts.map +1 -0
- package/dist/styles.cjs +7 -0
- package/dist/styles.js +3 -0
- package/dist/styling/SmartPresets.d.ts +100 -6
- package/dist/styling/SmartPresets.d.ts.map +1 -1
- package/dist/styling/StyleBuilder.d.ts +453 -32
- package/dist/styling/StyleBuilder.d.ts.map +1 -1
- package/dist/styling/banners.d.ts +85 -5
- package/dist/styling/banners.d.ts.map +1 -1
- package/dist/styling/index.d.ts +8 -3
- package/dist/styling/index.d.ts.map +1 -1
- package/dist/styling/themes.d.ts +41 -2
- package/dist/styling/themes.d.ts.map +1 -1
- package/dist/terminal/color-converter.d.ts +73 -0
- package/dist/terminal/color-converter.d.ts.map +1 -0
- package/dist/terminal/formatter.d.ts +23 -0
- package/dist/terminal/formatter.d.ts.map +1 -0
- package/dist/transports/ConsoleTransport.d.ts +104 -0
- package/dist/transports/ConsoleTransport.d.ts.map +1 -0
- package/dist/transports/FileTransport.d.ts +137 -0
- package/dist/transports/FileTransport.d.ts.map +1 -0
- package/dist/transports/HttpTransport.d.ts +180 -0
- package/dist/transports/HttpTransport.d.ts.map +1 -0
- package/dist/transports/OtlpTransport.d.ts +165 -0
- package/dist/transports/OtlpTransport.d.ts.map +1 -0
- package/dist/transports/TransportBridge.d.ts +43 -0
- package/dist/transports/TransportBridge.d.ts.map +1 -0
- package/dist/transports/TransportManager.d.ts +251 -0
- package/dist/transports/TransportManager.d.ts.map +1 -0
- package/dist/transports/index.d.ts +6 -0
- package/dist/transports/index.d.ts.map +1 -0
- package/dist/transports-module.d.ts +10 -0
- package/dist/transports-module.d.ts.map +1 -0
- package/dist/transports.cjs +7 -0
- package/dist/transports.js +2 -0
- package/dist/types/core.d.ts +295 -17
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/handlers.d.ts +0 -67
- package/dist/types/handlers.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +138 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/serializers.d.ts +97 -0
- package/dist/types/serializers.d.ts.map +1 -0
- package/dist/types/transports.d.ts +132 -0
- package/dist/types/transports.d.ts.map +1 -0
- package/dist/utils/ansi-colors.d.ts +115 -0
- package/dist/utils/ansi-colors.d.ts.map +1 -0
- package/dist/utils/environment-detector.d.ts +53 -0
- package/dist/utils/environment-detector.d.ts.map +1 -0
- package/dist/utils/formatting.d.ts +9 -8
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/output.d.ts +14 -17
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/stackTrace.d.ts +2 -2
- package/dist/utils/stackTrace.d.ts.map +1 -1
- package/dist/utils/timestamps.d.ts +0 -12
- package/dist/utils/timestamps.d.ts.map +1 -1
- package/package.json +95 -21
- package/.claude/settings.local.json +0 -39
- package/.github/workflows/ci-quality.yml +0 -357
- package/.github/workflows/docs-demo.yml +0 -119
- package/.github/workflows/releases-core.yml +0 -512
- package/.github/workflows/releases-full.yml +0 -582
- package/.github/workflows-backup/ci.yml +0 -221
- package/.github/workflows-backup/nightly.yml +0 -196
- package/.github/workflows-backup/release-optimized.yml +0 -373
- package/.github/workflows-backup/release.yml +0 -269
- package/.release-notes-0.2.0.md +0 -129
- package/.yamllint +0 -28
- package/CHANGELOG.json +0 -865
- package/CLAUDE.md +0 -204
- package/bun.lock +0 -323
- package/demo.html +0 -847
- package/dist/.tsbuildinfo +0 -1
- package/dist/Logger.js +0 -1124
- package/dist/ScopedLogger.js +0 -426
- package/dist/chunks/Logger-Crw1woqR.js +0 -3464
- package/dist/chunks/Logger-Crw1woqR.js.map +0 -1
- package/dist/chunks/Logger-D_p3xnbq.js +0 -2
- package/dist/chunks/Logger-D_p3xnbq.js.map +0 -1
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +0 -33
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +0 -1
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +0 -2
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +0 -1
- package/dist/chunks/environment-Bxbnw4pd.js +0 -544
- package/dist/chunks/environment-Bxbnw4pd.js.map +0 -1
- package/dist/chunks/environment-Dm66zOML.js +0 -4
- package/dist/chunks/environment-Dm66zOML.js.map +0 -1
- package/dist/chunks/formatting-C0riPC5_.js +0 -95
- package/dist/chunks/formatting-C0riPC5_.js.map +0 -1
- package/dist/chunks/formatting-DNCAV66-.js +0 -2
- package/dist/chunks/formatting-DNCAV66-.js.map +0 -1
- package/dist/cli/CommandProcessor.js +0 -184
- package/dist/cli/commands/ConfigCommand.js +0 -88
- package/dist/cli/commands/ExportCommand.js +0 -243
- package/dist/cli/commands/HistoryCommand.d.ts +0 -50
- package/dist/cli/commands/HistoryCommand.d.ts.map +0 -1
- package/dist/cli/commands/HistoryCommand.js +0 -96
- package/dist/cli/commands/StatusCommand.d.ts +0 -33
- package/dist/cli/commands/StatusCommand.d.ts.map +0 -1
- package/dist/cli/commands/StatusCommand.js +0 -93
- package/dist/cli/commands/ThemeCommand.js +0 -79
- package/dist/cli/help.js +0 -118
- package/dist/cli/index.js +0 -46
- package/dist/constants.js +0 -159
- package/dist/example.d.ts +0 -18
- package/dist/example.d.ts.map +0 -1
- package/dist/example.js +0 -154
- package/dist/exports-module.d.ts +0 -203
- package/dist/exports-module.d.ts.map +0 -1
- package/dist/exports-module.js +0 -260
- package/dist/exports.cjs +0 -2
- package/dist/exports.cjs.map +0 -1
- package/dist/exports.js +0 -238
- package/dist/exports.js.map +0 -1
- package/dist/handlers/AnalyticsLogHandler.d.ts +0 -11
- package/dist/handlers/AnalyticsLogHandler.d.ts.map +0 -1
- package/dist/handlers/AnalyticsLogHandler.js +0 -19
- package/dist/handlers/ExportLogHandler.d.ts +0 -103
- package/dist/handlers/ExportLogHandler.d.ts.map +0 -1
- package/dist/handlers/ExportLogHandler.js +0 -516
- package/dist/handlers/FileLogHandler.d.ts +0 -36
- package/dist/handlers/FileLogHandler.d.ts.map +0 -1
- package/dist/handlers/FileLogHandler.js +0 -156
- package/dist/handlers/RemoteLogHandler.d.ts +0 -14
- package/dist/handlers/RemoteLogHandler.d.ts.map +0 -1
- package/dist/handlers/RemoteLogHandler.js +0 -37
- package/dist/handlers/index.d.ts +0 -8
- package/dist/handlers/index.d.ts.map +0 -1
- package/dist/handlers/index.js +0 -7
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -139
- package/dist/styling/LogStyleBuilder.d.ts +0 -149
- package/dist/styling/LogStyleBuilder.d.ts.map +0 -1
- package/dist/styling/LogStyleBuilder.js +0 -289
- package/dist/styling/SemanticStyles.d.ts +0 -181
- package/dist/styling/SemanticStyles.d.ts.map +0 -1
- package/dist/styling/SemanticStyles.js +0 -339
- package/dist/styling/SmartPresets.js +0 -276
- package/dist/styling/StyleBuilder.js +0 -280
- package/dist/styling/banners.js +0 -155
- package/dist/styling/index.js +0 -9
- package/dist/styling/themes.js +0 -231
- package/dist/styling-module.d.ts +0 -185
- package/dist/styling-module.d.ts.map +0 -1
- package/dist/styling-module.js +0 -199
- package/dist/styling.cjs +0 -2
- package/dist/styling.cjs.map +0 -1
- package/dist/styling.js +0 -146
- package/dist/styling.js.map +0 -1
- package/dist/types/Logger.d.ts +0 -700
- package/dist/types/Logger.d.ts.map +0 -1
- package/dist/types/ScopedLogger.d.ts +0 -310
- package/dist/types/ScopedLogger.d.ts.map +0 -1
- package/dist/types/cli/CommandProcessor.d.ts +0 -100
- package/dist/types/cli/CommandProcessor.d.ts.map +0 -1
- package/dist/types/cli/commands/ConfigCommand.d.ts +0 -14
- package/dist/types/cli/commands/ConfigCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/ExportCommand.d.ts +0 -48
- package/dist/types/cli/commands/ExportCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/HistoryCommand.d.ts +0 -47
- package/dist/types/cli/commands/HistoryCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/StatusCommand.d.ts +0 -30
- package/dist/types/cli/commands/StatusCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/ThemeCommand.d.ts +0 -30
- package/dist/types/cli/commands/ThemeCommand.d.ts.map +0 -1
- package/dist/types/cli/help.d.ts +0 -12
- package/dist/types/cli/help.d.ts.map +0 -1
- package/dist/types/cli/index.d.ts +0 -15
- package/dist/types/cli/index.d.ts.map +0 -1
- package/dist/types/constants.d.ts +0 -119
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/core.js +0 -28
- package/dist/types/example.d.ts +0 -18
- package/dist/types/example.d.ts.map +0 -1
- package/dist/types/exports-module.d.ts +0 -196
- package/dist/types/exports-module.d.ts.map +0 -1
- package/dist/types/handlers/AnalyticsLogHandler.d.ts +0 -8
- package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/ExportLogHandler.d.ts +0 -100
- package/dist/types/handlers/ExportLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/FileLogHandler.d.ts +0 -33
- package/dist/types/handlers/FileLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/RemoteLogHandler.d.ts +0 -11
- package/dist/types/handlers/RemoteLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/index.d.ts +0 -8
- package/dist/types/handlers/index.d.ts.map +0 -1
- package/dist/types/handlers.js +0 -4
- package/dist/types/index.js +0 -4
- package/dist/types/main.d.ts +0 -2
- package/dist/types/main.d.ts.map +0 -1
- package/dist/types/styling/LogStyleBuilder.d.ts +0 -146
- package/dist/types/styling/LogStyleBuilder.d.ts.map +0 -1
- package/dist/types/styling/SemanticStyles.d.ts +0 -178
- package/dist/types/styling/SemanticStyles.d.ts.map +0 -1
- package/dist/types/styling/SmartPresets.d.ts +0 -22
- package/dist/types/styling/SmartPresets.d.ts.map +0 -1
- package/dist/types/styling/StyleBuilder.d.ts +0 -140
- package/dist/types/styling/StyleBuilder.d.ts.map +0 -1
- package/dist/types/styling/banners.d.ts +0 -42
- package/dist/types/styling/banners.d.ts.map +0 -1
- package/dist/types/styling/index.d.ts +0 -10
- package/dist/types/styling/index.d.ts.map +0 -1
- package/dist/types/styling/themes.d.ts +0 -7
- package/dist/types/styling/themes.d.ts.map +0 -1
- package/dist/types/styling-module.d.ts +0 -178
- package/dist/types/styling-module.d.ts.map +0 -1
- package/dist/types/types/core.d.ts +0 -221
- package/dist/types/types/core.d.ts.map +0 -1
- package/dist/types/types/handlers.d.ts +0 -85
- package/dist/types/types/handlers.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -7
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/utils/environment.d.ts +0 -47
- package/dist/types/utils/environment.d.ts.map +0 -1
- package/dist/types/utils/formatting.d.ts +0 -37
- package/dist/types/utils/formatting.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -7
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/opentui-detection.d.ts +0 -34
- package/dist/types/utils/opentui-detection.d.ts.map +0 -1
- package/dist/types/utils/output.d.ts +0 -41
- package/dist/types/utils/output.d.ts.map +0 -1
- package/dist/types/utils/stackTrace.d.ts +0 -6
- package/dist/types/utils/stackTrace.d.ts.map +0 -1
- package/dist/types/utils/timestamps.d.ts +0 -20
- package/dist/types/utils/timestamps.d.ts.map +0 -1
- package/dist/utils/environment.d.ts +0 -47
- package/dist/utils/environment.d.ts.map +0 -1
- package/dist/utils/environment.js +0 -85
- package/dist/utils/formatting.js +0 -117
- package/dist/utils/index.js +0 -6
- package/dist/utils/opentui-detection.d.ts +0 -34
- package/dist/utils/opentui-detection.d.ts.map +0 -1
- package/dist/utils/opentui-detection.js +0 -116
- package/dist/utils/output.js +0 -150
- package/dist/utils/stackTrace.js +0 -81
- package/dist/utils/timestamps.js +0 -71
- package/dist/vite.svg +0 -1
- package/docs/API.md +0 -691
- package/docs/CORE.md +0 -264
- package/docs/DEVELOPMENT.md +0 -731
- package/docs/EXPORTS.md +0 -467
- package/docs/PACKAGES.md +0 -244
- package/docs/STYLING.md +0 -405
- package/docs/_config.yml +0 -36
- package/docs/index.md +0 -179
- package/examples/README.md +0 -208
- package/examples/basic-logging.js +0 -75
- package/examples/data-export.js +0 -234
- package/examples/package.json +0 -16
- package/examples/performance-timing.js +0 -170
- package/examples/simplified-api.js +0 -124
- package/examples/styling-themes.js +0 -207
- package/index.html +0 -358
- package/packages/core/package.json +0 -57
- package/packages/exports/package.json +0 -41
- package/packages/nodejs-opentui/README.md +0 -232
- package/packages/nodejs-opentui/package.json +0 -72
- package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
- package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
- package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
- package/packages/nodejs-opentui/src/index.ts +0 -133
- package/packages/nodejs-opentui/src/types.ts +0 -158
- package/packages/nodejs-opentui/tsconfig.json +0 -20
- package/packages/styling/package.json +0 -41
- package/project-utils/README.md +0 -172
- package/project-utils/auto-release-gemini.ts +0 -1193
- package/project-utils/auto-release-ui.ts +0 -1329
- package/project-utils/commit-generator.ts +0 -1385
- package/project-utils/commit-ui.ts +0 -264
- package/project-utils/git-utils.ts +0 -199
- package/project-utils/github-release-manager.ts +0 -466
- package/project-utils/project-config.ts +0 -260
- package/project-utils/prompt-templates.js +0 -345
- package/project-utils/prompt-templates.ts +0 -422
- package/project-utils/version-manager.ts +0 -1078
- package/public/vite.svg +0 -1
- package/src/Logger.ts +0 -1276
- package/src/ScopedLogger.ts +0 -454
- package/src/cli/CommandProcessor.ts +0 -248
- package/src/cli/commands/ConfigCommand.ts +0 -93
- package/src/cli/commands/ExportCommand.ts +0 -276
- package/src/cli/commands/HistoryCommand.ts +0 -117
- package/src/cli/commands/StatusCommand.ts +0 -112
- package/src/cli/commands/ThemeCommand.ts +0 -88
- package/src/cli/help.ts +0 -127
- package/src/cli/index.ts +0 -71
- package/src/constants.ts +0 -171
- package/src/core.ts +0 -393
- package/src/example.ts +0 -210
- package/src/exports-module.ts +0 -311
- package/src/handlers/AnalyticsLogHandler.ts +0 -22
- package/src/handlers/ExportLogHandler.ts +0 -609
- package/src/handlers/FileLogHandler.ts +0 -169
- package/src/handlers/RemoteLogHandler.ts +0 -42
- package/src/handlers/index.ts +0 -8
- package/src/index.ts +0 -209
- package/src/main.ts +0 -196
- package/src/style.css +0 -96
- package/src/styling/LogStyleBuilder.ts +0 -355
- package/src/styling/SemanticStyles.ts +0 -380
- package/src/styling/SmartPresets.ts +0 -288
- package/src/styling/StyleBuilder.ts +0 -319
- package/src/styling/banners.ts +0 -168
- package/src/styling/index.ts +0 -27
- package/src/styling/themes.ts +0 -235
- package/src/styling-module.ts +0 -244
- package/src/types/core.ts +0 -236
- package/src/types/handlers.ts +0 -95
- package/src/types/index.ts +0 -35
- package/src/typescript.svg +0 -1
- package/src/utils/environment.ts +0 -94
- package/src/utils/formatting.ts +0 -142
- package/src/utils/index.ts +0 -21
- package/src/utils/opentui-detection.ts +0 -138
- package/src/utils/output.ts +0 -185
- package/src/utils/stackTrace.ts +0 -95
- package/src/utils/timestamps.ts +0 -80
- package/src/vite-env.d.ts +0 -1
- package/test-core-browser.html +0 -237
- package/test-core-node.js +0 -63
- package/tests/test-conflict-resolution.ts +0 -391
- package/tests/validate-workflows.sh +0 -131
- package/tests/yaml-autofix.sh +0 -146
- package/tsconfig.json +0 -50
- package/vite.config.ts +0 -223
|
@@ -0,0 +1,1029 @@
|
|
|
1
|
+
const require_environment_detector = require("./environment-detector-D-tHkKWA.cjs");
|
|
2
|
+
//#region src/terminal/color-converter.ts
|
|
3
|
+
const ANSI_16_COLORS = {
|
|
4
|
+
black: {
|
|
5
|
+
fg: "30",
|
|
6
|
+
bg: "40",
|
|
7
|
+
bright: {
|
|
8
|
+
fg: "90",
|
|
9
|
+
bg: "100"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
red: {
|
|
13
|
+
fg: "31",
|
|
14
|
+
bg: "41",
|
|
15
|
+
bright: {
|
|
16
|
+
fg: "91",
|
|
17
|
+
bg: "101"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
green: {
|
|
21
|
+
fg: "32",
|
|
22
|
+
bg: "42",
|
|
23
|
+
bright: {
|
|
24
|
+
fg: "92",
|
|
25
|
+
bg: "102"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
yellow: {
|
|
29
|
+
fg: "33",
|
|
30
|
+
bg: "43",
|
|
31
|
+
bright: {
|
|
32
|
+
fg: "93",
|
|
33
|
+
bg: "103"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
blue: {
|
|
37
|
+
fg: "34",
|
|
38
|
+
bg: "44",
|
|
39
|
+
bright: {
|
|
40
|
+
fg: "94",
|
|
41
|
+
bg: "104"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
magenta: {
|
|
45
|
+
fg: "35",
|
|
46
|
+
bg: "45",
|
|
47
|
+
bright: {
|
|
48
|
+
fg: "95",
|
|
49
|
+
bg: "105"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
cyan: {
|
|
53
|
+
fg: "36",
|
|
54
|
+
bg: "46",
|
|
55
|
+
bright: {
|
|
56
|
+
fg: "96",
|
|
57
|
+
bg: "106"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
white: {
|
|
61
|
+
fg: "37",
|
|
62
|
+
bg: "47",
|
|
63
|
+
bright: {
|
|
64
|
+
fg: "97",
|
|
65
|
+
bg: "107"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
gray: {
|
|
69
|
+
fg: "90",
|
|
70
|
+
bg: "100",
|
|
71
|
+
bright: {
|
|
72
|
+
fg: "37",
|
|
73
|
+
bg: "47"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
grey: {
|
|
77
|
+
fg: "90",
|
|
78
|
+
bg: "100",
|
|
79
|
+
bright: {
|
|
80
|
+
fg: "37",
|
|
81
|
+
bg: "47"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const CSS_NAMED_COLORS = {
|
|
86
|
+
aliceblue: "#f0f8ff",
|
|
87
|
+
antiquewhite: "#faebd7",
|
|
88
|
+
aqua: "#00ffff",
|
|
89
|
+
aquamarine: "#7fffd4",
|
|
90
|
+
azure: "#f0ffff",
|
|
91
|
+
beige: "#f5f5dc",
|
|
92
|
+
bisque: "#ffe4c4",
|
|
93
|
+
black: "#000000",
|
|
94
|
+
blanchedalmond: "#ffebcd",
|
|
95
|
+
blue: "#0000ff",
|
|
96
|
+
blueviolet: "#8a2be2",
|
|
97
|
+
brown: "#a52a2a",
|
|
98
|
+
burlywood: "#deb887",
|
|
99
|
+
cadetblue: "#5f9ea0",
|
|
100
|
+
chartreuse: "#7fff00",
|
|
101
|
+
chocolate: "#d2691e",
|
|
102
|
+
coral: "#ff7f50",
|
|
103
|
+
cornflowerblue: "#6495ed",
|
|
104
|
+
cornsilk: "#fff8dc",
|
|
105
|
+
crimson: "#dc143c",
|
|
106
|
+
cyan: "#00ffff",
|
|
107
|
+
darkblue: "#00008b",
|
|
108
|
+
darkcyan: "#008b8b",
|
|
109
|
+
darkgoldenrod: "#b8860b",
|
|
110
|
+
darkgray: "#a9a9a9",
|
|
111
|
+
darkgreen: "#006400",
|
|
112
|
+
darkkhaki: "#bdb76b",
|
|
113
|
+
darkmagenta: "#8b008b",
|
|
114
|
+
darkolivegreen: "#556b2f",
|
|
115
|
+
darkorange: "#ff8c00",
|
|
116
|
+
darkorchid: "#9932cc",
|
|
117
|
+
darkred: "#8b0000",
|
|
118
|
+
darksalmon: "#e9967a",
|
|
119
|
+
darkseagreen: "#8fbc8f",
|
|
120
|
+
darkslateblue: "#483d8b",
|
|
121
|
+
darkslategray: "#2f4f4f",
|
|
122
|
+
darkturquoise: "#00ced1",
|
|
123
|
+
darkviolet: "#9400d3",
|
|
124
|
+
deeppink: "#ff1493",
|
|
125
|
+
deepskyblue: "#00bfff",
|
|
126
|
+
dimgray: "#696969",
|
|
127
|
+
dodgerblue: "#1e90ff",
|
|
128
|
+
firebrick: "#b22222",
|
|
129
|
+
floralwhite: "#fffaf0",
|
|
130
|
+
forestgreen: "#228b22",
|
|
131
|
+
fuchsia: "#ff00ff",
|
|
132
|
+
gainsboro: "#dcdcdc",
|
|
133
|
+
ghostwhite: "#f8f8ff",
|
|
134
|
+
gold: "#ffd700",
|
|
135
|
+
goldenrod: "#daa520",
|
|
136
|
+
gray: "#808080",
|
|
137
|
+
green: "#008000",
|
|
138
|
+
greenyellow: "#adff2f",
|
|
139
|
+
honeydew: "#f0fff0",
|
|
140
|
+
hotpink: "#ff69b4",
|
|
141
|
+
indianred: "#cd5c5c",
|
|
142
|
+
indigo: "#4b0082",
|
|
143
|
+
ivory: "#fffff0",
|
|
144
|
+
khaki: "#f0e68c",
|
|
145
|
+
lavender: "#e6e6fa",
|
|
146
|
+
lavenderblush: "#fff0f5",
|
|
147
|
+
lawngreen: "#7cfc00",
|
|
148
|
+
lemonchiffon: "#fffacd",
|
|
149
|
+
lightblue: "#add8e6",
|
|
150
|
+
lightcoral: "#f08080",
|
|
151
|
+
lightcyan: "#e0ffff",
|
|
152
|
+
lightgoldenrodyellow: "#fafad2",
|
|
153
|
+
lightgray: "#d3d3d3",
|
|
154
|
+
lightgreen: "#90ee90",
|
|
155
|
+
lightpink: "#ffb6c1",
|
|
156
|
+
lightsalmon: "#ffa07a",
|
|
157
|
+
lightseagreen: "#20b2aa",
|
|
158
|
+
lightskyblue: "#87cefa",
|
|
159
|
+
lightslategray: "#778899",
|
|
160
|
+
lightsteelblue: "#b0c4de",
|
|
161
|
+
lightyellow: "#ffffe0",
|
|
162
|
+
lime: "#00ff00",
|
|
163
|
+
limegreen: "#32cd32",
|
|
164
|
+
linen: "#faf0e6",
|
|
165
|
+
magenta: "#ff00ff",
|
|
166
|
+
maroon: "#800000",
|
|
167
|
+
mediumaquamarine: "#66cdaa",
|
|
168
|
+
mediumblue: "#0000cd",
|
|
169
|
+
mediumorchid: "#ba55d3",
|
|
170
|
+
mediumpurple: "#9370db",
|
|
171
|
+
mediumseagreen: "#3cb371",
|
|
172
|
+
mediumslateblue: "#7b68ee",
|
|
173
|
+
mediumspringgreen: "#00fa9a",
|
|
174
|
+
mediumturquoise: "#48d1cc",
|
|
175
|
+
mediumvioletred: "#c71585",
|
|
176
|
+
midnightblue: "#191970",
|
|
177
|
+
mintcream: "#f5fffa",
|
|
178
|
+
mistyrose: "#ffe4e1",
|
|
179
|
+
moccasin: "#ffe4b5",
|
|
180
|
+
navajowhite: "#ffdead",
|
|
181
|
+
navy: "#000080",
|
|
182
|
+
oldlace: "#fdf5e6",
|
|
183
|
+
olive: "#808000",
|
|
184
|
+
olivedrab: "#6b8e23",
|
|
185
|
+
orange: "#ffa500",
|
|
186
|
+
orangered: "#ff4500",
|
|
187
|
+
orchid: "#da70d6",
|
|
188
|
+
palegoldenrod: "#eee8aa",
|
|
189
|
+
palegreen: "#98fb98",
|
|
190
|
+
paleturquoise: "#afeeee",
|
|
191
|
+
palevioletred: "#db7093",
|
|
192
|
+
papayawhip: "#ffefd5",
|
|
193
|
+
peachpuff: "#ffdab9",
|
|
194
|
+
peru: "#cd853f",
|
|
195
|
+
pink: "#ffc0cb",
|
|
196
|
+
plum: "#dda0dd",
|
|
197
|
+
powderblue: "#b0e0e6",
|
|
198
|
+
purple: "#800080",
|
|
199
|
+
rebeccapurple: "#663399",
|
|
200
|
+
red: "#ff0000",
|
|
201
|
+
rosybrown: "#bc8f8f",
|
|
202
|
+
royalblue: "#4169e1",
|
|
203
|
+
saddlebrown: "#8b4513",
|
|
204
|
+
salmon: "#fa8072",
|
|
205
|
+
sandybrown: "#f4a460",
|
|
206
|
+
seagreen: "#2e8b57",
|
|
207
|
+
seashell: "#fff5ee",
|
|
208
|
+
sienna: "#a0522d",
|
|
209
|
+
silver: "#c0c0c0",
|
|
210
|
+
skyblue: "#87ceeb",
|
|
211
|
+
slateblue: "#6a5acd",
|
|
212
|
+
slategray: "#708090",
|
|
213
|
+
snow: "#fffafa",
|
|
214
|
+
springgreen: "#00ff7f",
|
|
215
|
+
steelblue: "#4682b4",
|
|
216
|
+
tan: "#d2b48c",
|
|
217
|
+
teal: "#008080",
|
|
218
|
+
thistle: "#d8bfd8",
|
|
219
|
+
tomato: "#ff6347",
|
|
220
|
+
turquoise: "#40e0d0",
|
|
221
|
+
violet: "#ee82ee",
|
|
222
|
+
wheat: "#f5deb3",
|
|
223
|
+
white: "#ffffff",
|
|
224
|
+
whitesmoke: "#f5f5f5",
|
|
225
|
+
yellow: "#ffff00",
|
|
226
|
+
yellowgreen: "#9acd32"
|
|
227
|
+
};
|
|
228
|
+
function hexToRgb(hex) {
|
|
229
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
230
|
+
if (!result || !result[1] || !result[2] || !result[3]) return {
|
|
231
|
+
r: 255,
|
|
232
|
+
g: 255,
|
|
233
|
+
b: 255
|
|
234
|
+
};
|
|
235
|
+
return {
|
|
236
|
+
r: parseInt(result[1], 16),
|
|
237
|
+
g: parseInt(result[2], 16),
|
|
238
|
+
b: parseInt(result[3], 16)
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function rgbToHex(r, g, b) {
|
|
242
|
+
return "#" + [
|
|
243
|
+
r,
|
|
244
|
+
g,
|
|
245
|
+
b
|
|
246
|
+
].map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
247
|
+
}
|
|
248
|
+
function colorToHex(color) {
|
|
249
|
+
if (color.startsWith("#")) return color;
|
|
250
|
+
const named = CSS_NAMED_COLORS[color.toLowerCase()];
|
|
251
|
+
if (named) return named;
|
|
252
|
+
const rgbMatch = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
253
|
+
if (rgbMatch && rgbMatch[1] && rgbMatch[2] && rgbMatch[3]) return rgbToHex(parseInt(rgbMatch[1]), parseInt(rgbMatch[2]), parseInt(rgbMatch[3]));
|
|
254
|
+
return "#ffffff";
|
|
255
|
+
}
|
|
256
|
+
function getANSIForeground(color, capability) {
|
|
257
|
+
if (capability === "none") return "";
|
|
258
|
+
const lowerColor = color.toLowerCase();
|
|
259
|
+
if (capability === "basic" && ANSI_16_COLORS[lowerColor]) return `\x1b[${ANSI_16_COLORS[lowerColor].fg}m`;
|
|
260
|
+
if (capability === "basic") {
|
|
261
|
+
const nearestBasic = findNearestBasicColor(colorToHex(color));
|
|
262
|
+
const basicColor = ANSI_16_COLORS[nearestBasic];
|
|
263
|
+
return basicColor ? `\x1b[${basicColor.fg}m` : "\x1B[37m";
|
|
264
|
+
}
|
|
265
|
+
const { r, g, b } = hexToRgb(colorToHex(color));
|
|
266
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
267
|
+
}
|
|
268
|
+
function getANSIBackground(color, capability) {
|
|
269
|
+
if (capability === "none") return "";
|
|
270
|
+
const lowerColor = color.toLowerCase();
|
|
271
|
+
if (capability === "basic" && ANSI_16_COLORS[lowerColor]) return `\x1b[${ANSI_16_COLORS[lowerColor].bg}m`;
|
|
272
|
+
if (capability === "basic") {
|
|
273
|
+
const nearestBasic = findNearestBasicColor(colorToHex(color));
|
|
274
|
+
const basicColor = ANSI_16_COLORS[nearestBasic];
|
|
275
|
+
return basicColor ? `\x1b[${basicColor.bg}m` : "\x1B[47m";
|
|
276
|
+
}
|
|
277
|
+
const { r, g, b } = hexToRgb(colorToHex(color));
|
|
278
|
+
return `\x1b[48;2;${r};${g};${b}m`;
|
|
279
|
+
}
|
|
280
|
+
function findNearestBasicColor(hex) {
|
|
281
|
+
const { r, g, b } = hexToRgb(hex);
|
|
282
|
+
const basicColors = {
|
|
283
|
+
black: {
|
|
284
|
+
r: 0,
|
|
285
|
+
g: 0,
|
|
286
|
+
b: 0
|
|
287
|
+
},
|
|
288
|
+
red: {
|
|
289
|
+
r: 205,
|
|
290
|
+
g: 0,
|
|
291
|
+
b: 0
|
|
292
|
+
},
|
|
293
|
+
green: {
|
|
294
|
+
r: 0,
|
|
295
|
+
g: 205,
|
|
296
|
+
b: 0
|
|
297
|
+
},
|
|
298
|
+
yellow: {
|
|
299
|
+
r: 205,
|
|
300
|
+
g: 205,
|
|
301
|
+
b: 0
|
|
302
|
+
},
|
|
303
|
+
blue: {
|
|
304
|
+
r: 0,
|
|
305
|
+
g: 0,
|
|
306
|
+
b: 238
|
|
307
|
+
},
|
|
308
|
+
magenta: {
|
|
309
|
+
r: 205,
|
|
310
|
+
g: 0,
|
|
311
|
+
b: 205
|
|
312
|
+
},
|
|
313
|
+
cyan: {
|
|
314
|
+
r: 0,
|
|
315
|
+
g: 205,
|
|
316
|
+
b: 205
|
|
317
|
+
},
|
|
318
|
+
white: {
|
|
319
|
+
r: 229,
|
|
320
|
+
g: 229,
|
|
321
|
+
b: 229
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
let nearest = "white";
|
|
325
|
+
let minDistance = Infinity;
|
|
326
|
+
for (const [name, rgb] of Object.entries(basicColors)) {
|
|
327
|
+
const distance = Math.sqrt(Math.pow(r - rgb.r, 2) + Math.pow(g - rgb.g, 2) + Math.pow(b - rgb.b, 2));
|
|
328
|
+
if (distance < minDistance) {
|
|
329
|
+
minDistance = distance;
|
|
330
|
+
nearest = name;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return nearest;
|
|
334
|
+
}
|
|
335
|
+
const ANSI = {
|
|
336
|
+
reset: "\x1B[0m",
|
|
337
|
+
bold: "\x1B[1m",
|
|
338
|
+
dim: "\x1B[2m",
|
|
339
|
+
italic: "\x1B[3m",
|
|
340
|
+
underline: "\x1B[4m",
|
|
341
|
+
blink: "\x1B[5m",
|
|
342
|
+
inverse: "\x1B[7m",
|
|
343
|
+
hidden: "\x1B[8m",
|
|
344
|
+
strikethrough: "\x1B[9m",
|
|
345
|
+
fg: {
|
|
346
|
+
black: "\x1B[30m",
|
|
347
|
+
red: "\x1B[31m",
|
|
348
|
+
green: "\x1B[32m",
|
|
349
|
+
yellow: "\x1B[33m",
|
|
350
|
+
blue: "\x1B[34m",
|
|
351
|
+
magenta: "\x1B[35m",
|
|
352
|
+
cyan: "\x1B[36m",
|
|
353
|
+
white: "\x1B[37m",
|
|
354
|
+
gray: "\x1B[90m",
|
|
355
|
+
brightRed: "\x1B[91m",
|
|
356
|
+
brightGreen: "\x1B[92m",
|
|
357
|
+
brightYellow: "\x1B[93m",
|
|
358
|
+
brightBlue: "\x1B[94m",
|
|
359
|
+
brightMagenta: "\x1B[95m",
|
|
360
|
+
brightCyan: "\x1B[96m",
|
|
361
|
+
brightWhite: "\x1B[97m"
|
|
362
|
+
},
|
|
363
|
+
bg: {
|
|
364
|
+
black: "\x1B[40m",
|
|
365
|
+
red: "\x1B[41m",
|
|
366
|
+
green: "\x1B[42m",
|
|
367
|
+
yellow: "\x1B[43m",
|
|
368
|
+
blue: "\x1B[44m",
|
|
369
|
+
magenta: "\x1B[45m",
|
|
370
|
+
cyan: "\x1B[46m",
|
|
371
|
+
white: "\x1B[47m",
|
|
372
|
+
gray: "\x1B[100m",
|
|
373
|
+
brightRed: "\x1B[101m",
|
|
374
|
+
brightGreen: "\x1B[102m",
|
|
375
|
+
brightYellow: "\x1B[103m",
|
|
376
|
+
brightBlue: "\x1B[104m",
|
|
377
|
+
brightMagenta: "\x1B[105m",
|
|
378
|
+
brightCyan: "\x1B[106m",
|
|
379
|
+
brightWhite: "\x1B[107m"
|
|
380
|
+
},
|
|
381
|
+
rgb: (r, g, b) => `\x1b[38;2;${r};${g};${b}m`,
|
|
382
|
+
bgRgb: (r, g, b) => `\x1b[48;2;${r};${g};${b}m`,
|
|
383
|
+
color256: (n) => `\x1b[38;5;${n}m`,
|
|
384
|
+
bgColor256: (n) => `\x1b[48;5;${n}m`
|
|
385
|
+
};
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/terminal/formatter.ts
|
|
388
|
+
function stripAnsi(str) {
|
|
389
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
390
|
+
}
|
|
391
|
+
function getVisibleLength(str) {
|
|
392
|
+
return stripAnsi(str).length;
|
|
393
|
+
}
|
|
394
|
+
function padToWidth(str, width, align = "left") {
|
|
395
|
+
const visibleLen = getVisibleLength(str);
|
|
396
|
+
if (visibleLen >= width) return str;
|
|
397
|
+
const padding = width - visibleLen;
|
|
398
|
+
switch (align) {
|
|
399
|
+
case "right": return " ".repeat(padding) + str;
|
|
400
|
+
case "center":
|
|
401
|
+
const leftPad = Math.floor(padding / 2);
|
|
402
|
+
const rightPad = padding - leftPad;
|
|
403
|
+
return " ".repeat(leftPad) + str + " ".repeat(rightPad);
|
|
404
|
+
default: return str + " ".repeat(padding);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function formatBadge(badge, style = "brackets", colorCapability = "full", color) {
|
|
408
|
+
const reset = colorCapability !== "none" ? ANSI.reset : "";
|
|
409
|
+
const text = badge.toUpperCase();
|
|
410
|
+
switch (style) {
|
|
411
|
+
case "rounded":
|
|
412
|
+
const colorCode1 = color && colorCapability !== "none" ? getANSIForeground(color, colorCapability) : "";
|
|
413
|
+
return `${colorCapability !== "none" ? ANSI.bg.black : ""}${colorCode1}⟨${text}⟩${reset}`;
|
|
414
|
+
case "plain": return `${color && colorCapability !== "none" ? getANSIForeground(color, colorCapability) : ""}${text}${reset}`;
|
|
415
|
+
case "unicode":
|
|
416
|
+
const colorCode3 = color && colorCapability !== "none" ? getANSIForeground(color, colorCapability) : "";
|
|
417
|
+
return `${colorCapability !== "none" ? ANSI.bg.black : ""}${colorCode3}╭${text}╮${reset}`;
|
|
418
|
+
case "pill": return `${color && colorCapability !== "none" ? getANSIBackground(color, colorCapability) : ""}${colorCapability !== "none" ? getANSIForeground("#000000", colorCapability) : ""}[${text}]${reset}`;
|
|
419
|
+
default:
|
|
420
|
+
const colorCode5 = color && colorCapability !== "none" ? getANSIForeground(color, colorCapability) : "";
|
|
421
|
+
return `${colorCapability !== "none" ? ANSI.bg.black : ""}${colorCode5}[${text}]${reset}`;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/playground/step.ts
|
|
426
|
+
/**
|
|
427
|
+
* @fileoverview Step progress renderer for CLI primitives
|
|
428
|
+
*/
|
|
429
|
+
/**
|
|
430
|
+
* Renderiza un indicador de progreso de step con el formato ` [n/total] msg`,
|
|
431
|
+
* donde el `[n/total]` se emite en cian bold (respetando `colorCap`) para
|
|
432
|
+
* destacarlo del mensaje descriptivo. Pensado para output secuencial de CLI
|
|
433
|
+
* tipo "steps de un build", "fases de un deploy" o "tareas de un script".
|
|
434
|
+
*
|
|
435
|
+
* No hace ningún chequeo de rango sobre `current`/`total` — el caller es
|
|
436
|
+
* responsable de pasar valores coherentes (se renderizan tal cual).
|
|
437
|
+
*
|
|
438
|
+
* @param current - Número de step actual (típicamente 1-based).
|
|
439
|
+
* @param total - Total de steps del proceso.
|
|
440
|
+
* @param msg - Descripción corta del step en curso.
|
|
441
|
+
* @param colorCap - Capacidad de color del terminal destino. Si es `'none'`,
|
|
442
|
+
* el label `[n/total]` se emite sin color.
|
|
443
|
+
* @returns String de una sola línea con formato ` [n/total] msg`.
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* const steps = ['Resolving deps', 'Bundling', 'Writing dist'];
|
|
448
|
+
* steps.forEach((step, i) => {
|
|
449
|
+
* process.stdout.write(renderStep(i + 1, steps.length, step, 'full') + '\n');
|
|
450
|
+
* });
|
|
451
|
+
* // [1/3] Resolving deps
|
|
452
|
+
* // [2/3] Bundling
|
|
453
|
+
* // [3/3] Writing dist
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
function renderStep(current, total, msg, colorCap) {
|
|
457
|
+
const label = `[${current}/${total}]`;
|
|
458
|
+
return ` ${colorCap !== "none" ? getANSIForeground("#00bcd4", colorCap) + ANSI.bold + label + ANSI.reset : label} ${msg}`;
|
|
459
|
+
}
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/playground/header.ts
|
|
462
|
+
/**
|
|
463
|
+
* @fileoverview Header renderer for CLI primitives
|
|
464
|
+
*/
|
|
465
|
+
/**
|
|
466
|
+
* Renderiza un header de sección: `title` en bold seguido opcionalmente de
|
|
467
|
+
* `subtitle` en dim (ANSI `2`), ideal para marcar bloques en output de CLI.
|
|
468
|
+
* No usa colores de foreground — sólo atributos de texto, así que el renderer
|
|
469
|
+
* es seguro para cualquier terminal sin importar la paleta del theme activo.
|
|
470
|
+
*
|
|
471
|
+
* @param title - Texto principal del header (siempre en bold).
|
|
472
|
+
* @param subtitle - Texto secundario a la derecha del título; se renderiza
|
|
473
|
+
* dimmed y separado por un espacio. Omitir si no aplica.
|
|
474
|
+
* @returns String de una línea con formato ` <bold>title</bold> <dim>subtitle</dim>`.
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```ts
|
|
478
|
+
* process.stdout.write(renderHeader('Deploy', 'production · us-east-1') + '\n');
|
|
479
|
+
* // **Deploy** production · us-east-1 (con atributos ANSI aplicados)
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```ts
|
|
484
|
+
* // Header sin subtítulo
|
|
485
|
+
* process.stdout.write(renderHeader('Build summary') + '\n');
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
function renderHeader(title, subtitle) {
|
|
489
|
+
return ` ${ANSI.bold + title + ANSI.reset}${subtitle ? ANSI.dim + ` ${subtitle}` + ANSI.reset : ""}`;
|
|
490
|
+
}
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/playground/divider.ts
|
|
493
|
+
/**
|
|
494
|
+
* @fileoverview Divider renderer for CLI primitives
|
|
495
|
+
*/
|
|
496
|
+
/**
|
|
497
|
+
* Renderiza una línea divisoria horizontal dimmed (ANSI `2`) usando el
|
|
498
|
+
* caracter `─`. Por defecto el ancho es `min(terminalWidth - 4, 60)` para
|
|
499
|
+
* no ocupar todo el ancho de ventana y quedar visualmente alineado con otros
|
|
500
|
+
* primitives (box, header, table) que dejan 2 espacios de indentación.
|
|
501
|
+
*
|
|
502
|
+
* @param width - Ancho explícito en columnas visibles. Si se omite, se calcula
|
|
503
|
+
* automáticamente a partir del ancho del terminal (capped a 60).
|
|
504
|
+
* @returns String de una línea con `width` caracteres `─` envueltos en ANSI dim.
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```ts
|
|
508
|
+
* // Divider automático (respeta el ancho del terminal)
|
|
509
|
+
* process.stdout.write(renderDivider() + '\n');
|
|
510
|
+
* ```
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* ```ts
|
|
514
|
+
* // Divider de ancho fijo para alinear con otra salida
|
|
515
|
+
* process.stdout.write(renderDivider(40) + '\n');
|
|
516
|
+
* ```
|
|
517
|
+
*
|
|
518
|
+
* @see {@link getTerminalWidth} para la detección de ancho cuando `width` se omite.
|
|
519
|
+
*/
|
|
520
|
+
function renderDivider(width) {
|
|
521
|
+
const w = width ?? Math.min(require_environment_detector.getTerminalWidth() - 4, 60);
|
|
522
|
+
return ANSI.dim + " " + "─".repeat(w) + ANSI.reset;
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region src/playground/box.ts
|
|
526
|
+
/**
|
|
527
|
+
* Mapa de juegos de caracteres Unicode para los 4 estilos de borde soportados
|
|
528
|
+
* por {@link renderBox}. Cada entrada expone las 4 esquinas (`tl`, `tr`, `bl`,
|
|
529
|
+
* `br`), el caracter horizontal (`h`) y el vertical (`v`) que componen el marco.
|
|
530
|
+
*
|
|
531
|
+
* - `single`: l\u00edneas finas (U+2500 / U+2502).
|
|
532
|
+
* - `rounded`: igual que `single` con esquinas redondeadas.
|
|
533
|
+
* - `double`: l\u00edneas dobles (U+2550 / U+2551), alto contraste visual.
|
|
534
|
+
* - `bold`: l\u00edneas gruesas (U+2501 / U+2503), para destacar bloques cr\u00edticos.
|
|
535
|
+
*
|
|
536
|
+
* @internal Lookup interno del renderer; no es API p\u00fablica.
|
|
537
|
+
*/
|
|
538
|
+
const BORDER_CHARS = {
|
|
539
|
+
single: {
|
|
540
|
+
tl: "┌",
|
|
541
|
+
tr: "┐",
|
|
542
|
+
bl: "└",
|
|
543
|
+
br: "┘",
|
|
544
|
+
h: "─",
|
|
545
|
+
v: "│"
|
|
546
|
+
},
|
|
547
|
+
rounded: {
|
|
548
|
+
tl: "╭",
|
|
549
|
+
tr: "╮",
|
|
550
|
+
bl: "╰",
|
|
551
|
+
br: "╯",
|
|
552
|
+
h: "─",
|
|
553
|
+
v: "│"
|
|
554
|
+
},
|
|
555
|
+
double: {
|
|
556
|
+
tl: "╔",
|
|
557
|
+
tr: "╗",
|
|
558
|
+
bl: "╚",
|
|
559
|
+
br: "╝",
|
|
560
|
+
h: "═",
|
|
561
|
+
v: "║"
|
|
562
|
+
},
|
|
563
|
+
bold: {
|
|
564
|
+
tl: "┏",
|
|
565
|
+
tr: "┓",
|
|
566
|
+
bl: "┗",
|
|
567
|
+
br: "┛",
|
|
568
|
+
h: "━",
|
|
569
|
+
v: "┃"
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* Renderiza `content` envuelto en un box con borde Unicode, respetando el
|
|
574
|
+
* ancho del terminal. El ancho interno se calcula a partir de la l\u00ednea m\u00e1s
|
|
575
|
+
* larga (o del {@link IBoxOptions.title} si es m\u00e1s ancho) y se acota a
|
|
576
|
+
* `min(terminalWidth - 4, 80)` columnas para no romper layouts estrechos.
|
|
577
|
+
*
|
|
578
|
+
* El padding se aplica como l\u00edneas vac\u00edas sim\u00e9tricas arriba/abajo del
|
|
579
|
+
* contenido. Si `borderColor` se omite o `colorCap` es `'none'`, el borde se
|
|
580
|
+
* emite sin secuencias ANSI (output plain-text seguro para logs y pipes).
|
|
581
|
+
*
|
|
582
|
+
* @param content - Texto a envolver; puede contener m\u00faltiples l\u00edneas (`\n`) y
|
|
583
|
+
* secuencias ANSI embebidas \u2014 el c\u00e1lculo de ancho usa el largo visible.
|
|
584
|
+
* @param options - Configuraci\u00f3n del box (title, borderColor, borderStyle,
|
|
585
|
+
* padding). Ver {@link IBoxOptions}.
|
|
586
|
+
* @param colorCap - Capacidad de color del terminal destino. Si es `'none'`,
|
|
587
|
+
* se omite cualquier secuencia ANSI.
|
|
588
|
+
* @returns String multilinea con el box ya construido (sin trailing newline).
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```ts
|
|
592
|
+
* // Box b\u00e1sico con borde redondeado (default)
|
|
593
|
+
* process.stdout.write(renderBox('Deploy completado') + '\n');
|
|
594
|
+
* ```
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```ts
|
|
598
|
+
* // Box con t\u00edtulo embebido en el borde superior y color custom
|
|
599
|
+
* process.stdout.write(renderBox('Service: auth-svc\nStatus: healthy', {
|
|
600
|
+
* title: 'Health Check',
|
|
601
|
+
* borderColor: '#00bcd4',
|
|
602
|
+
* borderStyle: 'double',
|
|
603
|
+
* padding: 1
|
|
604
|
+
* }) + '\n');
|
|
605
|
+
* ```
|
|
606
|
+
*
|
|
607
|
+
* @see {@link IBoxOptions} para el detalle de cada opci\u00f3n.
|
|
608
|
+
* @see {@link getTerminalWidth} para la detecci\u00f3n de ancho.
|
|
609
|
+
*/
|
|
610
|
+
function renderBox(content, options = {}, colorCap = "full") {
|
|
611
|
+
const { title, borderColor, borderStyle = "rounded", padding = 0 } = options;
|
|
612
|
+
const chars = BORDER_CHARS[borderStyle] ?? BORDER_CHARS.rounded;
|
|
613
|
+
const lines = content.split("\n");
|
|
614
|
+
const maxTermWidth = Math.min(require_environment_detector.getTerminalWidth() - 4, 80);
|
|
615
|
+
const contentWidths = lines.map((l) => getVisibleLength(l));
|
|
616
|
+
const titleWidth = title ? stripAnsi(title).length + 2 : 0;
|
|
617
|
+
const maxContentWidth = Math.max(...contentWidths, titleWidth);
|
|
618
|
+
const innerWidth = Math.min(maxContentWidth + 2, maxTermWidth);
|
|
619
|
+
const bc = borderColor && colorCap !== "none" ? getANSIForeground(borderColor, colorCap) : "";
|
|
620
|
+
const reset = bc ? ANSI.reset : "";
|
|
621
|
+
const wrap = (char) => `${bc}${char}${reset}`;
|
|
622
|
+
let topBorder;
|
|
623
|
+
if (title) {
|
|
624
|
+
const titleStr = ` ${title} `;
|
|
625
|
+
const afterTitle = innerWidth - stripAnsi(titleStr).length;
|
|
626
|
+
topBorder = ` ${wrap(chars.tl)}${wrap(chars.h)}${wrap(titleStr)}${wrap(chars.h.repeat(Math.max(0, afterTitle - 1)))}${wrap(chars.tr)}`;
|
|
627
|
+
} else topBorder = ` ${wrap(chars.tl)}${wrap(chars.h.repeat(innerWidth))}${wrap(chars.tr)}`;
|
|
628
|
+
const bottomBorder = ` ${wrap(chars.bl)}${wrap(chars.h.repeat(innerWidth))}${wrap(chars.br)}`;
|
|
629
|
+
const emptyLine = ` ${wrap(chars.v)}${" ".repeat(innerWidth)}${wrap(chars.v)}`;
|
|
630
|
+
const paddingLines = padding > 0 ? Array(padding).fill(emptyLine) : [];
|
|
631
|
+
const contentLines = lines.map((line) => {
|
|
632
|
+
const visible = getVisibleLength(line);
|
|
633
|
+
const pad = innerWidth - visible - 1;
|
|
634
|
+
return ` ${wrap(chars.v)} ${line}${" ".repeat(Math.max(0, pad))}${wrap(chars.v)}`;
|
|
635
|
+
});
|
|
636
|
+
return [
|
|
637
|
+
topBorder,
|
|
638
|
+
...paddingLines,
|
|
639
|
+
...contentLines,
|
|
640
|
+
...paddingLines,
|
|
641
|
+
bottomBorder
|
|
642
|
+
].join("\n");
|
|
643
|
+
}
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/playground/cli-table.ts
|
|
646
|
+
/**
|
|
647
|
+
* Renderiza un array de objetos como tabla ASCII alineada, con headers en
|
|
648
|
+
* cian bold y separador (`─`) bajo la cabecera. Las columnas se autodetectan
|
|
649
|
+
* a partir de las keys del primer row salvo que `options.columns` las imponga,
|
|
650
|
+
* y los labels se toman de `options.head` (default: nombres de columna).
|
|
651
|
+
*
|
|
652
|
+
* El ancho de cada columna se calcula como `max(header, valor más largo) + 2`
|
|
653
|
+
* para garantizar padding horizontal consistente. Si `colorCap` es `'none'`,
|
|
654
|
+
* se omiten todas las secuencias ANSI (útil para logs plain-text o CI).
|
|
655
|
+
*
|
|
656
|
+
* @param rows - Array de row objects. Un array vacío devuelve string vacío.
|
|
657
|
+
* @param options - Ver {@link ITableOptions} para `columns` y `head`.
|
|
658
|
+
* @param colorCap - Capacidad de color del terminal destino.
|
|
659
|
+
* @returns String multilinea con la tabla (header + separator + data rows),
|
|
660
|
+
* o `''` si `rows` está vacío.
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```ts
|
|
664
|
+
* // Auto-detect columnas desde las keys del primer row
|
|
665
|
+
* const rows = [
|
|
666
|
+
* { service: 'auth', status: 'healthy', latency: 12 },
|
|
667
|
+
* { service: 'api', status: 'degraded', latency: 245 }
|
|
668
|
+
* ];
|
|
669
|
+
* process.stdout.write(renderTable(rows) + '\n');
|
|
670
|
+
* // ┌─────────┬──────────┬─────────┐
|
|
671
|
+
* // │ service │ status │ latency │
|
|
672
|
+
* // ─────────────────────────────────
|
|
673
|
+
* // │ auth │ healthy │ 12 │
|
|
674
|
+
* // │ api │ degraded │ 245 │
|
|
675
|
+
* ```
|
|
676
|
+
*
|
|
677
|
+
* @example
|
|
678
|
+
* ```ts
|
|
679
|
+
* // Forzar columnas y renombrar headers
|
|
680
|
+
* process.stdout.write(renderTable(rows, {
|
|
681
|
+
* columns: ['service', 'latency'],
|
|
682
|
+
* head: ['Service', 'Latency (ms)']
|
|
683
|
+
* }, 'none') + '\n');
|
|
684
|
+
* ```
|
|
685
|
+
*
|
|
686
|
+
* @see {@link ITableOptions} para las opciones disponibles.
|
|
687
|
+
* @see {@link getVisibleLength} y {@link padToWidth} para el cálculo de ancho.
|
|
688
|
+
*/
|
|
689
|
+
function renderTable(rows, options = {}, colorCap = "full") {
|
|
690
|
+
if (rows.length === 0) return "";
|
|
691
|
+
const columns = options.columns ?? Object.keys(rows[0]);
|
|
692
|
+
const headers = options.head ?? columns;
|
|
693
|
+
const colWidths = columns.map((col, i) => {
|
|
694
|
+
const headerLen = getVisibleLength(headers[i] ?? col);
|
|
695
|
+
const maxValueLen = rows.reduce((max, row) => {
|
|
696
|
+
const val = String(row[col] ?? "");
|
|
697
|
+
return Math.max(max, getVisibleLength(val));
|
|
698
|
+
}, 0);
|
|
699
|
+
return Math.max(headerLen, maxValueLen) + 2;
|
|
700
|
+
});
|
|
701
|
+
const cyan = colorCap !== "none" ? getANSIForeground("#00bcd4", colorCap) : "";
|
|
702
|
+
const dim = colorCap !== "none" ? ANSI.dim : "";
|
|
703
|
+
const reset = colorCap !== "none" ? ANSI.reset : "";
|
|
704
|
+
return [
|
|
705
|
+
" " + columns.map((col, i) => {
|
|
706
|
+
const label = headers[i] ?? col;
|
|
707
|
+
return cyan + ANSI.bold + padToWidth(` ${label}`, colWidths[i]) + reset;
|
|
708
|
+
}).join(""),
|
|
709
|
+
" " + dim + colWidths.map((w) => "─".repeat(w)).join("─") + reset,
|
|
710
|
+
...rows.map((row) => {
|
|
711
|
+
return " " + columns.map((col, i) => {
|
|
712
|
+
return padToWidth(` ${String(row[col] ?? "")}`, colWidths[i]);
|
|
713
|
+
}).join("");
|
|
714
|
+
})
|
|
715
|
+
].join("\n");
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region src/playground/spinner.ts
|
|
719
|
+
/**
|
|
720
|
+
* Frames braille usados por la animaci\u00f3n del spinner. Cada frame es un
|
|
721
|
+
* car\u00e1cter del bloque Unicode Braille Patterns (U+2800\u2013U+28FF) que da la
|
|
722
|
+
* ilusi\u00f3n de rotaci\u00f3n al ciclarlos a ~12 FPS. Elegidos sobre caracteres
|
|
723
|
+
* ASCII (`|/-\`) porque renderizan m\u00e1s suaves en terminales modernas.
|
|
724
|
+
*/
|
|
725
|
+
const SPINNER_FRAMES = [
|
|
726
|
+
"⠋",
|
|
727
|
+
"⠙",
|
|
728
|
+
"⠹",
|
|
729
|
+
"⠸",
|
|
730
|
+
"⠼",
|
|
731
|
+
"⠴",
|
|
732
|
+
"⠦",
|
|
733
|
+
"⠧",
|
|
734
|
+
"⠇",
|
|
735
|
+
"⠏"
|
|
736
|
+
];
|
|
737
|
+
/**
|
|
738
|
+
* Intervalo entre frames del spinner en milisegundos. 80 ms \u2248 12.5 FPS:
|
|
739
|
+
* suficientemente r\u00e1pido para sentirse responsivo sin consumir CPU
|
|
740
|
+
* perceptiblemente en runs largos.
|
|
741
|
+
*/
|
|
742
|
+
const FRAME_INTERVAL = 80;
|
|
743
|
+
/**
|
|
744
|
+
* Spinner interactivo para TTY: cicla frames braille reescribiendo la l\u00ednea
|
|
745
|
+
* actual en su sitio (no emite l\u00edneas nuevas hasta el stop).
|
|
746
|
+
*
|
|
747
|
+
* Para no poluir stdout piped ni entrelazarse con el output normal del
|
|
748
|
+
* {@link Logger}, hace dos cosas no obvias:
|
|
749
|
+
* 1. Escribe SIEMPRE a `process.stderr` (carriage return + `\x1b[K` para
|
|
750
|
+
* limpiar la l\u00ednea antes de cada render).
|
|
751
|
+
* 2. Con `start()` mutea el logger (`outputMode: 'silent'`) y lo restaura a
|
|
752
|
+
* `'console'` en cualquier m\u00e9todo de finalizaci\u00f3n (`stop`/`succeed`/`fail`).
|
|
753
|
+
* Sin esto, los logs del usuario se imprimir\u00edan encima del frame animado.
|
|
754
|
+
*
|
|
755
|
+
* No gestiona TTY detection \u2014 quien lo instancia (`TerminalBridge`) ya valid\u00f3
|
|
756
|
+
* que hay TTY. Para non-TTY ver {@link NoopSpinner}.
|
|
757
|
+
*
|
|
758
|
+
* @implements {ISpinnerHandle}
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* ```ts
|
|
762
|
+
* const spinner = new SpinnerManager('Compilando...', logger.config, logger);
|
|
763
|
+
* spinner.start();
|
|
764
|
+
* // ...trabajo as\u00edncrono...
|
|
765
|
+
* spinner.succeed('Build OK');
|
|
766
|
+
* // stderr: " \u2713 Build OK"
|
|
767
|
+
* ```
|
|
768
|
+
*
|
|
769
|
+
* @see {@link NoopSpinner} para el path non-TTY.
|
|
770
|
+
* @see {@link ISpinnerHandle} para el contrato de la API p\u00fablica.
|
|
771
|
+
*/
|
|
772
|
+
var SpinnerManager = class {
|
|
773
|
+
message;
|
|
774
|
+
frameIndex = 0;
|
|
775
|
+
interval = null;
|
|
776
|
+
_logger;
|
|
777
|
+
/**
|
|
778
|
+
* @param {string} message - Texto a mostrar al lado del frame animado.
|
|
779
|
+
* Mutables luego v\u00eda {@link SpinnerManager.text}.
|
|
780
|
+
* @param {LoggerConfig} _config - Reservado para configuraci\u00f3n futura;
|
|
781
|
+
* actualmente no se lee dentro de la clase (lo conserva solo el caller).
|
|
782
|
+
* @param {Logger} logger - Instancia del logger due\u00f1a del spinner. Se
|
|
783
|
+
* mutea/restaura con `updateConfig({ outputMode })` en start/stop.
|
|
784
|
+
*/
|
|
785
|
+
constructor(message, _config, logger) {
|
|
786
|
+
this.message = message;
|
|
787
|
+
this._logger = logger;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Arranca la animaci\u00f3n. Idempotente: si ya est\u00e1 corriendo, no hace nada.
|
|
791
|
+
*
|
|
792
|
+
* Como efecto lateral mutea el logger pasado al constructor cambiando su
|
|
793
|
+
* `outputMode` a `'silent'` \u2014 cualquier log durante la animaci\u00f3n quedar\u00eda
|
|
794
|
+
* bufferizado y se descarta al restaurar el modo. Llama siempre a
|
|
795
|
+
* {@link stop}, {@link succeed} o {@link fail} para restaurar el output.
|
|
796
|
+
*
|
|
797
|
+
* @returns {void}
|
|
798
|
+
*/
|
|
799
|
+
start() {
|
|
800
|
+
if (this.interval) return;
|
|
801
|
+
this._logger.updateConfig({ outputMode: "silent" });
|
|
802
|
+
this.frameIndex = 0;
|
|
803
|
+
this.render();
|
|
804
|
+
this.interval = setInterval(() => {
|
|
805
|
+
this.frameIndex = (this.frameIndex + 1) % SPINNER_FRAMES.length;
|
|
806
|
+
this.render();
|
|
807
|
+
}, FRAME_INTERVAL);
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Detiene la animaci\u00f3n y limpia la l\u00ednea, sin emitir mensaje de estado.
|
|
811
|
+
* Restaura el `outputMode` del logger a `'console'`.
|
|
812
|
+
*
|
|
813
|
+
* \u00datil cuando el caller ya emiti\u00f3 su propio output final y solo necesita
|
|
814
|
+
* desmontar el spinner. Para terminaci\u00f3n con tick/cross usa
|
|
815
|
+
* {@link succeed} / {@link fail}.
|
|
816
|
+
*
|
|
817
|
+
* @returns {void}
|
|
818
|
+
*/
|
|
819
|
+
stop() {
|
|
820
|
+
this.clearInterval();
|
|
821
|
+
this.clearLine();
|
|
822
|
+
this._logger.updateConfig({ outputMode: "console" });
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Detiene la animaci\u00f3n y emite el mensaje con un check verde (`\u2713`).
|
|
826
|
+
* Restaura el `outputMode` del logger a `'console'`.
|
|
827
|
+
*
|
|
828
|
+
* @param {string} [msg] - Texto final a mostrar. Si se omite, reutiliza
|
|
829
|
+
* el `message` con el que se construy\u00f3 el spinner (o el \u00faltimo seteado
|
|
830
|
+
* v\u00eda {@link text}).
|
|
831
|
+
* @returns {void}
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* ```ts
|
|
835
|
+
* spinner.succeed(); // \u2192 " \u2713 <message inicial>"
|
|
836
|
+
* spinner.succeed('Hecho'); // \u2192 " \u2713 Hecho"
|
|
837
|
+
* ```
|
|
838
|
+
*/
|
|
839
|
+
succeed(msg) {
|
|
840
|
+
this.clearInterval();
|
|
841
|
+
this.clearLine();
|
|
842
|
+
const text = msg ?? this.message;
|
|
843
|
+
process.stderr.write(` ${ANSI.fg.green}\u2713${ANSI.reset} ${text}\n`);
|
|
844
|
+
this._logger.updateConfig({ outputMode: "console" });
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Detiene la animaci\u00f3n y emite el mensaje con una cruz roja (`\u2717`).
|
|
848
|
+
* Restaura el `outputMode` del logger a `'console'`.
|
|
849
|
+
*
|
|
850
|
+
* @param {string} [msg] - Texto final a mostrar. Si se omite, reutiliza
|
|
851
|
+
* el `message` con el que se construy\u00f3 el spinner (o el \u00faltimo seteado
|
|
852
|
+
* v\u00eda {@link text}).
|
|
853
|
+
* @returns {void}
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
* ```ts
|
|
857
|
+
* try {
|
|
858
|
+
* await build();
|
|
859
|
+
* spinner.succeed('Build OK');
|
|
860
|
+
* } catch (e) {
|
|
861
|
+
* spinner.fail(`Build fallido: ${e.message}`);
|
|
862
|
+
* }
|
|
863
|
+
* ```
|
|
864
|
+
*/
|
|
865
|
+
fail(msg) {
|
|
866
|
+
this.clearInterval();
|
|
867
|
+
this.clearLine();
|
|
868
|
+
const text = msg ?? this.message;
|
|
869
|
+
process.stderr.write(` ${ANSI.fg.red}\u2717${ANSI.reset} ${text}\n`);
|
|
870
|
+
this._logger.updateConfig({ outputMode: "console" });
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Reemplaza el texto mostrado al lado del frame sin reiniciar la animaci\u00f3n
|
|
874
|
+
* ni perder el frame actual. Pensado para actualizar progreso in-place
|
|
875
|
+
* (p.ej. contador de items procesados).
|
|
876
|
+
*
|
|
877
|
+
* @param {string} msg - Nuevo texto a mostrar.
|
|
878
|
+
* @returns {void}
|
|
879
|
+
*/
|
|
880
|
+
text(msg) {
|
|
881
|
+
this.message = msg;
|
|
882
|
+
}
|
|
883
|
+
render() {
|
|
884
|
+
const frame = SPINNER_FRAMES[this.frameIndex] ?? SPINNER_FRAMES[0];
|
|
885
|
+
const line = ` ${ANSI.fg.cyan}${frame}${ANSI.reset} ${this.message}`;
|
|
886
|
+
process.stderr.write(`\r\x1b[K${line}`);
|
|
887
|
+
}
|
|
888
|
+
clearLine() {
|
|
889
|
+
process.stderr.write("\r\x1B[K");
|
|
890
|
+
}
|
|
891
|
+
clearInterval() {
|
|
892
|
+
if (this.interval) {
|
|
893
|
+
clearInterval(this.interval);
|
|
894
|
+
this.interval = null;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* Spinner degenerate para non-TTY (CI logs, pipes, `outputMode: 'silent'`).
|
|
900
|
+
*
|
|
901
|
+
* No anima nada: traduce los eventos del ciclo de vida del spinner a llamadas
|
|
902
|
+
* normales del logger (`info` en start, `success`/`error` en finish). Así el
|
|
903
|
+
* consumidor mantiene la misma API {@link ISpinnerHandle} sin saber si está
|
|
904
|
+
* corriendo en terminal interactiva o en un job de CI.
|
|
905
|
+
*
|
|
906
|
+
* A diferencia de {@link SpinnerManager}, **no** toca el `outputMode` del
|
|
907
|
+
* logger — no hay nada que mutear porque no hay frame animado que proteger.
|
|
908
|
+
*
|
|
909
|
+
* @implements {ISpinnerHandle}
|
|
910
|
+
*
|
|
911
|
+
* @example
|
|
912
|
+
* ```ts
|
|
913
|
+
* // En CI (sin TTY) el TerminalBridge entrega un NoopSpinner automáticamente:
|
|
914
|
+
* const s = logger.spinner('Running tests...');
|
|
915
|
+
* s.start(); // logger.info('Running tests...')
|
|
916
|
+
* s.succeed('All green'); // logger.success('All green')
|
|
917
|
+
* ```
|
|
918
|
+
*
|
|
919
|
+
* @see {@link SpinnerManager} para el path interactivo con animación.
|
|
920
|
+
*/
|
|
921
|
+
var NoopSpinner = class {
|
|
922
|
+
message;
|
|
923
|
+
_logger;
|
|
924
|
+
/**
|
|
925
|
+
* @param {string} message - Texto base; se reutiliza como mensaje final
|
|
926
|
+
* si {@link succeed} / {@link fail} se llaman sin argumento.
|
|
927
|
+
* @param {Logger} logger - Logger sobre el que se emiten los eventos.
|
|
928
|
+
*/
|
|
929
|
+
constructor(message, logger) {
|
|
930
|
+
this.message = message;
|
|
931
|
+
this._logger = logger;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Emite el mensaje inicial como `logger.info(...)`. No arranca ningún
|
|
935
|
+
* timer — en non-TTY no hay nada que animar.
|
|
936
|
+
*
|
|
937
|
+
* @returns {void}
|
|
938
|
+
*/
|
|
939
|
+
start() {
|
|
940
|
+
this._logger.info(this.message);
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* No-op — no hay animación que detener ni output que restaurar.
|
|
944
|
+
*
|
|
945
|
+
* @returns {void}
|
|
946
|
+
*/
|
|
947
|
+
stop() {}
|
|
948
|
+
/**
|
|
949
|
+
* Emite el mensaje final como `logger.success(...)`.
|
|
950
|
+
*
|
|
951
|
+
* @param {string} [msg] - Texto final; si se omite usa el `message`
|
|
952
|
+
* inicial o el último seteado vía {@link text}.
|
|
953
|
+
* @returns {void}
|
|
954
|
+
*/
|
|
955
|
+
succeed(msg) {
|
|
956
|
+
this._logger.success(msg ?? this.message);
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Emite el mensaje final como `logger.error(...)`.
|
|
960
|
+
*
|
|
961
|
+
* @param {string} [msg] - Texto final; si se omite usa el `message`
|
|
962
|
+
* inicial o el último seteado vía {@link text}.
|
|
963
|
+
* @returns {void}
|
|
964
|
+
*/
|
|
965
|
+
fail(msg) {
|
|
966
|
+
this._logger.error(msg ?? this.message);
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Actualiza el mensaje interno (sin output). Solo afecta al texto que
|
|
970
|
+
* emitirán {@link succeed} / {@link fail} cuando se invoquen sin argumento.
|
|
971
|
+
*
|
|
972
|
+
* @param {string} msg - Nuevo texto base.
|
|
973
|
+
* @returns {void}
|
|
974
|
+
*/
|
|
975
|
+
text(msg) {
|
|
976
|
+
this.message = msg;
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
//#endregion
|
|
980
|
+
Object.defineProperty(exports, "NoopSpinner", {
|
|
981
|
+
enumerable: true,
|
|
982
|
+
get: function() {
|
|
983
|
+
return NoopSpinner;
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
Object.defineProperty(exports, "SpinnerManager", {
|
|
987
|
+
enumerable: true,
|
|
988
|
+
get: function() {
|
|
989
|
+
return SpinnerManager;
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
Object.defineProperty(exports, "formatBadge", {
|
|
993
|
+
enumerable: true,
|
|
994
|
+
get: function() {
|
|
995
|
+
return formatBadge;
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
Object.defineProperty(exports, "renderBox", {
|
|
999
|
+
enumerable: true,
|
|
1000
|
+
get: function() {
|
|
1001
|
+
return renderBox;
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
Object.defineProperty(exports, "renderDivider", {
|
|
1005
|
+
enumerable: true,
|
|
1006
|
+
get: function() {
|
|
1007
|
+
return renderDivider;
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
Object.defineProperty(exports, "renderHeader", {
|
|
1011
|
+
enumerable: true,
|
|
1012
|
+
get: function() {
|
|
1013
|
+
return renderHeader;
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
Object.defineProperty(exports, "renderStep", {
|
|
1017
|
+
enumerable: true,
|
|
1018
|
+
get: function() {
|
|
1019
|
+
return renderStep;
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
Object.defineProperty(exports, "renderTable", {
|
|
1023
|
+
enumerable: true,
|
|
1024
|
+
get: function() {
|
|
1025
|
+
return renderTable;
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
//# sourceMappingURL=spinner-BHyYEXsM.cjs.map
|