git-remote-ops 0.1.0 → 0.2.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/AGENTS.md +33 -32
- package/README.md +80 -206
- package/dist/cli.js +215 -0
- package/dist/cli.js.map +1 -0
- package/{types → dist}/client.d.ts +11 -15
- package/dist/client.d.ts.map +1 -0
- package/{esm → dist}/client.js +107 -83
- package/dist/client.js.map +1 -0
- package/{types → dist}/errors.d.ts +30 -16
- package/dist/errors.d.ts.map +1 -0
- package/{esm → dist}/errors.js +17 -8
- package/dist/errors.js.map +1 -0
- package/{types → dist}/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/{esm → dist}/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/{types → dist}/logger.d.ts +11 -0
- package/dist/logger.d.ts.map +1 -0
- package/{esm → dist}/logger.js +3 -19
- package/dist/logger.js.map +1 -0
- package/{esm → dist}/objects/commit.js +1 -0
- package/dist/objects/commit.js.map +1 -0
- package/{esm → dist}/objects/index.js +1 -0
- package/dist/objects/index.js.map +1 -0
- package/{types → dist}/objects/tree.d.ts.map +1 -1
- package/{esm → dist}/objects/tree.js +2 -2
- package/dist/objects/tree.js.map +1 -0
- package/{esm → dist}/pack/delta.js +1 -0
- package/dist/pack/delta.js.map +1 -0
- package/{esm → dist}/pack/index.js +1 -0
- package/dist/pack/index.js.map +1 -0
- package/{types → dist}/pack/objects.d.ts.map +1 -1
- package/{esm → dist}/pack/objects.js +3 -3
- package/dist/pack/objects.js.map +1 -0
- package/{types → dist}/pack/parser.d.ts +19 -3
- package/dist/pack/parser.d.ts.map +1 -0
- package/{esm → dist}/pack/parser.js +46 -15
- package/dist/pack/parser.js.map +1 -0
- package/{esm → dist}/protocol/index.js +1 -0
- package/dist/protocol/index.js.map +1 -0
- package/{types → dist}/protocol/pkt_line.d.ts +3 -3
- package/{types → dist}/protocol/pkt_line.d.ts.map +1 -1
- package/{esm → dist}/protocol/pkt_line.js +1 -0
- package/dist/protocol/pkt_line.js.map +1 -0
- package/{esm → dist}/protocol/refs.js +1 -0
- package/dist/protocol/refs.js.map +1 -0
- package/{types → dist}/protocol/upload_pack.d.ts +1 -0
- package/{types → dist}/protocol/upload_pack.d.ts.map +1 -1
- package/{esm → dist}/protocol/upload_pack.js +10 -1
- package/dist/protocol/upload_pack.js.map +1 -0
- package/dist/store.d.ts +28 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +179 -0
- package/dist/store.js.map +1 -0
- package/{types → dist}/transport.d.ts +15 -2
- package/dist/transport.d.ts.map +1 -0
- package/{esm → dist}/transport.js +44 -15
- package/dist/transport.js.map +1 -0
- package/{types → dist}/types.d.ts +12 -7
- package/dist/types.d.ts.map +1 -0
- package/{esm → dist}/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +42 -29
- package/esm/_dnt.shims.js +0 -72
- package/esm/cli.js +0 -217
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.js +0 -1
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/_errors.js +0 -133
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/_spread.js +0 -1
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.js +0 -1
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/_utils.js +0 -141
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/command.js +0 -1861
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.js +0 -357
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/mod.js +0 -13
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/type.js +0 -27
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.js +0 -16
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.js +0 -13
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.js +0 -14
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/command.js +0 -9
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/enum.js +0 -24
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/file.js +0 -12
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/integer.js +0 -9
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/number.js +0 -9
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/secret.js +0 -7
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/string.js +0 -9
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/types.js +0 -2
- package/esm/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.js +0 -26
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_errors.js +0 -129
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_utils.js +0 -100
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.js +0 -166
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/flags.js +0 -750
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/mod.js +0 -55
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.js +0 -11
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.js +0 -9
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/number.js +0 -11
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/string.js +0 -4
- package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types.js +0 -1
- package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.js +0 -16
- package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.js +0 -11
- package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.js +0 -25
- package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.js +0 -18
- package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.js +0 -11
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/_layout.js +0 -616
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/_utils.js +0 -79
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/border.js +0 -18
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/cell.js +0 -190
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/column.js +0 -117
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/consume_words.js +0 -64
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/mod.js +0 -42
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/row.js +0 -82
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/table.js +0 -341
- package/esm/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.js +0 -101
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.js +0 -2
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.js +0 -237
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.js +0 -2277
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.js +0 -46
- package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.js +0 -132
- package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.js +0 -270
- package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.js +0 -23
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +0 -61
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.js +0 -51
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.js +0 -13
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.js +0 -2
- package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.js +0 -87
- package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.js +0 -903
- package/esm/deps/jsr.io/@std/text/1.0.18/closest_string.js +0 -46
- package/esm/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.js +0 -127
- package/esm/package.json +0 -3
- package/types/_dnt.shims.d.ts +0 -16
- package/types/_dnt.shims.d.ts.map +0 -1
- package/types/client.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.d.ts +0 -163
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_errors.d.ts +0 -71
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_errors.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_spread.d.ts +0 -16
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_spread.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.d.ts +0 -15
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_utils.d.ts +0 -38
- package/types/deps/jsr.io/@cliffy/command/1.1.0/_utils.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/command.d.ts +0 -1086
- package/types/deps/jsr.io/@cliffy/command/1.1.0/command.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.d.ts +0 -33
- package/types/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/mod.d.ts +0 -78
- package/types/deps/jsr.io/@cliffy/command/1.1.0/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/type.d.ts +0 -51
- package/types/deps/jsr.io/@cliffy/command/1.1.0/type.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.d.ts +0 -10
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.d.ts +0 -10
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.d.ts +0 -10
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/command.d.ts +0 -8
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/command.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/enum.d.ts +0 -11
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/enum.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/file.d.ts +0 -6
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/file.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/integer.d.ts +0 -8
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/integer.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/number.d.ts +0 -8
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/number.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/secret.d.ts +0 -6
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/secret.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/string.d.ts +0 -8
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types/string.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types.d.ts +0 -161
- package/types/deps/jsr.io/@cliffy/command/1.1.0/types.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.d.ts +0 -4
- package/types/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/_errors.d.ts +0 -67
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/_errors.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/_utils.d.ts +0 -17
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/_utils.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.d.ts +0 -11
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/flags.d.ts +0 -154
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/flags.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/mod.d.ts +0 -57
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.d.ts +0 -4
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.d.ts +0 -4
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/number.d.ts +0 -4
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/number.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/string.d.ts +0 -4
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/string.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types.d.ts +0 -170
- package/types/deps/jsr.io/@cliffy/flags/1.1.0/types.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.d.ts +0 -8
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.d.ts +0 -7
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.d.ts +0 -7
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.d.ts +0 -8
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.d.ts +0 -7
- package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/_layout.d.ts +0 -108
- package/types/deps/jsr.io/@cliffy/table/1.1.0/_layout.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/_utils.d.ts +0 -26
- package/types/deps/jsr.io/@cliffy/table/1.1.0/_utils.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/border.d.ts +0 -21
- package/types/deps/jsr.io/@cliffy/table/1.1.0/border.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/cell.d.ts +0 -155
- package/types/deps/jsr.io/@cliffy/table/1.1.0/cell.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/column.d.ts +0 -97
- package/types/deps/jsr.io/@cliffy/table/1.1.0/column.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/consume_words.d.ts +0 -30
- package/types/deps/jsr.io/@cliffy/table/1.1.0/consume_words.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/mod.d.ts +0 -43
- package/types/deps/jsr.io/@cliffy/table/1.1.0/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/row.d.ts +0 -67
- package/types/deps/jsr.io/@cliffy/table/1.1.0/row.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/table.d.ts +0 -235
- package/types/deps/jsr.io/@cliffy/table/1.1.0/table.d.ts.map +0 -1
- package/types/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.d.ts +0 -40
- package/types/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts +0 -9
- package/types/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts +0 -2
- package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts +0 -69
- package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts +0 -13
- package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts +0 -76
- package/types/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts +0 -149
- package/types/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts +0 -22
- package/types/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +0 -40
- package/types/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts +0 -23
- package/types/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts +0 -4
- package/types/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts +0 -9
- package/types/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts +0 -39
- package/types/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts +0 -700
- package/types/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts +0 -42
- package/types/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts +0 -23
- package/types/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts.map +0 -1
- package/types/errors.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/logger.d.ts.map +0 -1
- package/types/pack/parser.d.ts.map +0 -1
- package/types/transport.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
- /package/{types → dist}/cli.d.ts +0 -0
- /package/{types → dist}/cli.d.ts.map +0 -0
- /package/{types → dist}/objects/commit.d.ts +0 -0
- /package/{types → dist}/objects/commit.d.ts.map +0 -0
- /package/{types → dist}/objects/index.d.ts +0 -0
- /package/{types → dist}/objects/index.d.ts.map +0 -0
- /package/{types → dist}/objects/tree.d.ts +0 -0
- /package/{types → dist}/pack/delta.d.ts +0 -0
- /package/{types → dist}/pack/delta.d.ts.map +0 -0
- /package/{types → dist}/pack/index.d.ts +0 -0
- /package/{types → dist}/pack/index.d.ts.map +0 -0
- /package/{types → dist}/pack/objects.d.ts +0 -0
- /package/{types → dist}/protocol/index.d.ts +0 -0
- /package/{types → dist}/protocol/index.d.ts.map +0 -0
- /package/{types → dist}/protocol/refs.d.ts +0 -0
- /package/{types → dist}/protocol/refs.d.ts.map +0 -0
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { border } from "./border.js";
|
|
2
|
-
import { Cell } from "./cell.js";
|
|
3
|
-
import { Column } from "./column.js";
|
|
4
|
-
import { TableLayout } from "./_layout.js";
|
|
5
|
-
import { Row } from "./row.js";
|
|
6
|
-
/**
|
|
7
|
-
* Table representation.
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* import { Row, Table } from "./mod.ts";
|
|
11
|
-
*
|
|
12
|
-
* new Table()
|
|
13
|
-
* .header(new Row("Name", "Date", "City", "Country").border())
|
|
14
|
-
* .body([
|
|
15
|
-
* ["Baxter Herman", "Oct 1, 2020", "Harderwijk", "Slovenia"],
|
|
16
|
-
* ["Jescie Wolfe", "Dec 4, 2020", "Alto Hospicio", "Japan"],
|
|
17
|
-
* ["Allegra Cleveland", "Apr 16, 2020", "Avernas-le-Bauduin", "Samoa"],
|
|
18
|
-
* ["Aretha Gamble", "Feb 22, 2021", "Honolulu", "Georgia"],
|
|
19
|
-
* ])
|
|
20
|
-
* .render();
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export class Table extends Array {
|
|
24
|
-
static _chars = { ...border };
|
|
25
|
-
options = {
|
|
26
|
-
indent: 0,
|
|
27
|
-
border: false,
|
|
28
|
-
maxColWidth: Infinity,
|
|
29
|
-
minColWidth: 0,
|
|
30
|
-
padding: 1,
|
|
31
|
-
maxWidth: Infinity,
|
|
32
|
-
flexShrink: 0,
|
|
33
|
-
flexGrow: 0,
|
|
34
|
-
chars: { ...Table._chars },
|
|
35
|
-
columns: [],
|
|
36
|
-
};
|
|
37
|
-
headerRow;
|
|
38
|
-
/**
|
|
39
|
-
* Create a new table. If rows is a table, all rows and options of the table
|
|
40
|
-
* will be copied to the new table.
|
|
41
|
-
*
|
|
42
|
-
* @param rows An array of rows or a table instance.
|
|
43
|
-
*/
|
|
44
|
-
static from(rows) {
|
|
45
|
-
const table = new this(...rows);
|
|
46
|
-
if (rows instanceof Table) {
|
|
47
|
-
table.options = { ...rows.options };
|
|
48
|
-
table.headerRow = rows.headerRow ? Row.from(rows.headerRow) : undefined;
|
|
49
|
-
}
|
|
50
|
-
return table;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Create a new table from an array of json objects. An object represents a
|
|
54
|
-
* row and each property a column.
|
|
55
|
-
*
|
|
56
|
-
* @param rows Array of objects.
|
|
57
|
-
*/
|
|
58
|
-
static fromJson(rows) {
|
|
59
|
-
return new this().fromJson(rows);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Set global default border characters.
|
|
63
|
-
*
|
|
64
|
-
* @param chars Border options.
|
|
65
|
-
*/
|
|
66
|
-
static chars(chars) {
|
|
67
|
-
Object.assign(this._chars, chars);
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Write table or rows to stdout.
|
|
72
|
-
*
|
|
73
|
-
* @param rows Table or rows.
|
|
74
|
-
*/
|
|
75
|
-
static render(rows) {
|
|
76
|
-
Table.from(rows).render();
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Read data from an array of json objects. An object represents a
|
|
80
|
-
* row and each property a column.
|
|
81
|
-
*
|
|
82
|
-
* @param rows Array of objects.
|
|
83
|
-
*/
|
|
84
|
-
fromJson(rows) {
|
|
85
|
-
this.header(Object.keys(rows[0]));
|
|
86
|
-
this.body(rows.map((row) => Object.values(row)));
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Set column options.
|
|
91
|
-
*
|
|
92
|
-
* @param columns An array of columns or column options.
|
|
93
|
-
*/
|
|
94
|
-
columns(columns) {
|
|
95
|
-
this.options.columns = columns.map((column) => column instanceof Column ? column : Column.from(column));
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Set column options by index.
|
|
100
|
-
*
|
|
101
|
-
@param index The column index.
|
|
102
|
-
@param column Column or column options.
|
|
103
|
-
*/
|
|
104
|
-
column(index, column) {
|
|
105
|
-
if (column instanceof Column) {
|
|
106
|
-
this.options.columns[index] = column;
|
|
107
|
-
}
|
|
108
|
-
else if (this.options.columns[index]) {
|
|
109
|
-
this.options.columns[index].options(column);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this.options.columns[index] = Column.from(column);
|
|
113
|
-
}
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Set table header.
|
|
118
|
-
*
|
|
119
|
-
* @param header Header row or cells.
|
|
120
|
-
*/
|
|
121
|
-
header(header) {
|
|
122
|
-
this.headerRow = header instanceof Row ? header : Row.from(header);
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Set table body.
|
|
127
|
-
*
|
|
128
|
-
* @param rows Array of rows.
|
|
129
|
-
*/
|
|
130
|
-
body(rows) {
|
|
131
|
-
this.length = 0;
|
|
132
|
-
this.push(...rows);
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
/** Clone table recursively with header and options. */
|
|
136
|
-
clone() {
|
|
137
|
-
const table = new Table(...this.map((row) => row instanceof Row ? row.clone() : Row.from(row).clone()));
|
|
138
|
-
table.options = { ...this.options };
|
|
139
|
-
table.headerRow = this.headerRow?.clone();
|
|
140
|
-
return table;
|
|
141
|
-
}
|
|
142
|
-
/** Generate table string. */
|
|
143
|
-
toString() {
|
|
144
|
-
return new TableLayout(this, this.options).toString();
|
|
145
|
-
}
|
|
146
|
-
/** Write table to stdout. */
|
|
147
|
-
render() {
|
|
148
|
-
console.log(this.toString());
|
|
149
|
-
return this;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Set max column width.
|
|
153
|
-
*
|
|
154
|
-
* @param width Max column width.
|
|
155
|
-
* @param override Override existing value.
|
|
156
|
-
*/
|
|
157
|
-
maxColWidth(width, override = true) {
|
|
158
|
-
if (override || typeof this.options.maxColWidth === "undefined") {
|
|
159
|
-
this.options.maxColWidth = width;
|
|
160
|
-
}
|
|
161
|
-
return this;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Set min column width.
|
|
165
|
-
*
|
|
166
|
-
* @param width Min column width.
|
|
167
|
-
* @param override Override existing value.
|
|
168
|
-
*/
|
|
169
|
-
minColWidth(width, override = true) {
|
|
170
|
-
if (override || typeof this.options.minColWidth === "undefined") {
|
|
171
|
-
this.options.minColWidth = width;
|
|
172
|
-
}
|
|
173
|
-
return this;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Set max table width
|
|
177
|
-
*
|
|
178
|
-
* @param width Max table width.
|
|
179
|
-
* @param override Override existing value.
|
|
180
|
-
*/
|
|
181
|
-
maxWidth(width, override = true) {
|
|
182
|
-
if (override || typeof this.options.maxWidth === "undefined") {
|
|
183
|
-
this.options.maxWidth = width;
|
|
184
|
-
}
|
|
185
|
-
return this;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Set column flex-shrink weight. Follows CSS flex-shrink semantics: each
|
|
189
|
-
* column's share of the reduction is proportional to `weight × width`, so
|
|
190
|
-
* a wider column or one with a higher weight absorbs more of the overflow.
|
|
191
|
-
* 0 = no shrink (default), >= 1 = shrinkable.
|
|
192
|
-
*
|
|
193
|
-
* @param flexShrink Per-column shrink weight, or a single value for all columns.
|
|
194
|
-
* @param override Override existing value.
|
|
195
|
-
*/
|
|
196
|
-
flexShrink(flexShrink = 1, override = true) {
|
|
197
|
-
if (override || typeof this.options.flexShrink === "undefined") {
|
|
198
|
-
this.options.flexShrink = flexShrink;
|
|
199
|
-
}
|
|
200
|
-
return this;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Set column flex-grow weight. Follows CSS flex-grow semantics: available
|
|
204
|
-
* slack is distributed proportionally by weight, so weight 2 receives twice
|
|
205
|
-
* the extra space of weight 1. 0 = no grow (default), >= 1 = growable.
|
|
206
|
-
*
|
|
207
|
-
* @param flexGrow Per-column grow weight, or a single value for all columns.
|
|
208
|
-
* @param override Override existing value.
|
|
209
|
-
*/
|
|
210
|
-
flexGrow(flexGrow = 1, override = true) {
|
|
211
|
-
if (override || typeof this.options.flexGrow === "undefined") {
|
|
212
|
-
this.options.flexGrow = flexGrow;
|
|
213
|
-
}
|
|
214
|
-
return this;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Shorthand to set both flex-grow and flex-shrink to the same value.
|
|
218
|
-
* Columns will both expand into and contract out of
|
|
219
|
-
* available space proportionally. 0 = rigid (default), >= 1 = flexible.
|
|
220
|
-
*
|
|
221
|
-
* @param flex Per-column weight, or a single value for all columns.
|
|
222
|
-
* @param override Override existing value.
|
|
223
|
-
*/
|
|
224
|
-
flex(flex = 1, override = true) {
|
|
225
|
-
return this.flexGrow(flex, override).flexShrink(flex, override);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Set table indentation.
|
|
229
|
-
*
|
|
230
|
-
* @param width Indent width.
|
|
231
|
-
* @param override Override existing value.
|
|
232
|
-
*/
|
|
233
|
-
indent(width, override = true) {
|
|
234
|
-
if (override || typeof this.options.indent === "undefined") {
|
|
235
|
-
this.options.indent = width;
|
|
236
|
-
}
|
|
237
|
-
return this;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Set cell padding.
|
|
241
|
-
*
|
|
242
|
-
* @param padding Cell padding.
|
|
243
|
-
* @param override Override existing value.
|
|
244
|
-
*/
|
|
245
|
-
padding(padding, override = true) {
|
|
246
|
-
if (override || typeof this.options.padding === "undefined") {
|
|
247
|
-
this.options.padding = padding;
|
|
248
|
-
}
|
|
249
|
-
return this;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Enable/disable cell border.
|
|
253
|
-
*
|
|
254
|
-
* @param enable Enable/disable cell border.
|
|
255
|
-
* @param override Override existing value.
|
|
256
|
-
*/
|
|
257
|
-
border(enable = true, override = true) {
|
|
258
|
-
if (override || typeof this.options.border === "undefined") {
|
|
259
|
-
this.options.border = enable;
|
|
260
|
-
}
|
|
261
|
-
return this;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Align table content.
|
|
265
|
-
*
|
|
266
|
-
* @param direction Align direction.
|
|
267
|
-
* @param override Override existing value.
|
|
268
|
-
*/
|
|
269
|
-
align(direction, override = true) {
|
|
270
|
-
if (override || typeof this.options.align === "undefined") {
|
|
271
|
-
this.options.align = direction;
|
|
272
|
-
}
|
|
273
|
-
return this;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Set border characters.
|
|
277
|
-
*
|
|
278
|
-
* @param chars Border options.
|
|
279
|
-
*/
|
|
280
|
-
chars(chars) {
|
|
281
|
-
Object.assign(this.options.chars, chars);
|
|
282
|
-
return this;
|
|
283
|
-
}
|
|
284
|
-
/** Get table header. */
|
|
285
|
-
getHeader() {
|
|
286
|
-
return this.headerRow;
|
|
287
|
-
}
|
|
288
|
-
/** Get table body. */
|
|
289
|
-
getBody() {
|
|
290
|
-
return [...this];
|
|
291
|
-
}
|
|
292
|
-
/** Get max column width. */
|
|
293
|
-
getMaxColWidth() {
|
|
294
|
-
return this.options.maxColWidth;
|
|
295
|
-
}
|
|
296
|
-
/** Get min column width. */
|
|
297
|
-
getMinColWidth() {
|
|
298
|
-
return this.options.minColWidth;
|
|
299
|
-
}
|
|
300
|
-
/** Get table indentation. */
|
|
301
|
-
getIndent() {
|
|
302
|
-
return this.options.indent;
|
|
303
|
-
}
|
|
304
|
-
/** Get cell padding. */
|
|
305
|
-
getPadding() {
|
|
306
|
-
return this.options.padding;
|
|
307
|
-
}
|
|
308
|
-
/** Check if table has border. */
|
|
309
|
-
getBorder() {
|
|
310
|
-
return this.options.border === true;
|
|
311
|
-
}
|
|
312
|
-
/** Check if header row has border. */
|
|
313
|
-
hasHeaderBorder() {
|
|
314
|
-
const hasBorder = this.headerRow?.hasBorder();
|
|
315
|
-
return hasBorder === true || (this.getBorder() && hasBorder !== false);
|
|
316
|
-
}
|
|
317
|
-
/** Check if table bordy has border. */
|
|
318
|
-
hasBodyBorder() {
|
|
319
|
-
return this.getBorder() ||
|
|
320
|
-
this.options.columns.some((column) => column.getBorder()) ||
|
|
321
|
-
this.some((row) => row instanceof Row
|
|
322
|
-
? row.hasBorder()
|
|
323
|
-
: row.some((cell) => cell instanceof Cell ? cell.getBorder() : false));
|
|
324
|
-
}
|
|
325
|
-
/** Check if table header or body has border. */
|
|
326
|
-
hasBorder() {
|
|
327
|
-
return this.hasHeaderBorder() || this.hasBodyBorder();
|
|
328
|
-
}
|
|
329
|
-
/** Get table alignment. */
|
|
330
|
-
getAlign() {
|
|
331
|
-
return this.options.align ?? "left";
|
|
332
|
-
}
|
|
333
|
-
/** Get columns. */
|
|
334
|
-
getColumns() {
|
|
335
|
-
return this.options.columns;
|
|
336
|
-
}
|
|
337
|
-
/** Get column by column index. */
|
|
338
|
-
getColumn(index) {
|
|
339
|
-
return this.options.columns[index] ??= new Column();
|
|
340
|
-
}
|
|
341
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
let tables = null;
|
|
2
|
-
const data = {
|
|
3
|
-
"UNICODE_VERSION": "15.0.0",
|
|
4
|
-
"tables": [
|
|
5
|
-
{
|
|
6
|
-
"d": "AAECAwQFBgcICQoLDA0OAw8DDwkQCRESERIA",
|
|
7
|
-
"r": "AQEBAgEBAQEBAQEBAQEBBwEHAVABBwcBBwF4",
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"d": "AAECAwQFBgcGCAYJCgsMDQ4PEAYREhMUBhUWFxgZGhscHR4fICEiIyIkJSYnKCkqJSssLS4vMDEyMzQ1Njc4OToGOzwKBj0GPj9AQUIGQwZEBkVGR0hJSktMTQZOBgoGT1BRUlNUVVZXWFkGWgZbBlxdXl1fYGFiY2RlZmdoBmlqBmsGAQZsBm1uO29wcXI7czt0dXZ3OwY7eHkGent8Bn0Gfn+AgYKDhIWGBoc7iAZdO4kGiosGAXGMBo0GjgaPBpAGkQaSBpMGlJUGlpcGmJmam5ydnp+gLgahLKIGo6SlpganqKmqqwasBq0Grq8GsLGyswa0BrUGtre4Brm6uwZHvAa9vga/wME7wjvDxAbFO8bHO8gGyQbKywbMzQbOBs/Q0QbSBr8GvgbT1AbUBtUG1gbXBtjZ2tsG3N0G3t/g4eLjO+Tl5ufoO+k76gbrBuztOw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kBAQEBCQEBAQEQAQIBDwEBARQBAQEBBwEBAQkBAQEBAQECAQEBCwECAQEVAQEBAQQBBQEBAQEOAQEBAQEBEgEBFgEBAgEMAQEBAQ8BAQMBFgEBDgEBBQEPAQETAQECAQMOAgUBCgIBGQEBAQEIAQMBBwEBAwECEwgBAQcLAQUBFwEBAQEDAQEBBwEBBAEBDg0BAQwBAQEDAQQBAQEDBAEBBAEBAQEBEAEPAQgBAQsBAQ4BEQEMAgEBBwEOAQEHAQEBAQQBBAEDCwECAQEBAwEBBggBAgEBAREBBQMKAQEBAwQCEQEBHgEPAQIBAQYEAQYBAwEUAQUMAQEBAQEBAQECAQEBAgEIAwEBBgsBAgEODAMBAgEBCwEBAQEBAwECAQECAQEBBwgPAQ==",
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
};
|
|
19
|
-
function lookupWidth(cp) {
|
|
20
|
-
if (!tables) {
|
|
21
|
-
tables = data.tables.map(runLengthDecode);
|
|
22
|
-
}
|
|
23
|
-
const t1Offset = tables.at(0)?.[(cp >> 13) & 0xff] ?? 0;
|
|
24
|
-
const t2Offset = tables.at(1)?.[128 * t1Offset + ((cp >> 6) & 0x7f)] ?? 0;
|
|
25
|
-
const packedWidths = tables.at(2)?.[16 * t2Offset + ((cp >> 2) & 0xf)] ?? 0;
|
|
26
|
-
const width = (packedWidths >> (2 * (cp & 0b11))) & 0b11;
|
|
27
|
-
return width === 3 ? 1 : width;
|
|
28
|
-
}
|
|
29
|
-
const cache = new Map();
|
|
30
|
-
function charWidth(char) {
|
|
31
|
-
const cached = cache.get(char);
|
|
32
|
-
if (cached !== undefined) {
|
|
33
|
-
return cached;
|
|
34
|
-
}
|
|
35
|
-
const codePoint = char.codePointAt(0);
|
|
36
|
-
if (codePoint === undefined) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
let width;
|
|
40
|
-
if (codePoint < 0x7f) {
|
|
41
|
-
width = codePoint >= 0x20 ? 1 : codePoint === 0 ? 0 : null;
|
|
42
|
-
}
|
|
43
|
-
else if (codePoint >= 0xa0) {
|
|
44
|
-
width = lookupWidth(codePoint);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
width = null;
|
|
48
|
-
}
|
|
49
|
-
cache.set(char, width);
|
|
50
|
-
return width;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Calculate the physical width of a string in a TTY-like environment. This is
|
|
54
|
-
* useful for cases such as calculating where a line-wrap will occur and
|
|
55
|
-
* underlining strings.
|
|
56
|
-
*
|
|
57
|
-
* The physical width is given by the number of columns required to display
|
|
58
|
-
* the string. The number of columns a given unicode character occupies can
|
|
59
|
-
* vary depending on the character itself.
|
|
60
|
-
*
|
|
61
|
-
* @param str The string to measure.
|
|
62
|
-
* @returns The unicode width of the string.
|
|
63
|
-
*
|
|
64
|
-
* @example Calculating the unicode width of a string
|
|
65
|
-
* ```ts
|
|
66
|
-
* import { unicodeWidth } from "@std/cli/unicode-width";
|
|
67
|
-
* import { assertEquals } from "@std/assert";
|
|
68
|
-
*
|
|
69
|
-
* assertEquals(unicodeWidth("hello world"), 11);
|
|
70
|
-
* assertEquals(unicodeWidth("天地玄黃宇宙洪荒"), 16);
|
|
71
|
-
* assertEquals(unicodeWidth("fullwidth"), 18);
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* @example Calculating the unicode width of a color-encoded string
|
|
75
|
-
* ```ts
|
|
76
|
-
* import { unicodeWidth } from "@std/cli/unicode-width";
|
|
77
|
-
* import { stripAnsiCode } from "@std/fmt/colors";
|
|
78
|
-
* import { assertEquals } from "@std/assert";
|
|
79
|
-
*
|
|
80
|
-
* assertEquals(unicodeWidth(stripAnsiCode("\x1b[36mголубой\x1b[39m")), 7);
|
|
81
|
-
* assertEquals(unicodeWidth(stripAnsiCode("\x1b[31m紅色\x1b[39m")), 4);
|
|
82
|
-
* assertEquals(unicodeWidth(stripAnsiCode("\x1B]8;;https://deno.land\x07🦕\x1B]8;;\x07")), 2);
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* Use
|
|
86
|
-
* {@linkcode https://jsr.io/@std/fmt/doc/colors/~/stripAnsiCode | stripAnsiCode}
|
|
87
|
-
* to remove ANSI escape codes from a string before passing it to
|
|
88
|
-
* {@linkcode unicodeWidth}.
|
|
89
|
-
*/
|
|
90
|
-
export function unicodeWidth(str) {
|
|
91
|
-
return [...str].map((ch) => charWidth(ch) ?? 0).reduce((a, b) => a + b, 0);
|
|
92
|
-
}
|
|
93
|
-
function runLengthDecode({ d, r }) {
|
|
94
|
-
const data = atob(d);
|
|
95
|
-
const runLengths = atob(r);
|
|
96
|
-
let out = "";
|
|
97
|
-
for (const [i, ch] of [...runLengths].entries()) {
|
|
98
|
-
out += data.charAt(i).repeat(ch.codePointAt(0) ?? 0);
|
|
99
|
-
}
|
|
100
|
-
return Uint8Array.from([...out].map((x) => x.codePointAt(0) ?? 0));
|
|
101
|
-
}
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
// @generated file from wasmbuild -- do not edit
|
|
2
|
-
// @ts-nocheck: generated
|
|
3
|
-
// deno-lint-ignore-file
|
|
4
|
-
// deno-fmt-ignore-file
|
|
5
|
-
let wasm;
|
|
6
|
-
export function __wbg_set_wasm(val) {
|
|
7
|
-
wasm = val;
|
|
8
|
-
}
|
|
9
|
-
const lTextDecoder = typeof TextDecoder === "undefined"
|
|
10
|
-
? (0, module.require)("util").TextDecoder
|
|
11
|
-
: TextDecoder;
|
|
12
|
-
let cachedTextDecoder = new lTextDecoder("utf-8", {
|
|
13
|
-
ignoreBOM: true,
|
|
14
|
-
fatal: true,
|
|
15
|
-
});
|
|
16
|
-
cachedTextDecoder.decode();
|
|
17
|
-
let cachedUint8ArrayMemory0 = null;
|
|
18
|
-
function getUint8ArrayMemory0() {
|
|
19
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
20
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
21
|
-
}
|
|
22
|
-
return cachedUint8ArrayMemory0;
|
|
23
|
-
}
|
|
24
|
-
function getStringFromWasm0(ptr, len) {
|
|
25
|
-
ptr = ptr >>> 0;
|
|
26
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
27
|
-
}
|
|
28
|
-
let WASM_VECTOR_LEN = 0;
|
|
29
|
-
const lTextEncoder = typeof TextEncoder === "undefined"
|
|
30
|
-
? (0, module.require)("util").TextEncoder
|
|
31
|
-
: TextEncoder;
|
|
32
|
-
let cachedTextEncoder = new lTextEncoder("utf-8");
|
|
33
|
-
const encodeString = typeof cachedTextEncoder.encodeInto === "function"
|
|
34
|
-
? function (arg, view) {
|
|
35
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
36
|
-
}
|
|
37
|
-
: function (arg, view) {
|
|
38
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
39
|
-
view.set(buf);
|
|
40
|
-
return {
|
|
41
|
-
read: arg.length,
|
|
42
|
-
written: buf.length,
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
46
|
-
if (realloc === undefined) {
|
|
47
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
48
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
49
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
50
|
-
WASM_VECTOR_LEN = buf.length;
|
|
51
|
-
return ptr;
|
|
52
|
-
}
|
|
53
|
-
let len = arg.length;
|
|
54
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
55
|
-
const mem = getUint8ArrayMemory0();
|
|
56
|
-
let offset = 0;
|
|
57
|
-
for (; offset < len; offset++) {
|
|
58
|
-
const code = arg.charCodeAt(offset);
|
|
59
|
-
if (code > 0x7F)
|
|
60
|
-
break;
|
|
61
|
-
mem[ptr + offset] = code;
|
|
62
|
-
}
|
|
63
|
-
if (offset !== len) {
|
|
64
|
-
if (offset !== 0) {
|
|
65
|
-
arg = arg.slice(offset);
|
|
66
|
-
}
|
|
67
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
68
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
69
|
-
const ret = encodeString(arg, view);
|
|
70
|
-
offset += ret.written;
|
|
71
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
72
|
-
}
|
|
73
|
-
WASM_VECTOR_LEN = offset;
|
|
74
|
-
return ptr;
|
|
75
|
-
}
|
|
76
|
-
function isLikeNone(x) {
|
|
77
|
-
return x === undefined || x === null;
|
|
78
|
-
}
|
|
79
|
-
function takeFromExternrefTable0(idx) {
|
|
80
|
-
const value = wasm.__wbindgen_export_0.get(idx);
|
|
81
|
-
wasm.__externref_table_dealloc(idx);
|
|
82
|
-
return value;
|
|
83
|
-
}
|
|
84
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
85
|
-
ptr = ptr >>> 0;
|
|
86
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns the digest of the given `data` using the given hash `algorithm`.
|
|
90
|
-
*
|
|
91
|
-
* `length` will usually be left `undefined` to use the default length for
|
|
92
|
-
* the algorithm. For algorithms with variable-length output, it can be used
|
|
93
|
-
* to specify a non-negative integer number of bytes.
|
|
94
|
-
*
|
|
95
|
-
* An error will be thrown if `algorithm` is not a supported hash algorithm or
|
|
96
|
-
* `length` is not a supported length for the algorithm.
|
|
97
|
-
* @param {string} algorithm
|
|
98
|
-
* @param {Uint8Array} data
|
|
99
|
-
* @param {number | null} [length]
|
|
100
|
-
* @returns {Uint8Array}
|
|
101
|
-
*/
|
|
102
|
-
export function digest(algorithm, data, length) {
|
|
103
|
-
const ptr0 = passStringToWasm0(algorithm, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
104
|
-
const len0 = WASM_VECTOR_LEN;
|
|
105
|
-
const ret = wasm.digest(ptr0, len0, data, isLikeNone(length) ? 0x100000001 : length >>> 0);
|
|
106
|
-
if (ret[3]) {
|
|
107
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
108
|
-
}
|
|
109
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
110
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
111
|
-
return v2;
|
|
112
|
-
}
|
|
113
|
-
const DigestContextFinalization = (typeof FinalizationRegistry === "undefined")
|
|
114
|
-
? { register: () => { }, unregister: () => { } }
|
|
115
|
-
: new FinalizationRegistry((ptr) => wasm.__wbg_digestcontext_free(ptr >>> 0, 1));
|
|
116
|
-
/**
|
|
117
|
-
* A context for incrementally computing a digest using a given hash algorithm.
|
|
118
|
-
*/
|
|
119
|
-
export class DigestContext {
|
|
120
|
-
__destroy_into_raw() {
|
|
121
|
-
const ptr = this.__wbg_ptr;
|
|
122
|
-
this.__wbg_ptr = 0;
|
|
123
|
-
DigestContextFinalization.unregister(this);
|
|
124
|
-
return ptr;
|
|
125
|
-
}
|
|
126
|
-
free() {
|
|
127
|
-
const ptr = this.__destroy_into_raw();
|
|
128
|
-
wasm.__wbg_digestcontext_free(ptr, 0);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Creates a new context incrementally computing a digest using the given
|
|
132
|
-
* hash algorithm.
|
|
133
|
-
*
|
|
134
|
-
* An error will be thrown if `algorithm` is not a supported hash algorithm.
|
|
135
|
-
* @param {string} algorithm
|
|
136
|
-
*/
|
|
137
|
-
constructor(algorithm) {
|
|
138
|
-
const ptr0 = passStringToWasm0(algorithm, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
139
|
-
const len0 = WASM_VECTOR_LEN;
|
|
140
|
-
const ret = wasm.digestcontext_new(ptr0, len0);
|
|
141
|
-
if (ret[2]) {
|
|
142
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
143
|
-
}
|
|
144
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
145
|
-
DigestContextFinalization.register(this, this.__wbg_ptr, this);
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Update the digest's internal state with the additional input `data`.
|
|
150
|
-
*
|
|
151
|
-
* If the `data` array view is large, it will be split into subarrays (via
|
|
152
|
-
* JavaScript bindings) which will be processed sequentially in order to
|
|
153
|
-
* limit the amount of memory that needs to be allocated in the Wasm heap.
|
|
154
|
-
* @param {Uint8Array} data
|
|
155
|
-
*/
|
|
156
|
-
update(data) {
|
|
157
|
-
const ret = wasm.digestcontext_update(this.__wbg_ptr, data);
|
|
158
|
-
if (ret[1]) {
|
|
159
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Returns the digest of the input data so far, and then drops the context
|
|
164
|
-
* from memory on the Wasm side. This context must no longer be used, and any
|
|
165
|
-
* further method calls will result in null pointer errors being thrown.
|
|
166
|
-
* https://github.com/rustwasm/wasm-bindgen/blob/bf39cfd8/crates/backend/src/codegen.rs#L186
|
|
167
|
-
*
|
|
168
|
-
* `length` will usually be left `undefined` to use the default length for
|
|
169
|
-
* the algorithm. For algorithms with variable-length output, it can be used
|
|
170
|
-
* to specify a non-negative integer number of bytes.
|
|
171
|
-
*
|
|
172
|
-
* An error will be thrown if `length` is not a supported length for the algorithm.
|
|
173
|
-
* @param {number | null} [length]
|
|
174
|
-
* @returns {Uint8Array}
|
|
175
|
-
*/
|
|
176
|
-
digestAndDrop(length) {
|
|
177
|
-
const ptr = this.__destroy_into_raw();
|
|
178
|
-
const ret = wasm.digestcontext_digestAndDrop(ptr, isLikeNone(length) ? 0x100000001 : length >>> 0);
|
|
179
|
-
if (ret[3]) {
|
|
180
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
181
|
-
}
|
|
182
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
183
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
184
|
-
return v1;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
export function __wbg_buffer_09165b52af8c5237(arg0) {
|
|
188
|
-
const ret = arg0.buffer;
|
|
189
|
-
return ret;
|
|
190
|
-
}
|
|
191
|
-
export function __wbg_buffer_609cc3eee51ed158(arg0) {
|
|
192
|
-
const ret = arg0.buffer;
|
|
193
|
-
return ret;
|
|
194
|
-
}
|
|
195
|
-
export function __wbg_byteLength_e674b853d9c77e1d(arg0) {
|
|
196
|
-
const ret = arg0.byteLength;
|
|
197
|
-
return ret;
|
|
198
|
-
}
|
|
199
|
-
export function __wbg_byteOffset_fd862df290ef848d(arg0) {
|
|
200
|
-
const ret = arg0.byteOffset;
|
|
201
|
-
return ret;
|
|
202
|
-
}
|
|
203
|
-
export function __wbg_length_a446193dc22c12f8(arg0) {
|
|
204
|
-
const ret = arg0.length;
|
|
205
|
-
return ret;
|
|
206
|
-
}
|
|
207
|
-
export function __wbg_new_a12002a7f91c75be(arg0) {
|
|
208
|
-
const ret = new Uint8Array(arg0);
|
|
209
|
-
return ret;
|
|
210
|
-
}
|
|
211
|
-
export function __wbg_new_b08a00743b8ae2f3(arg0, arg1) {
|
|
212
|
-
const ret = new TypeError(getStringFromWasm0(arg0, arg1));
|
|
213
|
-
return ret;
|
|
214
|
-
}
|
|
215
|
-
export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) {
|
|
216
|
-
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
217
|
-
return ret;
|
|
218
|
-
}
|
|
219
|
-
export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
|
|
220
|
-
arg0.set(arg1, arg2 >>> 0);
|
|
221
|
-
}
|
|
222
|
-
export function __wbindgen_init_externref_table() {
|
|
223
|
-
const table = wasm.__wbindgen_export_0;
|
|
224
|
-
const offset = table.grow(4);
|
|
225
|
-
table.set(0, undefined);
|
|
226
|
-
table.set(offset + 0, undefined);
|
|
227
|
-
table.set(offset + 1, null);
|
|
228
|
-
table.set(offset + 2, true);
|
|
229
|
-
table.set(offset + 3, false);
|
|
230
|
-
}
|
|
231
|
-
export function __wbindgen_memory() {
|
|
232
|
-
const ret = wasm.memory;
|
|
233
|
-
return ret;
|
|
234
|
-
}
|
|
235
|
-
export function __wbindgen_throw(arg0, arg1) {
|
|
236
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
237
|
-
}
|