track-cli 3.0.0-rc
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 +7 -0
- package/README.md +3 -0
- package/esm/_dnt.polyfills.d.ts +6 -0
- package/esm/_dnt.polyfills.js +1 -0
- package/esm/_dnt.shims.d.ts +19 -0
- package/esm/_dnt.shims.js +78 -0
- package/esm/deps/deno.land/std@0.170.0/fmt/colors.d.ts +270 -0
- package/esm/deps/deno.land/std@0.170.0/fmt/colors.js +473 -0
- package/esm/deps/deno.land/std@0.195.0/_util/os.d.ts +4 -0
- package/esm/deps/deno.land/std@0.195.0/_util/os.js +18 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert.d.ts +2 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert.js +8 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.d.ts +4 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.js +12 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/_common.d.ts +50 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/_common.js +545 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/constants.d.ts +55 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/constants.js +57 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.d.ts +26 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.js +45 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/difference.d.ts +38 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/difference.js +93 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/format.d.ts +22 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/format.js +28 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.d.ts +49 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.js +60 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/mod.d.ts +43 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/mod.js +45 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/parse.d.ts +21 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/parse.js +29 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.d.ts +17 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.js +44 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.d.ts +13 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.js +38 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/colors.d.ts +270 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/colors.js +474 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/duration.d.ts +15 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/duration.js +96 -0
- package/esm/deps/deno.land/std@0.195.0/fs/_util.d.ts +35 -0
- package/esm/deps/deno.land/std@0.195.0/fs/_util.js +80 -0
- package/esm/deps/deno.land/std@0.195.0/fs/copy.d.ts +51 -0
- package/esm/deps/deno.land/std@0.195.0/fs/copy.js +244 -0
- package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.d.ts +31 -0
- package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.js +74 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.d.ts +27 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.js +55 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.d.ts +33 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.js +75 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.d.ts +31 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.js +43 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.d.ts +17 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.js +68 -0
- package/esm/deps/deno.land/std@0.195.0/fs/eol.d.ts +40 -0
- package/esm/deps/deno.land/std@0.195.0/fs/eol.js +53 -0
- package/esm/deps/deno.land/std@0.195.0/fs/exists.d.ts +102 -0
- package/esm/deps/deno.land/std@0.195.0/fs/exists.js +163 -0
- package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.d.ts +37 -0
- package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.js +216 -0
- package/esm/deps/deno.land/std@0.195.0/fs/mod.d.ts +16 -0
- package/esm/deps/deno.land/std@0.195.0/fs/mod.js +17 -0
- package/esm/deps/deno.land/std@0.195.0/fs/move.d.ts +29 -0
- package/esm/deps/deno.land/std@0.195.0/fs/move.js +88 -0
- package/esm/deps/deno.land/std@0.195.0/fs/walk.d.ts +40 -0
- package/esm/deps/deno.land/std@0.195.0/fs/walk.js +158 -0
- package/esm/deps/deno.land/std@0.195.0/path/_constants.d.ts +39 -0
- package/esm/deps/deno.land/std@0.195.0/path/_constants.js +46 -0
- package/esm/deps/deno.land/std@0.195.0/path/_interface.d.ts +26 -0
- package/esm/deps/deno.land/std@0.195.0/path/_interface.js +3 -0
- package/esm/deps/deno.land/std@0.195.0/path/_util.d.ts +11 -0
- package/esm/deps/deno.land/std@0.195.0/path/_util.js +161 -0
- package/esm/deps/deno.land/std@0.195.0/path/common.d.ts +13 -0
- package/esm/deps/deno.land/std@0.195.0/path/common.js +36 -0
- package/esm/deps/deno.land/std@0.195.0/path/glob.d.ts +83 -0
- package/esm/deps/deno.land/std@0.195.0/path/glob.js +361 -0
- package/esm/deps/deno.land/std@0.195.0/path/mod.d.ts +9 -0
- package/esm/deps/deno.land/std@0.195.0/path/mod.js +33 -0
- package/esm/deps/deno.land/std@0.195.0/path/posix.d.ts +86 -0
- package/esm/deps/deno.land/std@0.195.0/path/posix.js +442 -0
- package/esm/deps/deno.land/std@0.195.0/path/separator.d.ts +2 -0
- package/esm/deps/deno.land/std@0.195.0/path/separator.js +5 -0
- package/esm/deps/deno.land/std@0.195.0/path/win32.d.ts +91 -0
- package/esm/deps/deno.land/std@0.195.0/path/win32.js +909 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.d.ts +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.js +26 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.d.ts +76 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.js +154 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.d.ts +32 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.js +105 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.d.ts +831 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.js +1701 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.d.ts +17 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.js +201 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.d.ts +14 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.js +141 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.d.ts +21 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.js +285 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.js +38 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.d.ts +8 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.js +32 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.js +38 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.js +46 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.js +38 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.d.ts +45 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.js +2 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.d.ts +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.js +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.d.ts +27 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.js +323 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.js +34 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.d.ts +18 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.js +17 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.d.ts +41 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.js +24 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.d.ts +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.js +20 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.d.ts +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.js +13 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.d.ts +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.js +27 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.d.ts +10 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.js +29 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.d.ts +5 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.js +12 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.d.ts +118 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.js +2 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.d.ts +5 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.js +5 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.d.ts +14 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.js +46 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.d.ts +26 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.js +118 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.d.ts +14 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.js +55 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.d.ts +27 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.js +102 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.d.ts +17 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.js +75 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.d.ts +60 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.js +117 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.d.ts +18 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.js +106 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.d.ts +10 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.js +157 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.d.ts +24 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.d.ts +33 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.js +402 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.js +11 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.js +4 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.d.ts +59 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.js +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.d.ts +20 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.js +18 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.d.ts +78 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.js +128 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.d.ts +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.js +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.d.ts +99 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.js +529 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.d.ts +49 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.js +74 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.d.ts +135 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.js +237 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.d.ts +13 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.js +60 -0
- package/esm/package.json +3 -0
- package/esm/src/action/add.d.ts +1 -0
- package/esm/src/action/add.js +57 -0
- package/esm/src/action/clone.d.ts +6 -0
- package/esm/src/action/clone.js +108 -0
- package/esm/src/action/lang.d.ts +1 -0
- package/esm/src/action/lang.js +40 -0
- package/esm/src/action/pull.d.ts +1 -0
- package/esm/src/action/pull.js +22 -0
- package/esm/src/action/remove.d.ts +4 -0
- package/esm/src/action/remove.js +67 -0
- package/esm/src/action/reset.d.ts +1 -0
- package/esm/src/action/reset.js +21 -0
- package/esm/src/action/run.d.ts +4 -0
- package/esm/src/action/run.js +163 -0
- package/esm/src/action/status.d.ts +1 -0
- package/esm/src/action/status.js +5 -0
- package/esm/src/main.d.ts +2 -0
- package/esm/src/main.js +96 -0
- package/esm/src/meta.d.ts +3 -0
- package/esm/src/meta.js +51 -0
- package/esm/src/orca/client.d.ts +20 -0
- package/esm/src/orca/client.js +152 -0
- package/esm/src/orca/types.d.ts +54 -0
- package/esm/src/orca/types.js +12 -0
- package/esm/src/shared/config.d.ts +24 -0
- package/esm/src/shared/config.js +24 -0
- package/esm/src/shared/errors.d.ts +82 -0
- package/esm/src/shared/errors.js +228 -0
- package/esm/src/shared/file.d.ts +30 -0
- package/esm/src/shared/file.js +110 -0
- package/esm/src/shared/mod.d.ts +40 -0
- package/esm/src/shared/mod.js +383 -0
- package/esm/src/shared/types.d.ts +12 -0
- package/esm/src/shared/types.js +1 -0
- package/esm/src/track/client.d.ts +60 -0
- package/esm/src/track/client.js +268 -0
- package/esm/src/track/types.d.ts +210 -0
- package/esm/src/track/types.js +40 -0
- package/package.json +35 -0
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
|
|
3
|
+
// on npm.
|
|
4
|
+
/**
|
|
5
|
+
* String formatters and utilities for dealing with ANSI color codes.
|
|
6
|
+
*
|
|
7
|
+
* This module is browser compatible.
|
|
8
|
+
*
|
|
9
|
+
* This module supports `NO_COLOR` environmental variable disabling any coloring
|
|
10
|
+
* if `NO_COLOR` is set.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import {
|
|
15
|
+
* bgBlue,
|
|
16
|
+
* bgRgb24,
|
|
17
|
+
* bgRgb8,
|
|
18
|
+
* bold,
|
|
19
|
+
* italic,
|
|
20
|
+
* red,
|
|
21
|
+
* rgb24,
|
|
22
|
+
* rgb8,
|
|
23
|
+
* } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
|
|
24
|
+
*
|
|
25
|
+
* console.log(bgBlue(italic(red(bold("Hello, World!")))));
|
|
26
|
+
*
|
|
27
|
+
* // also supports 8bit colors
|
|
28
|
+
*
|
|
29
|
+
* console.log(rgb8("Hello, World!", 42));
|
|
30
|
+
*
|
|
31
|
+
* console.log(bgRgb8("Hello, World!", 42));
|
|
32
|
+
*
|
|
33
|
+
* // and 24bit rgb
|
|
34
|
+
*
|
|
35
|
+
* console.log(rgb24("Hello, World!", {
|
|
36
|
+
* r: 41,
|
|
37
|
+
* g: 42,
|
|
38
|
+
* b: 43,
|
|
39
|
+
* }));
|
|
40
|
+
*
|
|
41
|
+
* console.log(bgRgb24("Hello, World!", {
|
|
42
|
+
* r: 41,
|
|
43
|
+
* g: 42,
|
|
44
|
+
* b: 43,
|
|
45
|
+
* }));
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @module
|
|
49
|
+
*/
|
|
50
|
+
// deno-lint-ignore no-explicit-any
|
|
51
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
52
|
+
const { Deno } = dntShim.dntGlobalThis;
|
|
53
|
+
const noColor = typeof Deno?.noColor === "boolean"
|
|
54
|
+
? Deno.noColor
|
|
55
|
+
: true;
|
|
56
|
+
let enabled = !noColor;
|
|
57
|
+
/**
|
|
58
|
+
* Set changing text color to enabled or disabled
|
|
59
|
+
* @param value
|
|
60
|
+
*/
|
|
61
|
+
export function setColorEnabled(value) {
|
|
62
|
+
if (noColor) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
enabled = value;
|
|
66
|
+
}
|
|
67
|
+
/** Get whether text color change is enabled or disabled. */
|
|
68
|
+
export function getColorEnabled() {
|
|
69
|
+
return enabled;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Builds color code
|
|
73
|
+
* @param open
|
|
74
|
+
* @param close
|
|
75
|
+
*/
|
|
76
|
+
function code(open, close) {
|
|
77
|
+
return {
|
|
78
|
+
open: `\x1b[${open.join(";")}m`,
|
|
79
|
+
close: `\x1b[${close}m`,
|
|
80
|
+
regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Applies color and background based on color code and its associated text
|
|
85
|
+
* @param str text to apply color settings to
|
|
86
|
+
* @param code color code to apply
|
|
87
|
+
*/
|
|
88
|
+
function run(str, code) {
|
|
89
|
+
return enabled
|
|
90
|
+
? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
|
|
91
|
+
: str;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Reset the text modified
|
|
95
|
+
* @param str text to reset
|
|
96
|
+
*/
|
|
97
|
+
export function reset(str) {
|
|
98
|
+
return run(str, code([0], 0));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Make the text bold.
|
|
102
|
+
* @param str text to make bold
|
|
103
|
+
*/
|
|
104
|
+
export function bold(str) {
|
|
105
|
+
return run(str, code([1], 22));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The text emits only a small amount of light.
|
|
109
|
+
* @param str text to dim
|
|
110
|
+
*/
|
|
111
|
+
export function dim(str) {
|
|
112
|
+
return run(str, code([2], 22));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Make the text italic.
|
|
116
|
+
* @param str text to make italic
|
|
117
|
+
*/
|
|
118
|
+
export function italic(str) {
|
|
119
|
+
return run(str, code([3], 23));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Make the text underline.
|
|
123
|
+
* @param str text to underline
|
|
124
|
+
*/
|
|
125
|
+
export function underline(str) {
|
|
126
|
+
return run(str, code([4], 24));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Invert background color and text color.
|
|
130
|
+
* @param str text to invert its color
|
|
131
|
+
*/
|
|
132
|
+
export function inverse(str) {
|
|
133
|
+
return run(str, code([7], 27));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Make the text hidden.
|
|
137
|
+
* @param str text to hide
|
|
138
|
+
*/
|
|
139
|
+
export function hidden(str) {
|
|
140
|
+
return run(str, code([8], 28));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Put horizontal line through the center of the text.
|
|
144
|
+
* @param str text to strike through
|
|
145
|
+
*/
|
|
146
|
+
export function strikethrough(str) {
|
|
147
|
+
return run(str, code([9], 29));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Set text color to black.
|
|
151
|
+
* @param str text to make black
|
|
152
|
+
*/
|
|
153
|
+
export function black(str) {
|
|
154
|
+
return run(str, code([30], 39));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Set text color to red.
|
|
158
|
+
* @param str text to make red
|
|
159
|
+
*/
|
|
160
|
+
export function red(str) {
|
|
161
|
+
return run(str, code([31], 39));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Set text color to green.
|
|
165
|
+
* @param str text to make green
|
|
166
|
+
*/
|
|
167
|
+
export function green(str) {
|
|
168
|
+
return run(str, code([32], 39));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Set text color to yellow.
|
|
172
|
+
* @param str text to make yellow
|
|
173
|
+
*/
|
|
174
|
+
export function yellow(str) {
|
|
175
|
+
return run(str, code([33], 39));
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Set text color to blue.
|
|
179
|
+
* @param str text to make blue
|
|
180
|
+
*/
|
|
181
|
+
export function blue(str) {
|
|
182
|
+
return run(str, code([34], 39));
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Set text color to magenta.
|
|
186
|
+
* @param str text to make magenta
|
|
187
|
+
*/
|
|
188
|
+
export function magenta(str) {
|
|
189
|
+
return run(str, code([35], 39));
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Set text color to cyan.
|
|
193
|
+
* @param str text to make cyan
|
|
194
|
+
*/
|
|
195
|
+
export function cyan(str) {
|
|
196
|
+
return run(str, code([36], 39));
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Set text color to white.
|
|
200
|
+
* @param str text to make white
|
|
201
|
+
*/
|
|
202
|
+
export function white(str) {
|
|
203
|
+
return run(str, code([37], 39));
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Set text color to gray.
|
|
207
|
+
* @param str text to make gray
|
|
208
|
+
*/
|
|
209
|
+
export function gray(str) {
|
|
210
|
+
return brightBlack(str);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Set text color to bright black.
|
|
214
|
+
* @param str text to make bright-black
|
|
215
|
+
*/
|
|
216
|
+
export function brightBlack(str) {
|
|
217
|
+
return run(str, code([90], 39));
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Set text color to bright red.
|
|
221
|
+
* @param str text to make bright-red
|
|
222
|
+
*/
|
|
223
|
+
export function brightRed(str) {
|
|
224
|
+
return run(str, code([91], 39));
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Set text color to bright green.
|
|
228
|
+
* @param str text to make bright-green
|
|
229
|
+
*/
|
|
230
|
+
export function brightGreen(str) {
|
|
231
|
+
return run(str, code([92], 39));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Set text color to bright yellow.
|
|
235
|
+
* @param str text to make bright-yellow
|
|
236
|
+
*/
|
|
237
|
+
export function brightYellow(str) {
|
|
238
|
+
return run(str, code([93], 39));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Set text color to bright blue.
|
|
242
|
+
* @param str text to make bright-blue
|
|
243
|
+
*/
|
|
244
|
+
export function brightBlue(str) {
|
|
245
|
+
return run(str, code([94], 39));
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Set text color to bright magenta.
|
|
249
|
+
* @param str text to make bright-magenta
|
|
250
|
+
*/
|
|
251
|
+
export function brightMagenta(str) {
|
|
252
|
+
return run(str, code([95], 39));
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Set text color to bright cyan.
|
|
256
|
+
* @param str text to make bright-cyan
|
|
257
|
+
*/
|
|
258
|
+
export function brightCyan(str) {
|
|
259
|
+
return run(str, code([96], 39));
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Set text color to bright white.
|
|
263
|
+
* @param str text to make bright-white
|
|
264
|
+
*/
|
|
265
|
+
export function brightWhite(str) {
|
|
266
|
+
return run(str, code([97], 39));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Set background color to black.
|
|
270
|
+
* @param str text to make its background black
|
|
271
|
+
*/
|
|
272
|
+
export function bgBlack(str) {
|
|
273
|
+
return run(str, code([40], 49));
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Set background color to red.
|
|
277
|
+
* @param str text to make its background red
|
|
278
|
+
*/
|
|
279
|
+
export function bgRed(str) {
|
|
280
|
+
return run(str, code([41], 49));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Set background color to green.
|
|
284
|
+
* @param str text to make its background green
|
|
285
|
+
*/
|
|
286
|
+
export function bgGreen(str) {
|
|
287
|
+
return run(str, code([42], 49));
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Set background color to yellow.
|
|
291
|
+
* @param str text to make its background yellow
|
|
292
|
+
*/
|
|
293
|
+
export function bgYellow(str) {
|
|
294
|
+
return run(str, code([43], 49));
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Set background color to blue.
|
|
298
|
+
* @param str text to make its background blue
|
|
299
|
+
*/
|
|
300
|
+
export function bgBlue(str) {
|
|
301
|
+
return run(str, code([44], 49));
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Set background color to magenta.
|
|
305
|
+
* @param str text to make its background magenta
|
|
306
|
+
*/
|
|
307
|
+
export function bgMagenta(str) {
|
|
308
|
+
return run(str, code([45], 49));
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Set background color to cyan.
|
|
312
|
+
* @param str text to make its background cyan
|
|
313
|
+
*/
|
|
314
|
+
export function bgCyan(str) {
|
|
315
|
+
return run(str, code([46], 49));
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Set background color to white.
|
|
319
|
+
* @param str text to make its background white
|
|
320
|
+
*/
|
|
321
|
+
export function bgWhite(str) {
|
|
322
|
+
return run(str, code([47], 49));
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Set background color to bright black.
|
|
326
|
+
* @param str text to make its background bright-black
|
|
327
|
+
*/
|
|
328
|
+
export function bgBrightBlack(str) {
|
|
329
|
+
return run(str, code([100], 49));
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Set background color to bright red.
|
|
333
|
+
* @param str text to make its background bright-red
|
|
334
|
+
*/
|
|
335
|
+
export function bgBrightRed(str) {
|
|
336
|
+
return run(str, code([101], 49));
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Set background color to bright green.
|
|
340
|
+
* @param str text to make its background bright-green
|
|
341
|
+
*/
|
|
342
|
+
export function bgBrightGreen(str) {
|
|
343
|
+
return run(str, code([102], 49));
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Set background color to bright yellow.
|
|
347
|
+
* @param str text to make its background bright-yellow
|
|
348
|
+
*/
|
|
349
|
+
export function bgBrightYellow(str) {
|
|
350
|
+
return run(str, code([103], 49));
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Set background color to bright blue.
|
|
354
|
+
* @param str text to make its background bright-blue
|
|
355
|
+
*/
|
|
356
|
+
export function bgBrightBlue(str) {
|
|
357
|
+
return run(str, code([104], 49));
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Set background color to bright magenta.
|
|
361
|
+
* @param str text to make its background bright-magenta
|
|
362
|
+
*/
|
|
363
|
+
export function bgBrightMagenta(str) {
|
|
364
|
+
return run(str, code([105], 49));
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Set background color to bright cyan.
|
|
368
|
+
* @param str text to make its background bright-cyan
|
|
369
|
+
*/
|
|
370
|
+
export function bgBrightCyan(str) {
|
|
371
|
+
return run(str, code([106], 49));
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Set background color to bright white.
|
|
375
|
+
* @param str text to make its background bright-white
|
|
376
|
+
*/
|
|
377
|
+
export function bgBrightWhite(str) {
|
|
378
|
+
return run(str, code([107], 49));
|
|
379
|
+
}
|
|
380
|
+
/* Special Color Sequences */
|
|
381
|
+
/**
|
|
382
|
+
* Clam and truncate color codes
|
|
383
|
+
* @param n
|
|
384
|
+
* @param max number to truncate to
|
|
385
|
+
* @param min number to truncate from
|
|
386
|
+
*/
|
|
387
|
+
function clampAndTruncate(n, max = 255, min = 0) {
|
|
388
|
+
return Math.trunc(Math.max(Math.min(n, max), min));
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Set text color using paletted 8bit colors.
|
|
392
|
+
* https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
|
|
393
|
+
* @param str text color to apply paletted 8bit colors to
|
|
394
|
+
* @param color code
|
|
395
|
+
*/
|
|
396
|
+
export function rgb8(str, color) {
|
|
397
|
+
return run(str, code([38, 5, clampAndTruncate(color)], 39));
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Set background color using paletted 8bit colors.
|
|
401
|
+
* https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
|
|
402
|
+
* @param str text color to apply paletted 8bit background colors to
|
|
403
|
+
* @param color code
|
|
404
|
+
*/
|
|
405
|
+
export function bgRgb8(str, color) {
|
|
406
|
+
return run(str, code([48, 5, clampAndTruncate(color)], 49));
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Set text color using 24bit rgb.
|
|
410
|
+
* `color` can be a number in range `0x000000` to `0xffffff` or
|
|
411
|
+
* an `Rgb`.
|
|
412
|
+
*
|
|
413
|
+
* To produce the color magenta:
|
|
414
|
+
*
|
|
415
|
+
* ```ts
|
|
416
|
+
* import { rgb24 } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
|
|
417
|
+
* rgb24("foo", 0xff00ff);
|
|
418
|
+
* rgb24("foo", {r: 255, g: 0, b: 255});
|
|
419
|
+
* ```
|
|
420
|
+
* @param str text color to apply 24bit rgb to
|
|
421
|
+
* @param color code
|
|
422
|
+
*/
|
|
423
|
+
export function rgb24(str, color) {
|
|
424
|
+
if (typeof color === "number") {
|
|
425
|
+
return run(str, code([38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 39));
|
|
426
|
+
}
|
|
427
|
+
return run(str, code([
|
|
428
|
+
38,
|
|
429
|
+
2,
|
|
430
|
+
clampAndTruncate(color.r),
|
|
431
|
+
clampAndTruncate(color.g),
|
|
432
|
+
clampAndTruncate(color.b),
|
|
433
|
+
], 39));
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Set background color using 24bit rgb.
|
|
437
|
+
* `color` can be a number in range `0x000000` to `0xffffff` or
|
|
438
|
+
* an `Rgb`.
|
|
439
|
+
*
|
|
440
|
+
* To produce the color magenta:
|
|
441
|
+
*
|
|
442
|
+
* ```ts
|
|
443
|
+
* import { bgRgb24 } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
|
|
444
|
+
* bgRgb24("foo", 0xff00ff);
|
|
445
|
+
* bgRgb24("foo", {r: 255, g: 0, b: 255});
|
|
446
|
+
* ```
|
|
447
|
+
* @param str text color to apply 24bit rgb to
|
|
448
|
+
* @param color code
|
|
449
|
+
*/
|
|
450
|
+
export function bgRgb24(str, color) {
|
|
451
|
+
if (typeof color === "number") {
|
|
452
|
+
return run(str, code([48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 49));
|
|
453
|
+
}
|
|
454
|
+
return run(str, code([
|
|
455
|
+
48,
|
|
456
|
+
2,
|
|
457
|
+
clampAndTruncate(color.r),
|
|
458
|
+
clampAndTruncate(color.g),
|
|
459
|
+
clampAndTruncate(color.b),
|
|
460
|
+
], 49));
|
|
461
|
+
}
|
|
462
|
+
// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
|
|
463
|
+
const ANSI_PATTERN = new RegExp([
|
|
464
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
465
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))",
|
|
466
|
+
].join("|"), "g");
|
|
467
|
+
/**
|
|
468
|
+
* Remove ANSI escape codes from the string.
|
|
469
|
+
* @param string to remove ANSI escape codes from
|
|
470
|
+
*/
|
|
471
|
+
export function stripColor(string) {
|
|
472
|
+
return string.replace(ANSI_PATTERN, "");
|
|
473
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
4
|
+
export const osType = (() => {
|
|
5
|
+
// deno-lint-ignore no-explicit-any
|
|
6
|
+
const { Deno } = dntShim.dntGlobalThis;
|
|
7
|
+
if (typeof Deno?.build?.os === "string") {
|
|
8
|
+
return Deno.build.os;
|
|
9
|
+
}
|
|
10
|
+
// deno-lint-ignore no-explicit-any
|
|
11
|
+
const { navigator } = dntShim.dntGlobalThis;
|
|
12
|
+
if (navigator?.appVersion?.includes?.("Win")) {
|
|
13
|
+
return "windows";
|
|
14
|
+
}
|
|
15
|
+
return "linux";
|
|
16
|
+
})();
|
|
17
|
+
export const isWindows = osType === "windows";
|
|
18
|
+
export const isLinux = osType === "linux";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
import { AssertionError } from "./assertion_error.js";
|
|
3
|
+
/** Make an assertion, error will be thrown if `expr` does not have truthy value. */
|
|
4
|
+
export function assert(expr, msg = "") {
|
|
5
|
+
if (!expr) {
|
|
6
|
+
throw new AssertionError(msg);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
export class AssertionError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
Object.defineProperty(this, "name", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value: "AssertionError"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type Token = {
|
|
2
|
+
type: string;
|
|
3
|
+
value: string | number;
|
|
4
|
+
index: number;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
export interface ReceiverResult {
|
|
8
|
+
[name: string]: string | number | unknown;
|
|
9
|
+
}
|
|
10
|
+
export type CallbackResult = {
|
|
11
|
+
type: string;
|
|
12
|
+
value: string | number;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
type CallbackFunction = (value: unknown) => CallbackResult;
|
|
16
|
+
export type TestResult = {
|
|
17
|
+
value: unknown;
|
|
18
|
+
length: number;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export type TestFunction = (string: string) => TestResult | undefined;
|
|
21
|
+
export interface Rule {
|
|
22
|
+
test: TestFunction;
|
|
23
|
+
fn: CallbackFunction;
|
|
24
|
+
}
|
|
25
|
+
export declare class Tokenizer {
|
|
26
|
+
rules: Rule[];
|
|
27
|
+
constructor(rules?: Rule[]);
|
|
28
|
+
addRule(test: TestFunction, fn: CallbackFunction): Tokenizer;
|
|
29
|
+
tokenize(string: string, receiver?: (token: Token) => ReceiverResult): ReceiverResult[];
|
|
30
|
+
}
|
|
31
|
+
type DateTimeFormatPartTypes = "day" | "dayPeriod" | "hour" | "literal" | "minute" | "month" | "second" | "timeZoneName" | "year" | "fractionalSecond";
|
|
32
|
+
interface DateTimeFormatPart {
|
|
33
|
+
type: DateTimeFormatPartTypes;
|
|
34
|
+
value: string;
|
|
35
|
+
}
|
|
36
|
+
type TimeZone = "UTC";
|
|
37
|
+
interface Options {
|
|
38
|
+
timeZone?: TimeZone;
|
|
39
|
+
}
|
|
40
|
+
export declare class DateTimeFormatter {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(formatString: string, rules?: Rule[]);
|
|
43
|
+
format(date: Date, options?: Options): string;
|
|
44
|
+
parseToParts(string: string): DateTimeFormatPart[];
|
|
45
|
+
/** sort & filter dateTimeFormatPart */
|
|
46
|
+
sortDateTimeFormatPart(parts: DateTimeFormatPart[]): DateTimeFormatPart[];
|
|
47
|
+
partsToDate(parts: DateTimeFormatPart[]): Date;
|
|
48
|
+
parse(string: string): Date;
|
|
49
|
+
}
|
|
50
|
+
export {};
|