ccjk 14.2.2 → 15.1.0
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/LICENSE +1 -1
- package/README.md +75 -338
- package/dist/cli.js +89 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/detect.js +15 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/doctor.js +68 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/git-install.js +50 -0
- package/dist/commands/git-install.js.map +1 -0
- package/dist/commands/init.js +165 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.js +66 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/menu.js +42 -0
- package/dist/commands/menu.js.map +1 -0
- package/dist/commands/profile.js +138 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/core/detect.js +24 -0
- package/dist/core/detect.js.map +1 -0
- package/dist/core/lint.js +49 -0
- package/dist/core/lint.js.map +1 -0
- package/dist/core/mcp.js +41 -0
- package/dist/core/mcp.js.map +1 -0
- package/dist/core/paths.js +9 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/profiles.js +104 -0
- package/dist/core/profiles.js.map +1 -0
- package/dist/core/providers.js +53 -0
- package/dist/core/providers.js.map +1 -0
- package/dist/core/settings.js +31 -0
- package/dist/core/settings.js.map +1 -0
- package/dist/core/slash-templates.js +56 -0
- package/dist/core/slash-templates.js.map +1 -0
- package/dist/core/tools.js +27 -0
- package/dist/core/tools.js.map +1 -0
- package/package.json +43 -164
- package/README.HONEST.md +0 -176
- package/README.en.md +0 -67
- package/README.ja.md +0 -67
- package/README.ko.md +0 -67
- package/README.zh-CN.md +0 -86
- package/bin/ccjk.mjs +0 -5
- package/bin/ccjk.ts +0 -222
- package/dist/chunks/agent-teams.mjs +0 -145
- package/dist/chunks/agent.mjs +0 -1439
- package/dist/chunks/agents.mjs +0 -3783
- package/dist/chunks/api-cli.mjs +0 -135
- package/dist/chunks/api-config-selector.mjs +0 -159
- package/dist/chunks/api-providers.mjs +0 -144
- package/dist/chunks/api.mjs +0 -115
- package/dist/chunks/auto-bootstrap.mjs +0 -358
- package/dist/chunks/auto-fixer.mjs +0 -95
- package/dist/chunks/auto-updater.mjs +0 -507
- package/dist/chunks/banner.mjs +0 -173
- package/dist/chunks/bash.mjs +0 -187
- package/dist/chunks/boost.mjs +0 -474
- package/dist/chunks/brain-config.mjs +0 -75
- package/dist/chunks/brain-status.mjs +0 -89
- package/dist/chunks/ccjk-agents.mjs +0 -416
- package/dist/chunks/ccjk-all.mjs +0 -1046
- package/dist/chunks/ccjk-config.mjs +0 -445
- package/dist/chunks/ccjk-hooks.mjs +0 -1074
- package/dist/chunks/ccjk-mcp.mjs +0 -763
- package/dist/chunks/ccjk-setup.mjs +0 -765
- package/dist/chunks/ccjk-skills.mjs +0 -518
- package/dist/chunks/ccr.mjs +0 -109
- package/dist/chunks/ccu.mjs +0 -40
- package/dist/chunks/check-updates.mjs +0 -117
- package/dist/chunks/claude-code-incremental-manager.mjs +0 -761
- package/dist/chunks/claude-config.mjs +0 -606
- package/dist/chunks/claude-config2.mjs +0 -62
- package/dist/chunks/claude-wrapper.mjs +0 -85
- package/dist/chunks/clavue-config.mjs +0 -1454
- package/dist/chunks/cleanup-migration.mjs +0 -20
- package/dist/chunks/cli-hook.mjs +0 -4096
- package/dist/chunks/cloud-sync.mjs +0 -29
- package/dist/chunks/code-type-resolver.mjs +0 -880
- package/dist/chunks/codex-config-switch.mjs +0 -452
- package/dist/chunks/codex-provider-manager.mjs +0 -238
- package/dist/chunks/codex-uninstaller.mjs +0 -404
- package/dist/chunks/codex.mjs +0 -2141
- package/dist/chunks/commands.mjs +0 -108
- package/dist/chunks/commands2.mjs +0 -421
- package/dist/chunks/commit.mjs +0 -140
- package/dist/chunks/completion.mjs +0 -517
- package/dist/chunks/config-consolidator.mjs +0 -172
- package/dist/chunks/config-switch.mjs +0 -334
- package/dist/chunks/config.mjs +0 -558
- package/dist/chunks/config2.mjs +0 -484
- package/dist/chunks/config3.mjs +0 -486
- package/dist/chunks/constants.mjs +0 -323
- package/dist/chunks/context-opt.mjs +0 -444
- package/dist/chunks/context.mjs +0 -974
- package/dist/chunks/dashboard.mjs +0 -481
- package/dist/chunks/doctor.mjs +0 -1301
- package/dist/chunks/eval.mjs +0 -502
- package/dist/chunks/evolution.mjs +0 -322
- package/dist/chunks/features.mjs +0 -715
- package/dist/chunks/fish.mjs +0 -181
- package/dist/chunks/fs-operations.mjs +0 -180
- package/dist/chunks/health-alerts.mjs +0 -830
- package/dist/chunks/help.mjs +0 -341
- package/dist/chunks/hook-installer.mjs +0 -48
- package/dist/chunks/impact.mjs +0 -651
- package/dist/chunks/index.mjs +0 -23
- package/dist/chunks/index10.mjs +0 -19
- package/dist/chunks/index11.mjs +0 -1171
- package/dist/chunks/index12.mjs +0 -218
- package/dist/chunks/index13.mjs +0 -679
- package/dist/chunks/index14.mjs +0 -1009
- package/dist/chunks/index15.mjs +0 -194
- package/dist/chunks/index2.mjs +0 -7637
- package/dist/chunks/index3.mjs +0 -171
- package/dist/chunks/index4.mjs +0 -26
- package/dist/chunks/index5.mjs +0 -19
- package/dist/chunks/index6.mjs +0 -19092
- package/dist/chunks/index7.mjs +0 -616
- package/dist/chunks/index8.mjs +0 -1602
- package/dist/chunks/index9.mjs +0 -5384
- package/dist/chunks/init.mjs +0 -1911
- package/dist/chunks/installer.mjs +0 -757
- package/dist/chunks/installer2.mjs +0 -103
- package/dist/chunks/interview.mjs +0 -2927
- package/dist/chunks/json-config.mjs +0 -60
- package/dist/chunks/linux.mjs +0 -3863
- package/dist/chunks/macos.mjs +0 -69
- package/dist/chunks/main.mjs +0 -635
- package/dist/chunks/manager.mjs +0 -1048
- package/dist/chunks/marketplace.mjs +0 -265
- package/dist/chunks/mcp-cli.mjs +0 -205
- package/dist/chunks/mcp-performance.mjs +0 -187
- package/dist/chunks/mcp.mjs +0 -667
- package/dist/chunks/memory-check.mjs +0 -2973
- package/dist/chunks/memory-paths.mjs +0 -259
- package/dist/chunks/memory-sync.mjs +0 -209
- package/dist/chunks/memory.mjs +0 -354
- package/dist/chunks/metrics-display.mjs +0 -153
- package/dist/chunks/monitor.mjs +0 -1856
- package/dist/chunks/notification.mjs +0 -1864
- package/dist/chunks/onboarding.mjs +0 -386
- package/dist/chunks/package.mjs +0 -3
- package/dist/chunks/paradigm.mjs +0 -74
- package/dist/chunks/permission-manager.mjs +0 -250
- package/dist/chunks/permissions.mjs +0 -265
- package/dist/chunks/persistence-manager.mjs +0 -801
- package/dist/chunks/persistence.mjs +0 -707
- package/dist/chunks/platform.mjs +0 -395
- package/dist/chunks/plugin.mjs +0 -1936
- package/dist/chunks/powershell.mjs +0 -213
- package/dist/chunks/prompts.mjs +0 -244
- package/dist/chunks/providers.mjs +0 -263
- package/dist/chunks/quick-actions.mjs +0 -335
- package/dist/chunks/quick-provider.mjs +0 -755
- package/dist/chunks/quick-setup.mjs +0 -421
- package/dist/chunks/remote.mjs +0 -497
- package/dist/chunks/research.mjs +0 -1904
- package/dist/chunks/rollback.mjs +0 -38
- package/dist/chunks/session-manager.mjs +0 -1371
- package/dist/chunks/session.mjs +0 -878
- package/dist/chunks/sessions.mjs +0 -106
- package/dist/chunks/silent-updater.mjs +0 -396
- package/dist/chunks/simple-config.mjs +0 -122
- package/dist/chunks/skill.mjs +0 -117
- package/dist/chunks/skill2.mjs +0 -9052
- package/dist/chunks/skills-sync.mjs +0 -1343
- package/dist/chunks/skills.mjs +0 -577
- package/dist/chunks/slash-commands.mjs +0 -208
- package/dist/chunks/smart-guide.mjs +0 -247
- package/dist/chunks/snapshot.mjs +0 -58
- package/dist/chunks/startup.mjs +0 -487
- package/dist/chunks/stats.mjs +0 -191
- package/dist/chunks/status.mjs +0 -471
- package/dist/chunks/team.mjs +0 -63
- package/dist/chunks/thinking.mjs +0 -626
- package/dist/chunks/trace.mjs +0 -57
- package/dist/chunks/uninstall.mjs +0 -852
- package/dist/chunks/update.mjs +0 -174
- package/dist/chunks/upgrade-manager.mjs +0 -204
- package/dist/chunks/upgrade.mjs +0 -133
- package/dist/chunks/version-checker.mjs +0 -891
- package/dist/chunks/vim.mjs +0 -903
- package/dist/chunks/windows.mjs +0 -14
- package/dist/chunks/workflows.mjs +0 -633
- package/dist/chunks/wsl.mjs +0 -129
- package/dist/chunks/zero-config.mjs +0 -871
- package/dist/chunks/zsh.mjs +0 -182
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -2684
- package/dist/i18n/locales/en/agent-teams.json +0 -18
- package/dist/i18n/locales/en/agentBrowser.json +0 -80
- package/dist/i18n/locales/en/agents.json +0 -135
- package/dist/i18n/locales/en/api.json +0 -63
- package/dist/i18n/locales/en/ccjk-agents.json +0 -33
- package/dist/i18n/locales/en/ccjk-all.json +0 -23
- package/dist/i18n/locales/en/ccjk-skills.json +0 -22
- package/dist/i18n/locales/en/ccjk.json +0 -276
- package/dist/i18n/locales/en/ccr.json +0 -65
- package/dist/i18n/locales/en/claude-md.json +0 -73
- package/dist/i18n/locales/en/cli.json +0 -148
- package/dist/i18n/locales/en/cloud-setup.json +0 -31
- package/dist/i18n/locales/en/cloud-sync.json +0 -147
- package/dist/i18n/locales/en/cloud.json +0 -40
- package/dist/i18n/locales/en/cloudPlugins.json +0 -118
- package/dist/i18n/locales/en/codex.json +0 -184
- package/dist/i18n/locales/en/cometix.json +0 -29
- package/dist/i18n/locales/en/common.json +0 -68
- package/dist/i18n/locales/en/config.json +0 -108
- package/dist/i18n/locales/en/configuration.json +0 -236
- package/dist/i18n/locales/en/context.json +0 -85
- package/dist/i18n/locales/en/dashboard.json +0 -78
- package/dist/i18n/locales/en/errors.json +0 -26
- package/dist/i18n/locales/en/evolution.json +0 -54
- package/dist/i18n/locales/en/hooks.json +0 -74
- package/dist/i18n/locales/en/hooksSync.json +0 -133
- package/dist/i18n/locales/en/installation.json +0 -83
- package/dist/i18n/locales/en/interview.json +0 -104
- package/dist/i18n/locales/en/language.json +0 -19
- package/dist/i18n/locales/en/lsp.json +0 -78
- package/dist/i18n/locales/en/marketplace.json +0 -116
- package/dist/i18n/locales/en/mcp.json +0 -180
- package/dist/i18n/locales/en/memory.json +0 -23
- package/dist/i18n/locales/en/menu.json +0 -299
- package/dist/i18n/locales/en/multi-config.json +0 -79
- package/dist/i18n/locales/en/notification.json +0 -307
- package/dist/i18n/locales/en/permissions.json +0 -95
- package/dist/i18n/locales/en/persistence.json +0 -127
- package/dist/i18n/locales/en/plugins.json +0 -146
- package/dist/i18n/locales/en/quick-actions.json +0 -78
- package/dist/i18n/locales/en/registry.json +0 -54
- package/dist/i18n/locales/en/remote.json +0 -93
- package/dist/i18n/locales/en/sandbox.json +0 -44
- package/dist/i18n/locales/en/setup.json +0 -44
- package/dist/i18n/locales/en/shencha.json +0 -14
- package/dist/i18n/locales/en/skills.json +0 -100
- package/dist/i18n/locales/en/skillsSync.json +0 -74
- package/dist/i18n/locales/en/smartGuide.json +0 -49
- package/dist/i18n/locales/en/stats.json +0 -20
- package/dist/i18n/locales/en/subagent.json +0 -69
- package/dist/i18n/locales/en/superpowers.json +0 -117
- package/dist/i18n/locales/en/team.json +0 -7
- package/dist/i18n/locales/en/thinking.json +0 -65
- package/dist/i18n/locales/en/tools.json +0 -42
- package/dist/i18n/locales/en/uninstall.json +0 -56
- package/dist/i18n/locales/en/updater.json +0 -29
- package/dist/i18n/locales/en/vim.json +0 -169
- package/dist/i18n/locales/en/workflow.json +0 -55
- package/dist/i18n/locales/en/workspace.json +0 -108
- package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
- package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -80
- package/dist/i18n/locales/zh-CN/agents.json +0 -135
- package/dist/i18n/locales/zh-CN/api.json +0 -63
- package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
- package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
- package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
- package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
- package/dist/i18n/locales/zh-CN/ccr.json +0 -65
- package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
- package/dist/i18n/locales/zh-CN/cli.json +0 -148
- package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
- package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
- package/dist/i18n/locales/zh-CN/cloud.json +0 -40
- package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
- package/dist/i18n/locales/zh-CN/codex.json +0 -184
- package/dist/i18n/locales/zh-CN/cometix.json +0 -29
- package/dist/i18n/locales/zh-CN/common.json +0 -68
- package/dist/i18n/locales/zh-CN/config.json +0 -108
- package/dist/i18n/locales/zh-CN/configuration.json +0 -234
- package/dist/i18n/locales/zh-CN/context.json +0 -85
- package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
- package/dist/i18n/locales/zh-CN/errors.json +0 -26
- package/dist/i18n/locales/zh-CN/evolution.json +0 -54
- package/dist/i18n/locales/zh-CN/hooks.json +0 -74
- package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
- package/dist/i18n/locales/zh-CN/installation.json +0 -83
- package/dist/i18n/locales/zh-CN/interview.json +0 -104
- package/dist/i18n/locales/zh-CN/language.json +0 -19
- package/dist/i18n/locales/zh-CN/lsp.json +0 -78
- package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
- package/dist/i18n/locales/zh-CN/mcp.json +0 -180
- package/dist/i18n/locales/zh-CN/memory.json +0 -23
- package/dist/i18n/locales/zh-CN/menu.json +0 -299
- package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
- package/dist/i18n/locales/zh-CN/notification.json +0 -307
- package/dist/i18n/locales/zh-CN/permissions.json +0 -95
- package/dist/i18n/locales/zh-CN/persistence.json +0 -127
- package/dist/i18n/locales/zh-CN/plugins.json +0 -146
- package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
- package/dist/i18n/locales/zh-CN/registry.json +0 -54
- package/dist/i18n/locales/zh-CN/remote.json +0 -93
- package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
- package/dist/i18n/locales/zh-CN/setup.json +0 -44
- package/dist/i18n/locales/zh-CN/shencha.json +0 -14
- package/dist/i18n/locales/zh-CN/skills.json +0 -100
- package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
- package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
- package/dist/i18n/locales/zh-CN/stats.json +0 -20
- package/dist/i18n/locales/zh-CN/subagent.json +0 -69
- package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
- package/dist/i18n/locales/zh-CN/team.json +0 -7
- package/dist/i18n/locales/zh-CN/thinking.json +0 -65
- package/dist/i18n/locales/zh-CN/tools.json +0 -42
- package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
- package/dist/i18n/locales/zh-CN/updater.json +0 -29
- package/dist/i18n/locales/zh-CN/vim.json +0 -169
- package/dist/i18n/locales/zh-CN/workflow.json +0 -55
- package/dist/i18n/locales/zh-CN/workspace.json +0 -108
- package/dist/index.d.mts +0 -5658
- package/dist/index.d.ts +0 -5658
- package/dist/index.mjs +0 -3732
- package/dist/shared/ccjk.5bEolFrk.mjs +0 -254
- package/dist/shared/ccjk.8oaxX4iR.mjs +0 -90
- package/dist/shared/ccjk.B2U7DsPy.mjs +0 -31
- package/dist/shared/ccjk.B2f-cwUP.mjs +0 -468
- package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
- package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
- package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
- package/dist/shared/ccjk.BLsIiTqO.mjs +0 -449
- package/dist/shared/ccjk.BXv8aYs1.mjs +0 -170
- package/dist/shared/ccjk.BnsY5WxD.mjs +0 -171
- package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
- package/dist/shared/ccjk.Bq8TqZG_.mjs +0 -189
- package/dist/shared/ccjk.BtrioX1Z.mjs +0 -25
- package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
- package/dist/shared/ccjk.BzPbSEP2.mjs +0 -115
- package/dist/shared/ccjk.C0WLUnFV.mjs +0 -293
- package/dist/shared/ccjk.C1hANZTu.mjs +0 -19
- package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
- package/dist/shared/ccjk.CNhnT6uQ.mjs +0 -636
- package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
- package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
- package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
- package/dist/shared/ccjk.CoCHVXl3.mjs +0 -3951
- package/dist/shared/ccjk.CwGZSTAK.mjs +0 -319
- package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
- package/dist/shared/ccjk.D-magaEx.mjs +0 -763
- package/dist/shared/ccjk.D0g2ABGg.mjs +0 -171
- package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
- package/dist/shared/ccjk.D75wivnp.mjs +0 -142
- package/dist/shared/ccjk.DDL-4C-k.mjs +0 -100
- package/dist/shared/ccjk.DFRPtmK_.mjs +0 -75
- package/dist/shared/ccjk.DMV3x5Sd.mjs +0 -299
- package/dist/shared/ccjk.DZ2LLOa-.mjs +0 -2195
- package/dist/shared/ccjk.DbigonEQ.mjs +0 -698
- package/dist/shared/ccjk.DcMvE7lf.mjs +0 -618
- package/dist/shared/ccjk.DeWpAShp.mjs +0 -1828
- package/dist/shared/ccjk.DhJ1kyDR.mjs +0 -30
- package/dist/shared/ccjk.DlTXS9rP.mjs +0 -224
- package/dist/shared/ccjk.DopKzo3z.mjs +0 -305
- package/dist/shared/ccjk.DsZsc4LR.mjs +0 -1280
- package/dist/shared/ccjk.DuzJZlgj.mjs +0 -418
- package/dist/shared/ccjk.Dxgd2vjc.mjs +0 -444
- package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
- package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
- package/dist/shared/ccjk.L7yC58_i.mjs +0 -225
- package/dist/shared/ccjk.MwtjAULc.mjs +0 -1447
- package/dist/shared/ccjk.OJKHVSOb.mjs +0 -2005
- package/dist/shared/ccjk.OTnevPNE.mjs +0 -225
- package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
- package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
- package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
- package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
- package/dist/shared/ccjk.i_vn-9C3.mjs +0 -317
- package/dist/shared/ccjk.lG3ccFjm.mjs +0 -885
- package/dist/shared/ccjk.wLJHO0Af.mjs +0 -244
- package/dist/shared/ccjk.y-a_1vK4.mjs +0 -5127
- package/dist/templates/agents/README.md +0 -78
- package/dist/templates/agents/fullstack-developer.json +0 -70
- package/dist/templates/agents/go-expert.json +0 -69
- package/dist/templates/agents/index.json +0 -64
- package/dist/templates/agents/python-expert.json +0 -69
- package/dist/templates/agents/react-specialist.json +0 -69
- package/dist/templates/agents/testing-automation-expert.json +0 -70
- package/dist/templates/agents/typescript-architect.json +0 -69
- package/dist/templates/claude-code/common/settings.json +0 -109
- package/dist/templates/common/error-prevention.md +0 -267
- package/dist/templates/common/karpathy-baseline.md +0 -83
- package/dist/templates/common/output-styles/zh-CN/carmack-mode.md +0 -381
- package/dist/templates/common/output-styles/zh-CN/codex-rigor-mode.md +0 -114
- package/dist/templates/common/output-styles/zh-CN/dhh-mode.md +0 -265
- package/dist/templates/common/output-styles/zh-CN/evan-you-mode.md +0 -539
- package/dist/templates/common/output-styles/zh-CN/jobs-mode.md +0 -369
- package/dist/templates/common/output-styles/zh-CN/linus-mode.md +0 -135
- package/dist/templates/common/output-styles/zh-CN/uncle-bob-mode.md +0 -221
- package/dist/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +0 -628
- package/dist/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +0 -628
- package/dist/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +0 -187
- package/dist/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +0 -191
- package/dist/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +0 -249
- package/dist/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +0 -277
- package/dist/templates/common/workflow/essential/en/agents/get-current-datetime.md +0 -29
- package/dist/templates/common/workflow/essential/en/agents/init-architect.md +0 -115
- package/dist/templates/common/workflow/essential/en/agents/ui-ux-designer.md +0 -91
- package/dist/templates/common/workflow/essential/en/feat.md +0 -92
- package/dist/templates/common/workflow/essential/en/goal.md +0 -147
- package/dist/templates/common/workflow/essential/en/init-project.md +0 -53
- package/dist/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +0 -29
- package/dist/templates/common/workflow/essential/zh-CN/agents/init-architect.md +0 -115
- package/dist/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +0 -91
- package/dist/templates/common/workflow/essential/zh-CN/feat.md +0 -315
- package/dist/templates/common/workflow/essential/zh-CN/goal.md +0 -146
- package/dist/templates/common/workflow/essential/zh-CN/init-project.md +0 -53
- package/dist/templates/common/workflow/git/en/git-cleanBranches.md +0 -102
- package/dist/templates/common/workflow/git/en/git-commit.md +0 -205
- package/dist/templates/common/workflow/git/en/git-rollback.md +0 -90
- package/dist/templates/common/workflow/git/en/git-worktree.md +0 -276
- package/dist/templates/common/workflow/git/zh-CN/git-cleanBranches.md +0 -102
- package/dist/templates/common/workflow/git/zh-CN/git-commit.md +0 -205
- package/dist/templates/common/workflow/git/zh-CN/git-rollback.md +0 -90
- package/dist/templates/common/workflow/git/zh-CN/git-worktree.md +0 -276
- package/dist/templates/common/workflow/interview/en/interview.md +0 -67
- package/dist/templates/common/workflow/interview/zh-CN/interview.md +0 -67
- package/dist/templates/common/workflow/linearMethod/en/linear-method.md +0 -651
- package/dist/templates/common/workflow/linearMethod/zh-CN/linear-method.md +0 -752
- package/dist/templates/common/workflow/refactoringMaster/en/refactoring-master.md +0 -516
- package/dist/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +0 -812
- package/dist/templates/common/workflow/sixStep/en/workflow.md +0 -83
- package/dist/templates/common/workflow/sixStep/zh-CN/workflow.md +0 -359
- package/dist/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +0 -364
- package/dist/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +0 -366
- package/dist/templates/hooks/README.md +0 -212
- package/dist/templates/hooks/git-workflow-hooks.md +0 -551
- package/dist/templates/hooks/post-test/coverage.json +0 -21
- package/dist/templates/hooks/post-test/summary.json +0 -21
- package/dist/templates/hooks/post-test-coverage.md +0 -434
- package/dist/templates/hooks/pre-commit/eslint.json +0 -22
- package/dist/templates/hooks/pre-commit/prettier.json +0 -22
- package/dist/templates/hooks/pre-commit-black.md +0 -274
- package/dist/templates/hooks/pre-commit-eslint.md +0 -153
- package/dist/templates/hooks/pre-commit-gofmt.md +0 -284
- package/dist/templates/hooks/pre-commit-prettier.md +0 -212
- package/dist/templates/hooks/pre-commit-type-check.md +0 -377
- package/dist/templates/skills/ccjk-init.md +0 -154
- package/dist/templates/skills/ccjk-mcp-setup.md +0 -205
- package/dist/templates/skills/ccjk-troubleshoot.md +0 -228
- package/dist/templates/skills/django-patterns.md +0 -1016
- package/dist/templates/skills/git-workflow.md +0 -748
- package/dist/templates/skills/go-idioms.md +0 -963
- package/dist/templates/skills/index.json +0 -132
- package/dist/templates/skills/nextjs-optimization.md +0 -694
- package/dist/templates/skills/python-pep8.md +0 -852
- package/dist/templates/skills/react-patterns.md +0 -686
- package/dist/templates/skills/rust-patterns.md +0 -1057
- package/dist/templates/skills/security-best-practices.md +0 -1413
- package/dist/templates/skills/testing-best-practices.md +0 -1315
- package/dist/templates/skills/ts-best-practices.md +0 -354
- package/templates/agents/README.md +0 -78
- package/templates/agents/fullstack-developer.json +0 -70
- package/templates/agents/go-expert.json +0 -69
- package/templates/agents/index.json +0 -64
- package/templates/agents/python-expert.json +0 -69
- package/templates/agents/react-specialist.json +0 -69
- package/templates/agents/testing-automation-expert.json +0 -70
- package/templates/agents/typescript-architect.json +0 -69
- package/templates/claude-code/common/settings.json +0 -109
- package/templates/common/error-prevention.md +0 -267
- package/templates/common/karpathy-baseline.md +0 -83
- package/templates/common/output-styles/zh-CN/carmack-mode.md +0 -381
- package/templates/common/output-styles/zh-CN/codex-rigor-mode.md +0 -114
- package/templates/common/output-styles/zh-CN/dhh-mode.md +0 -265
- package/templates/common/output-styles/zh-CN/evan-you-mode.md +0 -539
- package/templates/common/output-styles/zh-CN/jobs-mode.md +0 -369
- package/templates/common/output-styles/zh-CN/linus-mode.md +0 -135
- package/templates/common/output-styles/zh-CN/uncle-bob-mode.md +0 -221
- package/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +0 -628
- package/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +0 -628
- package/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +0 -187
- package/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +0 -191
- package/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +0 -249
- package/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +0 -277
- package/templates/common/workflow/essential/en/agents/get-current-datetime.md +0 -29
- package/templates/common/workflow/essential/en/agents/init-architect.md +0 -115
- package/templates/common/workflow/essential/en/agents/ui-ux-designer.md +0 -91
- package/templates/common/workflow/essential/en/feat.md +0 -92
- package/templates/common/workflow/essential/en/goal.md +0 -147
- package/templates/common/workflow/essential/en/init-project.md +0 -53
- package/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +0 -29
- package/templates/common/workflow/essential/zh-CN/agents/init-architect.md +0 -115
- package/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +0 -91
- package/templates/common/workflow/essential/zh-CN/feat.md +0 -315
- package/templates/common/workflow/essential/zh-CN/goal.md +0 -146
- package/templates/common/workflow/essential/zh-CN/init-project.md +0 -53
- package/templates/common/workflow/git/en/git-cleanBranches.md +0 -102
- package/templates/common/workflow/git/en/git-commit.md +0 -205
- package/templates/common/workflow/git/en/git-rollback.md +0 -90
- package/templates/common/workflow/git/en/git-worktree.md +0 -276
- package/templates/common/workflow/git/zh-CN/git-cleanBranches.md +0 -102
- package/templates/common/workflow/git/zh-CN/git-commit.md +0 -205
- package/templates/common/workflow/git/zh-CN/git-rollback.md +0 -90
- package/templates/common/workflow/git/zh-CN/git-worktree.md +0 -276
- package/templates/common/workflow/interview/en/interview.md +0 -67
- package/templates/common/workflow/interview/zh-CN/interview.md +0 -67
- package/templates/common/workflow/linearMethod/en/linear-method.md +0 -651
- package/templates/common/workflow/linearMethod/zh-CN/linear-method.md +0 -752
- package/templates/common/workflow/refactoringMaster/en/refactoring-master.md +0 -516
- package/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +0 -812
- package/templates/common/workflow/sixStep/en/workflow.md +0 -83
- package/templates/common/workflow/sixStep/zh-CN/workflow.md +0 -359
- package/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +0 -364
- package/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +0 -366
- package/templates/hooks/README.md +0 -212
- package/templates/hooks/git-workflow-hooks.md +0 -551
- package/templates/hooks/post-test/coverage.json +0 -21
- package/templates/hooks/post-test/summary.json +0 -21
- package/templates/hooks/post-test-coverage.md +0 -434
- package/templates/hooks/pre-commit/eslint.json +0 -22
- package/templates/hooks/pre-commit/prettier.json +0 -22
- package/templates/hooks/pre-commit-black.md +0 -274
- package/templates/hooks/pre-commit-eslint.md +0 -153
- package/templates/hooks/pre-commit-gofmt.md +0 -284
- package/templates/hooks/pre-commit-prettier.md +0 -212
- package/templates/hooks/pre-commit-type-check.md +0 -377
- package/templates/skills/basic.hbs +0 -72
- package/templates/skills/ccjk-init.md +0 -154
- package/templates/skills/ccjk-mcp-setup.md +0 -205
- package/templates/skills/ccjk-troubleshoot.md +0 -228
- package/templates/skills/code-refactor.hbs +0 -133
- package/templates/skills/code-review.hbs +0 -141
- package/templates/skills/django-patterns.md +0 -1016
- package/templates/skills/git-workflow.md +0 -748
- package/templates/skills/go-idioms.md +0 -963
- package/templates/skills/index.json +0 -132
- package/templates/skills/nextjs-optimization.md +0 -694
- package/templates/skills/python-pep8.md +0 -852
- package/templates/skills/react-patterns.md +0 -686
- package/templates/skills/rust-patterns.md +0 -1057
- package/templates/skills/security-best-practices.md +0 -1413
- package/templates/skills/testing-best-practices.md +0 -1315
- package/templates/skills/ts-best-practices.md +0 -354
- package/templates/skills/type-fix.hbs +0 -132
package/dist/chunks/index8.mjs
DELETED
|
@@ -1,1602 +0,0 @@
|
|
|
1
|
-
import process__default from 'node:process';
|
|
2
|
-
import { o as onExit } from '../shared/ccjk.Cjgrln_h.mjs';
|
|
3
|
-
import { g as getDefaultExportFromCjs } from '../shared/ccjk.BAGoDD49.mjs';
|
|
4
|
-
import { r as requireCliSpinners } from '../shared/ccjk.DeWpAShp.mjs';
|
|
5
|
-
|
|
6
|
-
const ANSI_BACKGROUND_OFFSET = 10;
|
|
7
|
-
|
|
8
|
-
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
|
9
|
-
|
|
10
|
-
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
|
11
|
-
|
|
12
|
-
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
13
|
-
|
|
14
|
-
const styles$1 = {
|
|
15
|
-
modifier: {
|
|
16
|
-
reset: [0, 0],
|
|
17
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
18
|
-
bold: [1, 22],
|
|
19
|
-
dim: [2, 22],
|
|
20
|
-
italic: [3, 23],
|
|
21
|
-
underline: [4, 24],
|
|
22
|
-
overline: [53, 55],
|
|
23
|
-
inverse: [7, 27],
|
|
24
|
-
hidden: [8, 28],
|
|
25
|
-
strikethrough: [9, 29],
|
|
26
|
-
},
|
|
27
|
-
color: {
|
|
28
|
-
black: [30, 39],
|
|
29
|
-
red: [31, 39],
|
|
30
|
-
green: [32, 39],
|
|
31
|
-
yellow: [33, 39],
|
|
32
|
-
blue: [34, 39],
|
|
33
|
-
magenta: [35, 39],
|
|
34
|
-
cyan: [36, 39],
|
|
35
|
-
white: [37, 39],
|
|
36
|
-
|
|
37
|
-
// Bright color
|
|
38
|
-
blackBright: [90, 39],
|
|
39
|
-
gray: [90, 39], // Alias of `blackBright`
|
|
40
|
-
grey: [90, 39], // Alias of `blackBright`
|
|
41
|
-
redBright: [91, 39],
|
|
42
|
-
greenBright: [92, 39],
|
|
43
|
-
yellowBright: [93, 39],
|
|
44
|
-
blueBright: [94, 39],
|
|
45
|
-
magentaBright: [95, 39],
|
|
46
|
-
cyanBright: [96, 39],
|
|
47
|
-
whiteBright: [97, 39],
|
|
48
|
-
},
|
|
49
|
-
bgColor: {
|
|
50
|
-
bgBlack: [40, 49],
|
|
51
|
-
bgRed: [41, 49],
|
|
52
|
-
bgGreen: [42, 49],
|
|
53
|
-
bgYellow: [43, 49],
|
|
54
|
-
bgBlue: [44, 49],
|
|
55
|
-
bgMagenta: [45, 49],
|
|
56
|
-
bgCyan: [46, 49],
|
|
57
|
-
bgWhite: [47, 49],
|
|
58
|
-
|
|
59
|
-
// Bright color
|
|
60
|
-
bgBlackBright: [100, 49],
|
|
61
|
-
bgGray: [100, 49], // Alias of `bgBlackBright`
|
|
62
|
-
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
|
63
|
-
bgRedBright: [101, 49],
|
|
64
|
-
bgGreenBright: [102, 49],
|
|
65
|
-
bgYellowBright: [103, 49],
|
|
66
|
-
bgBlueBright: [104, 49],
|
|
67
|
-
bgMagentaBright: [105, 49],
|
|
68
|
-
bgCyanBright: [106, 49],
|
|
69
|
-
bgWhiteBright: [107, 49],
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
Object.keys(styles$1.modifier);
|
|
74
|
-
const foregroundColorNames = Object.keys(styles$1.color);
|
|
75
|
-
const backgroundColorNames = Object.keys(styles$1.bgColor);
|
|
76
|
-
[...foregroundColorNames, ...backgroundColorNames];
|
|
77
|
-
|
|
78
|
-
function assembleStyles() {
|
|
79
|
-
const codes = new Map();
|
|
80
|
-
|
|
81
|
-
for (const [groupName, group] of Object.entries(styles$1)) {
|
|
82
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
83
|
-
styles$1[styleName] = {
|
|
84
|
-
open: `\u001B[${style[0]}m`,
|
|
85
|
-
close: `\u001B[${style[1]}m`,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
group[styleName] = styles$1[styleName];
|
|
89
|
-
|
|
90
|
-
codes.set(style[0], style[1]);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
Object.defineProperty(styles$1, groupName, {
|
|
94
|
-
value: group,
|
|
95
|
-
enumerable: false,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
Object.defineProperty(styles$1, 'codes', {
|
|
100
|
-
value: codes,
|
|
101
|
-
enumerable: false,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
styles$1.color.close = '\u001B[39m';
|
|
105
|
-
styles$1.bgColor.close = '\u001B[49m';
|
|
106
|
-
|
|
107
|
-
styles$1.color.ansi = wrapAnsi16();
|
|
108
|
-
styles$1.color.ansi256 = wrapAnsi256();
|
|
109
|
-
styles$1.color.ansi16m = wrapAnsi16m();
|
|
110
|
-
styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
111
|
-
styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
112
|
-
styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
113
|
-
|
|
114
|
-
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
|
115
|
-
Object.defineProperties(styles$1, {
|
|
116
|
-
rgbToAnsi256: {
|
|
117
|
-
value(red, green, blue) {
|
|
118
|
-
// We use the extended greyscale palette here, with the exception of
|
|
119
|
-
// black and white. normal palette only has 4 greyscale shades.
|
|
120
|
-
if (red === green && green === blue) {
|
|
121
|
-
if (red < 8) {
|
|
122
|
-
return 16;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (red > 248) {
|
|
126
|
-
return 231;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return Math.round(((red - 8) / 247) * 24) + 232;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return 16
|
|
133
|
-
+ (36 * Math.round(red / 255 * 5))
|
|
134
|
-
+ (6 * Math.round(green / 255 * 5))
|
|
135
|
-
+ Math.round(blue / 255 * 5);
|
|
136
|
-
},
|
|
137
|
-
enumerable: false,
|
|
138
|
-
},
|
|
139
|
-
hexToRgb: {
|
|
140
|
-
value(hex) {
|
|
141
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
142
|
-
if (!matches) {
|
|
143
|
-
return [0, 0, 0];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
let [colorString] = matches;
|
|
147
|
-
|
|
148
|
-
if (colorString.length === 3) {
|
|
149
|
-
colorString = [...colorString].map(character => character + character).join('');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const integer = Number.parseInt(colorString, 16);
|
|
153
|
-
|
|
154
|
-
return [
|
|
155
|
-
/* eslint-disable no-bitwise */
|
|
156
|
-
(integer >> 16) & 0xFF,
|
|
157
|
-
(integer >> 8) & 0xFF,
|
|
158
|
-
integer & 0xFF,
|
|
159
|
-
/* eslint-enable no-bitwise */
|
|
160
|
-
];
|
|
161
|
-
},
|
|
162
|
-
enumerable: false,
|
|
163
|
-
},
|
|
164
|
-
hexToAnsi256: {
|
|
165
|
-
value: hex => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
|
|
166
|
-
enumerable: false,
|
|
167
|
-
},
|
|
168
|
-
ansi256ToAnsi: {
|
|
169
|
-
value(code) {
|
|
170
|
-
if (code < 8) {
|
|
171
|
-
return 30 + code;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (code < 16) {
|
|
175
|
-
return 90 + (code - 8);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
let red;
|
|
179
|
-
let green;
|
|
180
|
-
let blue;
|
|
181
|
-
|
|
182
|
-
if (code >= 232) {
|
|
183
|
-
red = (((code - 232) * 10) + 8) / 255;
|
|
184
|
-
green = red;
|
|
185
|
-
blue = red;
|
|
186
|
-
} else {
|
|
187
|
-
code -= 16;
|
|
188
|
-
|
|
189
|
-
const remainder = code % 36;
|
|
190
|
-
|
|
191
|
-
red = Math.floor(code / 36) / 5;
|
|
192
|
-
green = Math.floor(remainder / 6) / 5;
|
|
193
|
-
blue = (remainder % 6) / 5;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const value = Math.max(red, green, blue) * 2;
|
|
197
|
-
|
|
198
|
-
if (value === 0) {
|
|
199
|
-
return 30;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// eslint-disable-next-line no-bitwise
|
|
203
|
-
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
|
204
|
-
|
|
205
|
-
if (value === 2) {
|
|
206
|
-
result += 60;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return result;
|
|
210
|
-
},
|
|
211
|
-
enumerable: false,
|
|
212
|
-
},
|
|
213
|
-
rgbToAnsi: {
|
|
214
|
-
value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
|
|
215
|
-
enumerable: false,
|
|
216
|
-
},
|
|
217
|
-
hexToAnsi: {
|
|
218
|
-
value: hex => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
|
|
219
|
-
enumerable: false,
|
|
220
|
-
},
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
return styles$1;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const ansiStyles = assembleStyles();
|
|
227
|
-
|
|
228
|
-
/* eslint-env browser */
|
|
229
|
-
|
|
230
|
-
const level = (() => {
|
|
231
|
-
if (!('navigator' in globalThis)) {
|
|
232
|
-
return 0;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (globalThis.navigator.userAgentData) {
|
|
236
|
-
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
|
|
237
|
-
if (brand && brand.version > 93) {
|
|
238
|
-
return 3;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
|
|
243
|
-
return 1;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return 0;
|
|
247
|
-
})();
|
|
248
|
-
|
|
249
|
-
const colorSupport = level !== 0 && {
|
|
250
|
-
level};
|
|
251
|
-
|
|
252
|
-
const supportsColor = {
|
|
253
|
-
stdout: colorSupport,
|
|
254
|
-
stderr: colorSupport,
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
|
|
258
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
259
|
-
let index = string.indexOf(substring);
|
|
260
|
-
if (index === -1) {
|
|
261
|
-
return string;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const substringLength = substring.length;
|
|
265
|
-
let endIndex = 0;
|
|
266
|
-
let returnValue = '';
|
|
267
|
-
do {
|
|
268
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
269
|
-
endIndex = index + substringLength;
|
|
270
|
-
index = string.indexOf(substring, endIndex);
|
|
271
|
-
} while (index !== -1);
|
|
272
|
-
|
|
273
|
-
returnValue += string.slice(endIndex);
|
|
274
|
-
return returnValue;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
278
|
-
let endIndex = 0;
|
|
279
|
-
let returnValue = '';
|
|
280
|
-
do {
|
|
281
|
-
const gotCR = string[index - 1] === '\r';
|
|
282
|
-
returnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
|
283
|
-
endIndex = index + 1;
|
|
284
|
-
index = string.indexOf('\n', endIndex);
|
|
285
|
-
} while (index !== -1);
|
|
286
|
-
|
|
287
|
-
returnValue += string.slice(endIndex);
|
|
288
|
-
return returnValue;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
|
|
292
|
-
|
|
293
|
-
const GENERATOR = Symbol('GENERATOR');
|
|
294
|
-
const STYLER = Symbol('STYLER');
|
|
295
|
-
const IS_EMPTY = Symbol('IS_EMPTY');
|
|
296
|
-
|
|
297
|
-
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
|
298
|
-
const levelMapping = [
|
|
299
|
-
'ansi',
|
|
300
|
-
'ansi',
|
|
301
|
-
'ansi256',
|
|
302
|
-
'ansi16m',
|
|
303
|
-
];
|
|
304
|
-
|
|
305
|
-
const styles = Object.create(null);
|
|
306
|
-
|
|
307
|
-
const applyOptions = (object, options = {}) => {
|
|
308
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
309
|
-
throw new Error('The `level` option should be an integer from 0 to 3');
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Detect level if not set manually
|
|
313
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
314
|
-
object.level = options.level === undefined ? colorLevel : options.level;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
const chalkFactory = options => {
|
|
318
|
-
const chalk = (...strings) => strings.join(' ');
|
|
319
|
-
applyOptions(chalk, options);
|
|
320
|
-
|
|
321
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
322
|
-
|
|
323
|
-
return chalk;
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
function createChalk(options) {
|
|
327
|
-
return chalkFactory(options);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
331
|
-
|
|
332
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
333
|
-
styles[styleName] = {
|
|
334
|
-
get() {
|
|
335
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
336
|
-
Object.defineProperty(this, styleName, {value: builder});
|
|
337
|
-
return builder;
|
|
338
|
-
},
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
styles.visible = {
|
|
343
|
-
get() {
|
|
344
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
345
|
-
Object.defineProperty(this, 'visible', {value: builder});
|
|
346
|
-
return builder;
|
|
347
|
-
},
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
351
|
-
if (model === 'rgb') {
|
|
352
|
-
if (level === 'ansi16m') {
|
|
353
|
-
return ansiStyles[type].ansi16m(...arguments_);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (level === 'ansi256') {
|
|
357
|
-
return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (model === 'hex') {
|
|
364
|
-
return getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return ansiStyles[type][model](...arguments_);
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
const usedModels = ['rgb', 'hex', 'ansi256'];
|
|
371
|
-
|
|
372
|
-
for (const model of usedModels) {
|
|
373
|
-
styles[model] = {
|
|
374
|
-
get() {
|
|
375
|
-
const {level} = this;
|
|
376
|
-
return function (...arguments_) {
|
|
377
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);
|
|
378
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
379
|
-
};
|
|
380
|
-
},
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
|
384
|
-
styles[bgModel] = {
|
|
385
|
-
get() {
|
|
386
|
-
const {level} = this;
|
|
387
|
-
return function (...arguments_) {
|
|
388
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
|
|
389
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
390
|
-
};
|
|
391
|
-
},
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
const proto = Object.defineProperties(() => {}, {
|
|
396
|
-
...styles,
|
|
397
|
-
level: {
|
|
398
|
-
enumerable: true,
|
|
399
|
-
get() {
|
|
400
|
-
return this[GENERATOR].level;
|
|
401
|
-
},
|
|
402
|
-
set(level) {
|
|
403
|
-
this[GENERATOR].level = level;
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
const createStyler = (open, close, parent) => {
|
|
409
|
-
let openAll;
|
|
410
|
-
let closeAll;
|
|
411
|
-
if (parent === undefined) {
|
|
412
|
-
openAll = open;
|
|
413
|
-
closeAll = close;
|
|
414
|
-
} else {
|
|
415
|
-
openAll = parent.openAll + open;
|
|
416
|
-
closeAll = close + parent.closeAll;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
return {
|
|
420
|
-
open,
|
|
421
|
-
close,
|
|
422
|
-
openAll,
|
|
423
|
-
closeAll,
|
|
424
|
-
parent,
|
|
425
|
-
};
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
const createBuilder = (self, _styler, _isEmpty) => {
|
|
429
|
-
// Single argument is hot path, implicit coercion is faster than anything
|
|
430
|
-
// eslint-disable-next-line no-implicit-coercion
|
|
431
|
-
const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
|
432
|
-
|
|
433
|
-
// We alter the prototype because we must return a function, but there is
|
|
434
|
-
// no way to create a function with a different prototype
|
|
435
|
-
Object.setPrototypeOf(builder, proto);
|
|
436
|
-
|
|
437
|
-
builder[GENERATOR] = self;
|
|
438
|
-
builder[STYLER] = _styler;
|
|
439
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
440
|
-
|
|
441
|
-
return builder;
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
const applyStyle = (self, string) => {
|
|
445
|
-
if (self.level <= 0 || !string) {
|
|
446
|
-
return self[IS_EMPTY] ? '' : string;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
let styler = self[STYLER];
|
|
450
|
-
|
|
451
|
-
if (styler === undefined) {
|
|
452
|
-
return string;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
const {openAll, closeAll} = styler;
|
|
456
|
-
if (string.includes('\u001B')) {
|
|
457
|
-
while (styler !== undefined) {
|
|
458
|
-
// Replace any instances already present with a re-opening code
|
|
459
|
-
// otherwise only the part of the string until said closing code
|
|
460
|
-
// will be colored, and the rest will simply be 'plain'.
|
|
461
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
462
|
-
|
|
463
|
-
styler = styler.parent;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// We can move both next actions out of loop, because remaining actions in loop won't have
|
|
468
|
-
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
|
469
|
-
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
|
470
|
-
const lfIndex = string.indexOf('\n');
|
|
471
|
-
if (lfIndex !== -1) {
|
|
472
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
return openAll + string + closeAll;
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
Object.defineProperties(createChalk.prototype, styles);
|
|
479
|
-
|
|
480
|
-
const chalk = createChalk();
|
|
481
|
-
createChalk({level: stderrColor ? stderrColor.level : 0});
|
|
482
|
-
|
|
483
|
-
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
484
|
-
// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
|
|
485
|
-
// `Function#prototype` is non-writable and non-configurable so can never be modified.
|
|
486
|
-
if (property === 'length' || property === 'prototype') {
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
|
|
491
|
-
if (property === 'arguments' || property === 'caller') {
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
496
|
-
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
497
|
-
|
|
498
|
-
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
Object.defineProperty(to, property, fromDescriptor);
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
// `Object.defineProperty()` throws if the property exists, is not configurable and either:
|
|
506
|
-
// - one its descriptors is changed
|
|
507
|
-
// - it is non-writable and its value is changed
|
|
508
|
-
const canCopyProperty = function (toDescriptor, fromDescriptor) {
|
|
509
|
-
return toDescriptor === undefined || toDescriptor.configurable || (
|
|
510
|
-
toDescriptor.writable === fromDescriptor.writable
|
|
511
|
-
&& toDescriptor.enumerable === fromDescriptor.enumerable
|
|
512
|
-
&& toDescriptor.configurable === fromDescriptor.configurable
|
|
513
|
-
&& (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)
|
|
514
|
-
);
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
const changePrototype = (to, from) => {
|
|
518
|
-
const fromPrototype = Object.getPrototypeOf(from);
|
|
519
|
-
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
Object.setPrototypeOf(to, fromPrototype);
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
|
|
527
|
-
|
|
528
|
-
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
|
|
529
|
-
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
|
|
530
|
-
|
|
531
|
-
// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.
|
|
532
|
-
// We use `bind()` instead of a closure for the same reason.
|
|
533
|
-
// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.
|
|
534
|
-
const changeToString = (to, from, name) => {
|
|
535
|
-
const withName = name === '' ? '' : `with ${name.trim()}() `;
|
|
536
|
-
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
537
|
-
// Ensure `to.toString.toString` is non-enumerable and has the same `same`
|
|
538
|
-
Object.defineProperty(newToString, 'name', toStringName);
|
|
539
|
-
const {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.
|
|
540
|
-
Object.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {
|
|
544
|
-
const {name} = to;
|
|
545
|
-
|
|
546
|
-
for (const property of Reflect.ownKeys(from)) {
|
|
547
|
-
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
changePrototype(to, from);
|
|
551
|
-
changeToString(to, from, name);
|
|
552
|
-
|
|
553
|
-
return to;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
const calledFunctions = new WeakMap();
|
|
557
|
-
|
|
558
|
-
const onetime = (function_, options = {}) => {
|
|
559
|
-
if (typeof function_ !== 'function') {
|
|
560
|
-
throw new TypeError('Expected a function');
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
let returnValue;
|
|
564
|
-
let callCount = 0;
|
|
565
|
-
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
566
|
-
|
|
567
|
-
const onetime = function (...arguments_) {
|
|
568
|
-
calledFunctions.set(onetime, ++callCount);
|
|
569
|
-
|
|
570
|
-
if (callCount === 1) {
|
|
571
|
-
returnValue = function_.apply(this, arguments_);
|
|
572
|
-
function_ = undefined;
|
|
573
|
-
} else if (options.throw === true) {
|
|
574
|
-
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
return returnValue;
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
mimicFunction(onetime, function_);
|
|
581
|
-
calledFunctions.set(onetime, callCount);
|
|
582
|
-
|
|
583
|
-
return onetime;
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
onetime.callCount = function_ => {
|
|
587
|
-
if (!calledFunctions.has(function_)) {
|
|
588
|
-
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
return calledFunctions.get(function_);
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
const terminal = process__default.stderr.isTTY
|
|
595
|
-
? process__default.stderr
|
|
596
|
-
: (process__default.stdout.isTTY ? process__default.stdout : undefined);
|
|
597
|
-
|
|
598
|
-
const restoreCursor = terminal ? onetime(() => {
|
|
599
|
-
onExit(() => {
|
|
600
|
-
terminal.write('\u001B[?25h');
|
|
601
|
-
}, {alwaysLast: true});
|
|
602
|
-
}) : () => {};
|
|
603
|
-
|
|
604
|
-
let isHidden = false;
|
|
605
|
-
|
|
606
|
-
const cliCursor = {};
|
|
607
|
-
|
|
608
|
-
cliCursor.show = (writableStream = process__default.stderr) => {
|
|
609
|
-
if (!writableStream.isTTY) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
isHidden = false;
|
|
614
|
-
writableStream.write('\u001B[?25h');
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
cliCursor.hide = (writableStream = process__default.stderr) => {
|
|
618
|
-
if (!writableStream.isTTY) {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
restoreCursor();
|
|
623
|
-
isHidden = true;
|
|
624
|
-
writableStream.write('\u001B[?25l');
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
cliCursor.toggle = (force, writableStream) => {
|
|
628
|
-
if (force !== undefined) {
|
|
629
|
-
isHidden = force;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
if (isHidden) {
|
|
633
|
-
cliCursor.show(writableStream);
|
|
634
|
-
} else {
|
|
635
|
-
cliCursor.hide(writableStream);
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
var cliSpinnersExports = requireCliSpinners();
|
|
640
|
-
const cliSpinners = /*@__PURE__*/getDefaultExportFromCjs(cliSpinnersExports);
|
|
641
|
-
|
|
642
|
-
const logSymbols = {
|
|
643
|
-
info: 'ℹ️',
|
|
644
|
-
success: '✅',
|
|
645
|
-
warning: '⚠️',
|
|
646
|
-
error: '❌️',
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
function ansiRegex({onlyFirst = false} = {}) {
|
|
650
|
-
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
651
|
-
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
|
652
|
-
const pattern = [
|
|
653
|
-
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
654
|
-
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
655
|
-
].join('|');
|
|
656
|
-
|
|
657
|
-
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
const regex = ansiRegex();
|
|
661
|
-
|
|
662
|
-
function stripAnsi(string) {
|
|
663
|
-
if (typeof string !== 'string') {
|
|
664
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
668
|
-
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
669
|
-
// and doing it manually has a performance penalty.
|
|
670
|
-
return string.replace(regex, '');
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
// Generated code.
|
|
674
|
-
|
|
675
|
-
function isAmbiguous(x) {
|
|
676
|
-
return x === 0xA1
|
|
677
|
-
|| x === 0xA4
|
|
678
|
-
|| x === 0xA7
|
|
679
|
-
|| x === 0xA8
|
|
680
|
-
|| x === 0xAA
|
|
681
|
-
|| x === 0xAD
|
|
682
|
-
|| x === 0xAE
|
|
683
|
-
|| x >= 0xB0 && x <= 0xB4
|
|
684
|
-
|| x >= 0xB6 && x <= 0xBA
|
|
685
|
-
|| x >= 0xBC && x <= 0xBF
|
|
686
|
-
|| x === 0xC6
|
|
687
|
-
|| x === 0xD0
|
|
688
|
-
|| x === 0xD7
|
|
689
|
-
|| x === 0xD8
|
|
690
|
-
|| x >= 0xDE && x <= 0xE1
|
|
691
|
-
|| x === 0xE6
|
|
692
|
-
|| x >= 0xE8 && x <= 0xEA
|
|
693
|
-
|| x === 0xEC
|
|
694
|
-
|| x === 0xED
|
|
695
|
-
|| x === 0xF0
|
|
696
|
-
|| x === 0xF2
|
|
697
|
-
|| x === 0xF3
|
|
698
|
-
|| x >= 0xF7 && x <= 0xFA
|
|
699
|
-
|| x === 0xFC
|
|
700
|
-
|| x === 0xFE
|
|
701
|
-
|| x === 0x101
|
|
702
|
-
|| x === 0x111
|
|
703
|
-
|| x === 0x113
|
|
704
|
-
|| x === 0x11B
|
|
705
|
-
|| x === 0x126
|
|
706
|
-
|| x === 0x127
|
|
707
|
-
|| x === 0x12B
|
|
708
|
-
|| x >= 0x131 && x <= 0x133
|
|
709
|
-
|| x === 0x138
|
|
710
|
-
|| x >= 0x13F && x <= 0x142
|
|
711
|
-
|| x === 0x144
|
|
712
|
-
|| x >= 0x148 && x <= 0x14B
|
|
713
|
-
|| x === 0x14D
|
|
714
|
-
|| x === 0x152
|
|
715
|
-
|| x === 0x153
|
|
716
|
-
|| x === 0x166
|
|
717
|
-
|| x === 0x167
|
|
718
|
-
|| x === 0x16B
|
|
719
|
-
|| x === 0x1CE
|
|
720
|
-
|| x === 0x1D0
|
|
721
|
-
|| x === 0x1D2
|
|
722
|
-
|| x === 0x1D4
|
|
723
|
-
|| x === 0x1D6
|
|
724
|
-
|| x === 0x1D8
|
|
725
|
-
|| x === 0x1DA
|
|
726
|
-
|| x === 0x1DC
|
|
727
|
-
|| x === 0x251
|
|
728
|
-
|| x === 0x261
|
|
729
|
-
|| x === 0x2C4
|
|
730
|
-
|| x === 0x2C7
|
|
731
|
-
|| x >= 0x2C9 && x <= 0x2CB
|
|
732
|
-
|| x === 0x2CD
|
|
733
|
-
|| x === 0x2D0
|
|
734
|
-
|| x >= 0x2D8 && x <= 0x2DB
|
|
735
|
-
|| x === 0x2DD
|
|
736
|
-
|| x === 0x2DF
|
|
737
|
-
|| x >= 0x300 && x <= 0x36F
|
|
738
|
-
|| x >= 0x391 && x <= 0x3A1
|
|
739
|
-
|| x >= 0x3A3 && x <= 0x3A9
|
|
740
|
-
|| x >= 0x3B1 && x <= 0x3C1
|
|
741
|
-
|| x >= 0x3C3 && x <= 0x3C9
|
|
742
|
-
|| x === 0x401
|
|
743
|
-
|| x >= 0x410 && x <= 0x44F
|
|
744
|
-
|| x === 0x451
|
|
745
|
-
|| x === 0x2010
|
|
746
|
-
|| x >= 0x2013 && x <= 0x2016
|
|
747
|
-
|| x === 0x2018
|
|
748
|
-
|| x === 0x2019
|
|
749
|
-
|| x === 0x201C
|
|
750
|
-
|| x === 0x201D
|
|
751
|
-
|| x >= 0x2020 && x <= 0x2022
|
|
752
|
-
|| x >= 0x2024 && x <= 0x2027
|
|
753
|
-
|| x === 0x2030
|
|
754
|
-
|| x === 0x2032
|
|
755
|
-
|| x === 0x2033
|
|
756
|
-
|| x === 0x2035
|
|
757
|
-
|| x === 0x203B
|
|
758
|
-
|| x === 0x203E
|
|
759
|
-
|| x === 0x2074
|
|
760
|
-
|| x === 0x207F
|
|
761
|
-
|| x >= 0x2081 && x <= 0x2084
|
|
762
|
-
|| x === 0x20AC
|
|
763
|
-
|| x === 0x2103
|
|
764
|
-
|| x === 0x2105
|
|
765
|
-
|| x === 0x2109
|
|
766
|
-
|| x === 0x2113
|
|
767
|
-
|| x === 0x2116
|
|
768
|
-
|| x === 0x2121
|
|
769
|
-
|| x === 0x2122
|
|
770
|
-
|| x === 0x2126
|
|
771
|
-
|| x === 0x212B
|
|
772
|
-
|| x === 0x2153
|
|
773
|
-
|| x === 0x2154
|
|
774
|
-
|| x >= 0x215B && x <= 0x215E
|
|
775
|
-
|| x >= 0x2160 && x <= 0x216B
|
|
776
|
-
|| x >= 0x2170 && x <= 0x2179
|
|
777
|
-
|| x === 0x2189
|
|
778
|
-
|| x >= 0x2190 && x <= 0x2199
|
|
779
|
-
|| x === 0x21B8
|
|
780
|
-
|| x === 0x21B9
|
|
781
|
-
|| x === 0x21D2
|
|
782
|
-
|| x === 0x21D4
|
|
783
|
-
|| x === 0x21E7
|
|
784
|
-
|| x === 0x2200
|
|
785
|
-
|| x === 0x2202
|
|
786
|
-
|| x === 0x2203
|
|
787
|
-
|| x === 0x2207
|
|
788
|
-
|| x === 0x2208
|
|
789
|
-
|| x === 0x220B
|
|
790
|
-
|| x === 0x220F
|
|
791
|
-
|| x === 0x2211
|
|
792
|
-
|| x === 0x2215
|
|
793
|
-
|| x === 0x221A
|
|
794
|
-
|| x >= 0x221D && x <= 0x2220
|
|
795
|
-
|| x === 0x2223
|
|
796
|
-
|| x === 0x2225
|
|
797
|
-
|| x >= 0x2227 && x <= 0x222C
|
|
798
|
-
|| x === 0x222E
|
|
799
|
-
|| x >= 0x2234 && x <= 0x2237
|
|
800
|
-
|| x === 0x223C
|
|
801
|
-
|| x === 0x223D
|
|
802
|
-
|| x === 0x2248
|
|
803
|
-
|| x === 0x224C
|
|
804
|
-
|| x === 0x2252
|
|
805
|
-
|| x === 0x2260
|
|
806
|
-
|| x === 0x2261
|
|
807
|
-
|| x >= 0x2264 && x <= 0x2267
|
|
808
|
-
|| x === 0x226A
|
|
809
|
-
|| x === 0x226B
|
|
810
|
-
|| x === 0x226E
|
|
811
|
-
|| x === 0x226F
|
|
812
|
-
|| x === 0x2282
|
|
813
|
-
|| x === 0x2283
|
|
814
|
-
|| x === 0x2286
|
|
815
|
-
|| x === 0x2287
|
|
816
|
-
|| x === 0x2295
|
|
817
|
-
|| x === 0x2299
|
|
818
|
-
|| x === 0x22A5
|
|
819
|
-
|| x === 0x22BF
|
|
820
|
-
|| x === 0x2312
|
|
821
|
-
|| x >= 0x2460 && x <= 0x24E9
|
|
822
|
-
|| x >= 0x24EB && x <= 0x254B
|
|
823
|
-
|| x >= 0x2550 && x <= 0x2573
|
|
824
|
-
|| x >= 0x2580 && x <= 0x258F
|
|
825
|
-
|| x >= 0x2592 && x <= 0x2595
|
|
826
|
-
|| x === 0x25A0
|
|
827
|
-
|| x === 0x25A1
|
|
828
|
-
|| x >= 0x25A3 && x <= 0x25A9
|
|
829
|
-
|| x === 0x25B2
|
|
830
|
-
|| x === 0x25B3
|
|
831
|
-
|| x === 0x25B6
|
|
832
|
-
|| x === 0x25B7
|
|
833
|
-
|| x === 0x25BC
|
|
834
|
-
|| x === 0x25BD
|
|
835
|
-
|| x === 0x25C0
|
|
836
|
-
|| x === 0x25C1
|
|
837
|
-
|| x >= 0x25C6 && x <= 0x25C8
|
|
838
|
-
|| x === 0x25CB
|
|
839
|
-
|| x >= 0x25CE && x <= 0x25D1
|
|
840
|
-
|| x >= 0x25E2 && x <= 0x25E5
|
|
841
|
-
|| x === 0x25EF
|
|
842
|
-
|| x === 0x2605
|
|
843
|
-
|| x === 0x2606
|
|
844
|
-
|| x === 0x2609
|
|
845
|
-
|| x === 0x260E
|
|
846
|
-
|| x === 0x260F
|
|
847
|
-
|| x === 0x261C
|
|
848
|
-
|| x === 0x261E
|
|
849
|
-
|| x === 0x2640
|
|
850
|
-
|| x === 0x2642
|
|
851
|
-
|| x === 0x2660
|
|
852
|
-
|| x === 0x2661
|
|
853
|
-
|| x >= 0x2663 && x <= 0x2665
|
|
854
|
-
|| x >= 0x2667 && x <= 0x266A
|
|
855
|
-
|| x === 0x266C
|
|
856
|
-
|| x === 0x266D
|
|
857
|
-
|| x === 0x266F
|
|
858
|
-
|| x === 0x269E
|
|
859
|
-
|| x === 0x269F
|
|
860
|
-
|| x === 0x26BF
|
|
861
|
-
|| x >= 0x26C6 && x <= 0x26CD
|
|
862
|
-
|| x >= 0x26CF && x <= 0x26D3
|
|
863
|
-
|| x >= 0x26D5 && x <= 0x26E1
|
|
864
|
-
|| x === 0x26E3
|
|
865
|
-
|| x === 0x26E8
|
|
866
|
-
|| x === 0x26E9
|
|
867
|
-
|| x >= 0x26EB && x <= 0x26F1
|
|
868
|
-
|| x === 0x26F4
|
|
869
|
-
|| x >= 0x26F6 && x <= 0x26F9
|
|
870
|
-
|| x === 0x26FB
|
|
871
|
-
|| x === 0x26FC
|
|
872
|
-
|| x === 0x26FE
|
|
873
|
-
|| x === 0x26FF
|
|
874
|
-
|| x === 0x273D
|
|
875
|
-
|| x >= 0x2776 && x <= 0x277F
|
|
876
|
-
|| x >= 0x2B56 && x <= 0x2B59
|
|
877
|
-
|| x >= 0x3248 && x <= 0x324F
|
|
878
|
-
|| x >= 0xE000 && x <= 0xF8FF
|
|
879
|
-
|| x >= 0xFE00 && x <= 0xFE0F
|
|
880
|
-
|| x === 0xFFFD
|
|
881
|
-
|| x >= 0x1F100 && x <= 0x1F10A
|
|
882
|
-
|| x >= 0x1F110 && x <= 0x1F12D
|
|
883
|
-
|| x >= 0x1F130 && x <= 0x1F169
|
|
884
|
-
|| x >= 0x1F170 && x <= 0x1F18D
|
|
885
|
-
|| x === 0x1F18F
|
|
886
|
-
|| x === 0x1F190
|
|
887
|
-
|| x >= 0x1F19B && x <= 0x1F1AC
|
|
888
|
-
|| x >= 0xE0100 && x <= 0xE01EF
|
|
889
|
-
|| x >= 0xF0000 && x <= 0xFFFFD
|
|
890
|
-
|| x >= 0x100000 && x <= 0x10FFFD;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
function isFullWidth(x) {
|
|
894
|
-
return x === 0x3000
|
|
895
|
-
|| x >= 0xFF01 && x <= 0xFF60
|
|
896
|
-
|| x >= 0xFFE0 && x <= 0xFFE6;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
function isWide(x) {
|
|
900
|
-
return x >= 0x1100 && x <= 0x115F
|
|
901
|
-
|| x === 0x231A
|
|
902
|
-
|| x === 0x231B
|
|
903
|
-
|| x === 0x2329
|
|
904
|
-
|| x === 0x232A
|
|
905
|
-
|| x >= 0x23E9 && x <= 0x23EC
|
|
906
|
-
|| x === 0x23F0
|
|
907
|
-
|| x === 0x23F3
|
|
908
|
-
|| x === 0x25FD
|
|
909
|
-
|| x === 0x25FE
|
|
910
|
-
|| x === 0x2614
|
|
911
|
-
|| x === 0x2615
|
|
912
|
-
|| x >= 0x2630 && x <= 0x2637
|
|
913
|
-
|| x >= 0x2648 && x <= 0x2653
|
|
914
|
-
|| x === 0x267F
|
|
915
|
-
|| x >= 0x268A && x <= 0x268F
|
|
916
|
-
|| x === 0x2693
|
|
917
|
-
|| x === 0x26A1
|
|
918
|
-
|| x === 0x26AA
|
|
919
|
-
|| x === 0x26AB
|
|
920
|
-
|| x === 0x26BD
|
|
921
|
-
|| x === 0x26BE
|
|
922
|
-
|| x === 0x26C4
|
|
923
|
-
|| x === 0x26C5
|
|
924
|
-
|| x === 0x26CE
|
|
925
|
-
|| x === 0x26D4
|
|
926
|
-
|| x === 0x26EA
|
|
927
|
-
|| x === 0x26F2
|
|
928
|
-
|| x === 0x26F3
|
|
929
|
-
|| x === 0x26F5
|
|
930
|
-
|| x === 0x26FA
|
|
931
|
-
|| x === 0x26FD
|
|
932
|
-
|| x === 0x2705
|
|
933
|
-
|| x === 0x270A
|
|
934
|
-
|| x === 0x270B
|
|
935
|
-
|| x === 0x2728
|
|
936
|
-
|| x === 0x274C
|
|
937
|
-
|| x === 0x274E
|
|
938
|
-
|| x >= 0x2753 && x <= 0x2755
|
|
939
|
-
|| x === 0x2757
|
|
940
|
-
|| x >= 0x2795 && x <= 0x2797
|
|
941
|
-
|| x === 0x27B0
|
|
942
|
-
|| x === 0x27BF
|
|
943
|
-
|| x === 0x2B1B
|
|
944
|
-
|| x === 0x2B1C
|
|
945
|
-
|| x === 0x2B50
|
|
946
|
-
|| x === 0x2B55
|
|
947
|
-
|| x >= 0x2E80 && x <= 0x2E99
|
|
948
|
-
|| x >= 0x2E9B && x <= 0x2EF3
|
|
949
|
-
|| x >= 0x2F00 && x <= 0x2FD5
|
|
950
|
-
|| x >= 0x2FF0 && x <= 0x2FFF
|
|
951
|
-
|| x >= 0x3001 && x <= 0x303E
|
|
952
|
-
|| x >= 0x3041 && x <= 0x3096
|
|
953
|
-
|| x >= 0x3099 && x <= 0x30FF
|
|
954
|
-
|| x >= 0x3105 && x <= 0x312F
|
|
955
|
-
|| x >= 0x3131 && x <= 0x318E
|
|
956
|
-
|| x >= 0x3190 && x <= 0x31E5
|
|
957
|
-
|| x >= 0x31EF && x <= 0x321E
|
|
958
|
-
|| x >= 0x3220 && x <= 0x3247
|
|
959
|
-
|| x >= 0x3250 && x <= 0xA48C
|
|
960
|
-
|| x >= 0xA490 && x <= 0xA4C6
|
|
961
|
-
|| x >= 0xA960 && x <= 0xA97C
|
|
962
|
-
|| x >= 0xAC00 && x <= 0xD7A3
|
|
963
|
-
|| x >= 0xF900 && x <= 0xFAFF
|
|
964
|
-
|| x >= 0xFE10 && x <= 0xFE19
|
|
965
|
-
|| x >= 0xFE30 && x <= 0xFE52
|
|
966
|
-
|| x >= 0xFE54 && x <= 0xFE66
|
|
967
|
-
|| x >= 0xFE68 && x <= 0xFE6B
|
|
968
|
-
|| x >= 0x16FE0 && x <= 0x16FE4
|
|
969
|
-
|| x === 0x16FF0
|
|
970
|
-
|| x === 0x16FF1
|
|
971
|
-
|| x >= 0x17000 && x <= 0x187F7
|
|
972
|
-
|| x >= 0x18800 && x <= 0x18CD5
|
|
973
|
-
|| x >= 0x18CFF && x <= 0x18D08
|
|
974
|
-
|| x >= 0x1AFF0 && x <= 0x1AFF3
|
|
975
|
-
|| x >= 0x1AFF5 && x <= 0x1AFFB
|
|
976
|
-
|| x === 0x1AFFD
|
|
977
|
-
|| x === 0x1AFFE
|
|
978
|
-
|| x >= 0x1B000 && x <= 0x1B122
|
|
979
|
-
|| x === 0x1B132
|
|
980
|
-
|| x >= 0x1B150 && x <= 0x1B152
|
|
981
|
-
|| x === 0x1B155
|
|
982
|
-
|| x >= 0x1B164 && x <= 0x1B167
|
|
983
|
-
|| x >= 0x1B170 && x <= 0x1B2FB
|
|
984
|
-
|| x >= 0x1D300 && x <= 0x1D356
|
|
985
|
-
|| x >= 0x1D360 && x <= 0x1D376
|
|
986
|
-
|| x === 0x1F004
|
|
987
|
-
|| x === 0x1F0CF
|
|
988
|
-
|| x === 0x1F18E
|
|
989
|
-
|| x >= 0x1F191 && x <= 0x1F19A
|
|
990
|
-
|| x >= 0x1F200 && x <= 0x1F202
|
|
991
|
-
|| x >= 0x1F210 && x <= 0x1F23B
|
|
992
|
-
|| x >= 0x1F240 && x <= 0x1F248
|
|
993
|
-
|| x === 0x1F250
|
|
994
|
-
|| x === 0x1F251
|
|
995
|
-
|| x >= 0x1F260 && x <= 0x1F265
|
|
996
|
-
|| x >= 0x1F300 && x <= 0x1F320
|
|
997
|
-
|| x >= 0x1F32D && x <= 0x1F335
|
|
998
|
-
|| x >= 0x1F337 && x <= 0x1F37C
|
|
999
|
-
|| x >= 0x1F37E && x <= 0x1F393
|
|
1000
|
-
|| x >= 0x1F3A0 && x <= 0x1F3CA
|
|
1001
|
-
|| x >= 0x1F3CF && x <= 0x1F3D3
|
|
1002
|
-
|| x >= 0x1F3E0 && x <= 0x1F3F0
|
|
1003
|
-
|| x === 0x1F3F4
|
|
1004
|
-
|| x >= 0x1F3F8 && x <= 0x1F43E
|
|
1005
|
-
|| x === 0x1F440
|
|
1006
|
-
|| x >= 0x1F442 && x <= 0x1F4FC
|
|
1007
|
-
|| x >= 0x1F4FF && x <= 0x1F53D
|
|
1008
|
-
|| x >= 0x1F54B && x <= 0x1F54E
|
|
1009
|
-
|| x >= 0x1F550 && x <= 0x1F567
|
|
1010
|
-
|| x === 0x1F57A
|
|
1011
|
-
|| x === 0x1F595
|
|
1012
|
-
|| x === 0x1F596
|
|
1013
|
-
|| x === 0x1F5A4
|
|
1014
|
-
|| x >= 0x1F5FB && x <= 0x1F64F
|
|
1015
|
-
|| x >= 0x1F680 && x <= 0x1F6C5
|
|
1016
|
-
|| x === 0x1F6CC
|
|
1017
|
-
|| x >= 0x1F6D0 && x <= 0x1F6D2
|
|
1018
|
-
|| x >= 0x1F6D5 && x <= 0x1F6D7
|
|
1019
|
-
|| x >= 0x1F6DC && x <= 0x1F6DF
|
|
1020
|
-
|| x === 0x1F6EB
|
|
1021
|
-
|| x === 0x1F6EC
|
|
1022
|
-
|| x >= 0x1F6F4 && x <= 0x1F6FC
|
|
1023
|
-
|| x >= 0x1F7E0 && x <= 0x1F7EB
|
|
1024
|
-
|| x === 0x1F7F0
|
|
1025
|
-
|| x >= 0x1F90C && x <= 0x1F93A
|
|
1026
|
-
|| x >= 0x1F93C && x <= 0x1F945
|
|
1027
|
-
|| x >= 0x1F947 && x <= 0x1F9FF
|
|
1028
|
-
|| x >= 0x1FA70 && x <= 0x1FA7C
|
|
1029
|
-
|| x >= 0x1FA80 && x <= 0x1FA89
|
|
1030
|
-
|| x >= 0x1FA8F && x <= 0x1FAC6
|
|
1031
|
-
|| x >= 0x1FACE && x <= 0x1FADC
|
|
1032
|
-
|| x >= 0x1FADF && x <= 0x1FAE9
|
|
1033
|
-
|| x >= 0x1FAF0 && x <= 0x1FAF8
|
|
1034
|
-
|| x >= 0x20000 && x <= 0x2FFFD
|
|
1035
|
-
|| x >= 0x30000 && x <= 0x3FFFD;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
function validate(codePoint) {
|
|
1039
|
-
if (!Number.isSafeInteger(codePoint)) {
|
|
1040
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
1045
|
-
validate(codePoint);
|
|
1046
|
-
|
|
1047
|
-
if (
|
|
1048
|
-
isFullWidth(codePoint)
|
|
1049
|
-
|| isWide(codePoint)
|
|
1050
|
-
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
1051
|
-
) {
|
|
1052
|
-
return 2;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
return 1;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
const emojiRegex = () => {
|
|
1059
|
-
// https://mths.be/emoji
|
|
1060
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
const segmenter = new Intl.Segmenter();
|
|
1064
|
-
|
|
1065
|
-
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1066
|
-
|
|
1067
|
-
function stringWidth(string, options = {}) {
|
|
1068
|
-
if (typeof string !== 'string' || string.length === 0) {
|
|
1069
|
-
return 0;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
const {
|
|
1073
|
-
ambiguousIsNarrow = true,
|
|
1074
|
-
countAnsiEscapeCodes = false,
|
|
1075
|
-
} = options;
|
|
1076
|
-
|
|
1077
|
-
if (!countAnsiEscapeCodes) {
|
|
1078
|
-
string = stripAnsi(string);
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
if (string.length === 0) {
|
|
1082
|
-
return 0;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
let width = 0;
|
|
1086
|
-
const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
|
|
1087
|
-
|
|
1088
|
-
for (const {segment: character} of segmenter.segment(string)) {
|
|
1089
|
-
const codePoint = character.codePointAt(0);
|
|
1090
|
-
|
|
1091
|
-
// Ignore control characters
|
|
1092
|
-
if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
|
|
1093
|
-
continue;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
// Ignore zero-width characters
|
|
1097
|
-
if (
|
|
1098
|
-
(codePoint >= 0x20_0B && codePoint <= 0x20_0F) // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
|
1099
|
-
|| codePoint === 0xFE_FF // Zero-width no-break space
|
|
1100
|
-
) {
|
|
1101
|
-
continue;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
// Ignore combining characters
|
|
1105
|
-
if (
|
|
1106
|
-
(codePoint >= 0x3_00 && codePoint <= 0x3_6F) // Combining diacritical marks
|
|
1107
|
-
|| (codePoint >= 0x1A_B0 && codePoint <= 0x1A_FF) // Combining diacritical marks extended
|
|
1108
|
-
|| (codePoint >= 0x1D_C0 && codePoint <= 0x1D_FF) // Combining diacritical marks supplement
|
|
1109
|
-
|| (codePoint >= 0x20_D0 && codePoint <= 0x20_FF) // Combining diacritical marks for symbols
|
|
1110
|
-
|| (codePoint >= 0xFE_20 && codePoint <= 0xFE_2F) // Combining half marks
|
|
1111
|
-
) {
|
|
1112
|
-
continue;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
// Ignore surrogate pairs
|
|
1116
|
-
if (codePoint >= 0xD8_00 && codePoint <= 0xDF_FF) {
|
|
1117
|
-
continue;
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
// Ignore variation selectors
|
|
1121
|
-
if (codePoint >= 0xFE_00 && codePoint <= 0xFE_0F) {
|
|
1122
|
-
continue;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
// This covers some of the above cases, but we still keep them for performance reasons.
|
|
1126
|
-
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1127
|
-
continue;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
// TODO: Use `/\p{RGI_Emoji}/v` when targeting Node.js 20.
|
|
1131
|
-
if (emojiRegex().test(character)) {
|
|
1132
|
-
width += 2;
|
|
1133
|
-
continue;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
return width;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
function isInteractive({stream = process.stdout} = {}) {
|
|
1143
|
-
return Boolean(
|
|
1144
|
-
stream && stream.isTTY &&
|
|
1145
|
-
process.env.TERM !== 'dumb' &&
|
|
1146
|
-
!('CI' in process.env)
|
|
1147
|
-
);
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
function isUnicodeSupported() {
|
|
1151
|
-
const {env} = process__default;
|
|
1152
|
-
const {TERM, TERM_PROGRAM} = env;
|
|
1153
|
-
|
|
1154
|
-
if (process__default.platform !== 'win32') {
|
|
1155
|
-
return TERM !== 'linux'; // Linux console (kernel)
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
return Boolean(env.WT_SESSION) // Windows Terminal
|
|
1159
|
-
|| Boolean(env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
|
|
1160
|
-
|| env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
|
|
1161
|
-
|| TERM_PROGRAM === 'Terminus-Sublime'
|
|
1162
|
-
|| TERM_PROGRAM === 'vscode'
|
|
1163
|
-
|| TERM === 'xterm-256color'
|
|
1164
|
-
|| TERM === 'alacritty'
|
|
1165
|
-
|| TERM === 'rxvt-unicode'
|
|
1166
|
-
|| TERM === 'rxvt-unicode-256color'
|
|
1167
|
-
|| env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
const ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code
|
|
1171
|
-
|
|
1172
|
-
class StdinDiscarder {
|
|
1173
|
-
#activeCount = 0;
|
|
1174
|
-
|
|
1175
|
-
start() {
|
|
1176
|
-
this.#activeCount++;
|
|
1177
|
-
|
|
1178
|
-
if (this.#activeCount === 1) {
|
|
1179
|
-
this.#realStart();
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
stop() {
|
|
1184
|
-
if (this.#activeCount <= 0) {
|
|
1185
|
-
throw new Error('`stop` called more times than `start`');
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
this.#activeCount--;
|
|
1189
|
-
|
|
1190
|
-
if (this.#activeCount === 0) {
|
|
1191
|
-
this.#realStop();
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
#realStart() {
|
|
1196
|
-
// No known way to make it work reliably on Windows.
|
|
1197
|
-
if (process__default.platform === 'win32' || !process__default.stdin.isTTY) {
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
process__default.stdin.setRawMode(true);
|
|
1202
|
-
process__default.stdin.on('data', this.#handleInput);
|
|
1203
|
-
process__default.stdin.resume();
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
#realStop() {
|
|
1207
|
-
if (!process__default.stdin.isTTY) {
|
|
1208
|
-
return;
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
process__default.stdin.off('data', this.#handleInput);
|
|
1212
|
-
process__default.stdin.pause();
|
|
1213
|
-
process__default.stdin.setRawMode(false);
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
#handleInput(chunk) {
|
|
1217
|
-
// Allow Ctrl+C to gracefully exit.
|
|
1218
|
-
if (chunk[0] === ASCII_ETX_CODE) {
|
|
1219
|
-
process__default.emit('SIGINT');
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
const stdinDiscarder = new StdinDiscarder();
|
|
1225
|
-
|
|
1226
|
-
class Ora {
|
|
1227
|
-
#linesToClear = 0;
|
|
1228
|
-
#isDiscardingStdin = false;
|
|
1229
|
-
#lineCount = 0;
|
|
1230
|
-
#frameIndex = -1;
|
|
1231
|
-
#lastSpinnerFrameTime = 0;
|
|
1232
|
-
#options;
|
|
1233
|
-
#spinner;
|
|
1234
|
-
#stream;
|
|
1235
|
-
#id;
|
|
1236
|
-
#initialInterval;
|
|
1237
|
-
#isEnabled;
|
|
1238
|
-
#isSilent;
|
|
1239
|
-
#indent;
|
|
1240
|
-
#text;
|
|
1241
|
-
#prefixText;
|
|
1242
|
-
#suffixText;
|
|
1243
|
-
color;
|
|
1244
|
-
|
|
1245
|
-
constructor(options) {
|
|
1246
|
-
if (typeof options === 'string') {
|
|
1247
|
-
options = {
|
|
1248
|
-
text: options,
|
|
1249
|
-
};
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
this.#options = {
|
|
1253
|
-
color: 'cyan',
|
|
1254
|
-
stream: process__default.stderr,
|
|
1255
|
-
discardStdin: true,
|
|
1256
|
-
hideCursor: true,
|
|
1257
|
-
...options,
|
|
1258
|
-
};
|
|
1259
|
-
|
|
1260
|
-
// Public
|
|
1261
|
-
this.color = this.#options.color;
|
|
1262
|
-
|
|
1263
|
-
// It's important that these use the public setters.
|
|
1264
|
-
this.spinner = this.#options.spinner;
|
|
1265
|
-
|
|
1266
|
-
this.#initialInterval = this.#options.interval;
|
|
1267
|
-
this.#stream = this.#options.stream;
|
|
1268
|
-
this.#isEnabled = typeof this.#options.isEnabled === 'boolean' ? this.#options.isEnabled : isInteractive({stream: this.#stream});
|
|
1269
|
-
this.#isSilent = typeof this.#options.isSilent === 'boolean' ? this.#options.isSilent : false;
|
|
1270
|
-
|
|
1271
|
-
// Set *after* `this.#stream`.
|
|
1272
|
-
// It's important that these use the public setters.
|
|
1273
|
-
this.text = this.#options.text;
|
|
1274
|
-
this.prefixText = this.#options.prefixText;
|
|
1275
|
-
this.suffixText = this.#options.suffixText;
|
|
1276
|
-
this.indent = this.#options.indent;
|
|
1277
|
-
|
|
1278
|
-
if (process__default.env.NODE_ENV === 'test') {
|
|
1279
|
-
this._stream = this.#stream;
|
|
1280
|
-
this._isEnabled = this.#isEnabled;
|
|
1281
|
-
|
|
1282
|
-
Object.defineProperty(this, '_linesToClear', {
|
|
1283
|
-
get() {
|
|
1284
|
-
return this.#linesToClear;
|
|
1285
|
-
},
|
|
1286
|
-
set(newValue) {
|
|
1287
|
-
this.#linesToClear = newValue;
|
|
1288
|
-
},
|
|
1289
|
-
});
|
|
1290
|
-
|
|
1291
|
-
Object.defineProperty(this, '_frameIndex', {
|
|
1292
|
-
get() {
|
|
1293
|
-
return this.#frameIndex;
|
|
1294
|
-
},
|
|
1295
|
-
});
|
|
1296
|
-
|
|
1297
|
-
Object.defineProperty(this, '_lineCount', {
|
|
1298
|
-
get() {
|
|
1299
|
-
return this.#lineCount;
|
|
1300
|
-
},
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
get indent() {
|
|
1306
|
-
return this.#indent;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
set indent(indent = 0) {
|
|
1310
|
-
if (!(indent >= 0 && Number.isInteger(indent))) {
|
|
1311
|
-
throw new Error('The `indent` option must be an integer from 0 and up');
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
this.#indent = indent;
|
|
1315
|
-
this.#updateLineCount();
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
get interval() {
|
|
1319
|
-
return this.#initialInterval ?? this.#spinner.interval ?? 100;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
get spinner() {
|
|
1323
|
-
return this.#spinner;
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
set spinner(spinner) {
|
|
1327
|
-
this.#frameIndex = -1;
|
|
1328
|
-
this.#initialInterval = undefined;
|
|
1329
|
-
|
|
1330
|
-
if (typeof spinner === 'object') {
|
|
1331
|
-
if (spinner.frames === undefined) {
|
|
1332
|
-
throw new Error('The given spinner must have a `frames` property');
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
this.#spinner = spinner;
|
|
1336
|
-
} else if (!isUnicodeSupported()) {
|
|
1337
|
-
this.#spinner = cliSpinners.line;
|
|
1338
|
-
} else if (spinner === undefined) {
|
|
1339
|
-
// Set default spinner
|
|
1340
|
-
this.#spinner = cliSpinners.dots;
|
|
1341
|
-
} else if (spinner !== 'default' && cliSpinners[spinner]) {
|
|
1342
|
-
this.#spinner = cliSpinners[spinner];
|
|
1343
|
-
} else {
|
|
1344
|
-
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
get text() {
|
|
1349
|
-
return this.#text;
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
set text(value = '') {
|
|
1353
|
-
this.#text = value;
|
|
1354
|
-
this.#updateLineCount();
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
get prefixText() {
|
|
1358
|
-
return this.#prefixText;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
set prefixText(value = '') {
|
|
1362
|
-
this.#prefixText = value;
|
|
1363
|
-
this.#updateLineCount();
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
get suffixText() {
|
|
1367
|
-
return this.#suffixText;
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
set suffixText(value = '') {
|
|
1371
|
-
this.#suffixText = value;
|
|
1372
|
-
this.#updateLineCount();
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
get isSpinning() {
|
|
1376
|
-
return this.#id !== undefined;
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
#getFullPrefixText(prefixText = this.#prefixText, postfix = ' ') {
|
|
1380
|
-
if (typeof prefixText === 'string' && prefixText !== '') {
|
|
1381
|
-
return prefixText + postfix;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
if (typeof prefixText === 'function') {
|
|
1385
|
-
return prefixText() + postfix;
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
return '';
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
#getFullSuffixText(suffixText = this.#suffixText, prefix = ' ') {
|
|
1392
|
-
if (typeof suffixText === 'string' && suffixText !== '') {
|
|
1393
|
-
return prefix + suffixText;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
if (typeof suffixText === 'function') {
|
|
1397
|
-
return prefix + suffixText();
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
return '';
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
#updateLineCount() {
|
|
1404
|
-
const columns = this.#stream.columns ?? 80;
|
|
1405
|
-
const fullPrefixText = this.#getFullPrefixText(this.#prefixText, '-');
|
|
1406
|
-
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, '-');
|
|
1407
|
-
const fullText = ' '.repeat(this.#indent) + fullPrefixText + '--' + this.#text + '--' + fullSuffixText;
|
|
1408
|
-
|
|
1409
|
-
this.#lineCount = 0;
|
|
1410
|
-
for (const line of stripAnsi(fullText).split('\n')) {
|
|
1411
|
-
this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, {countAnsiEscapeCodes: true}) / columns));
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
get isEnabled() {
|
|
1416
|
-
return this.#isEnabled && !this.#isSilent;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
set isEnabled(value) {
|
|
1420
|
-
if (typeof value !== 'boolean') {
|
|
1421
|
-
throw new TypeError('The `isEnabled` option must be a boolean');
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
this.#isEnabled = value;
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
get isSilent() {
|
|
1428
|
-
return this.#isSilent;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
set isSilent(value) {
|
|
1432
|
-
if (typeof value !== 'boolean') {
|
|
1433
|
-
throw new TypeError('The `isSilent` option must be a boolean');
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
this.#isSilent = value;
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
frame() {
|
|
1440
|
-
// Ensure we only update the spinner frame at the wanted interval,
|
|
1441
|
-
// even if the render method is called more often.
|
|
1442
|
-
const now = Date.now();
|
|
1443
|
-
if (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {
|
|
1444
|
-
this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
|
|
1445
|
-
this.#lastSpinnerFrameTime = now;
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
const {frames} = this.#spinner;
|
|
1449
|
-
let frame = frames[this.#frameIndex];
|
|
1450
|
-
|
|
1451
|
-
if (this.color) {
|
|
1452
|
-
frame = chalk[this.color](frame);
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
const fullPrefixText = (typeof this.#prefixText === 'string' && this.#prefixText !== '') ? this.#prefixText + ' ' : '';
|
|
1456
|
-
const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
|
|
1457
|
-
const fullSuffixText = (typeof this.#suffixText === 'string' && this.#suffixText !== '') ? ' ' + this.#suffixText : '';
|
|
1458
|
-
|
|
1459
|
-
return fullPrefixText + frame + fullText + fullSuffixText;
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
clear() {
|
|
1463
|
-
if (!this.#isEnabled || !this.#stream.isTTY) {
|
|
1464
|
-
return this;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
this.#stream.cursorTo(0);
|
|
1468
|
-
|
|
1469
|
-
for (let index = 0; index < this.#linesToClear; index++) {
|
|
1470
|
-
if (index > 0) {
|
|
1471
|
-
this.#stream.moveCursor(0, -1);
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
this.#stream.clearLine(1);
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
if (this.#indent || this.lastIndent !== this.#indent) {
|
|
1478
|
-
this.#stream.cursorTo(this.#indent);
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
this.lastIndent = this.#indent;
|
|
1482
|
-
this.#linesToClear = 0;
|
|
1483
|
-
|
|
1484
|
-
return this;
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
render() {
|
|
1488
|
-
if (this.#isSilent) {
|
|
1489
|
-
return this;
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
this.clear();
|
|
1493
|
-
this.#stream.write(this.frame());
|
|
1494
|
-
this.#linesToClear = this.#lineCount;
|
|
1495
|
-
|
|
1496
|
-
return this;
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
start(text) {
|
|
1500
|
-
if (text) {
|
|
1501
|
-
this.text = text;
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
if (this.#isSilent) {
|
|
1505
|
-
return this;
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
if (!this.#isEnabled) {
|
|
1509
|
-
if (this.text) {
|
|
1510
|
-
this.#stream.write(`- ${this.text}\n`);
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
return this;
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
if (this.isSpinning) {
|
|
1517
|
-
return this;
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
if (this.#options.hideCursor) {
|
|
1521
|
-
cliCursor.hide(this.#stream);
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
if (this.#options.discardStdin && process__default.stdin.isTTY) {
|
|
1525
|
-
this.#isDiscardingStdin = true;
|
|
1526
|
-
stdinDiscarder.start();
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
this.render();
|
|
1530
|
-
this.#id = setInterval(this.render.bind(this), this.interval);
|
|
1531
|
-
|
|
1532
|
-
return this;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
stop() {
|
|
1536
|
-
if (!this.#isEnabled) {
|
|
1537
|
-
return this;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
clearInterval(this.#id);
|
|
1541
|
-
this.#id = undefined;
|
|
1542
|
-
this.#frameIndex = 0;
|
|
1543
|
-
this.clear();
|
|
1544
|
-
if (this.#options.hideCursor) {
|
|
1545
|
-
cliCursor.show(this.#stream);
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
if (this.#options.discardStdin && process__default.stdin.isTTY && this.#isDiscardingStdin) {
|
|
1549
|
-
stdinDiscarder.stop();
|
|
1550
|
-
this.#isDiscardingStdin = false;
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
return this;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
succeed(text) {
|
|
1557
|
-
return this.stopAndPersist({symbol: logSymbols.success, text});
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
fail(text) {
|
|
1561
|
-
return this.stopAndPersist({symbol: logSymbols.error, text});
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
warn(text) {
|
|
1565
|
-
return this.stopAndPersist({symbol: logSymbols.warning, text});
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
info(text) {
|
|
1569
|
-
return this.stopAndPersist({symbol: logSymbols.info, text});
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
stopAndPersist(options = {}) {
|
|
1573
|
-
if (this.#isSilent) {
|
|
1574
|
-
return this;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
const prefixText = options.prefixText ?? this.#prefixText;
|
|
1578
|
-
const fullPrefixText = this.#getFullPrefixText(prefixText, ' ');
|
|
1579
|
-
|
|
1580
|
-
const symbolText = options.symbol ?? ' ';
|
|
1581
|
-
|
|
1582
|
-
const text = options.text ?? this.text;
|
|
1583
|
-
const separatorText = symbolText ? ' ' : '';
|
|
1584
|
-
const fullText = (typeof text === 'string') ? separatorText + text : '';
|
|
1585
|
-
|
|
1586
|
-
const suffixText = options.suffixText ?? this.#suffixText;
|
|
1587
|
-
const fullSuffixText = this.#getFullSuffixText(suffixText, ' ');
|
|
1588
|
-
|
|
1589
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + '\n';
|
|
1590
|
-
|
|
1591
|
-
this.stop();
|
|
1592
|
-
this.#stream.write(textToWrite);
|
|
1593
|
-
|
|
1594
|
-
return this;
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
function ora(options) {
|
|
1599
|
-
return new Ora(options);
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
export { ora as default, cliSpinners as spinners };
|