@statewalker/vcs-commands 0.7.0 → 0.8.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/dist/commands/add-command.d.ts +38 -0
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/am/am-command.d.ts +55 -1
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/am/index.d.ts +1 -0
- package/dist/commands/am/index.d.ts.map +1 -1
- package/dist/commands/am/mailsplit.d.ts +88 -0
- package/dist/commands/am/mailsplit.d.ts.map +1 -0
- package/dist/commands/apply/apply-command.d.ts.map +1 -1
- package/dist/commands/apply/apply-engine.d.ts.map +1 -1
- package/dist/commands/apply/apply-parse.d.ts.map +1 -1
- package/dist/commands/bisect/bisect-command.d.ts +2 -0
- package/dist/commands/bisect/bisect-command.d.ts.map +1 -1
- package/dist/commands/branch-command.d.ts +148 -18
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/branch-info-command.d.ts +55 -0
- package/dist/commands/branch-info-command.d.ts.map +1 -0
- package/dist/commands/branch-tracking.d.ts +106 -17
- package/dist/commands/branch-tracking.d.ts.map +1 -1
- package/dist/commands/branch-upstream-command.d.ts +83 -0
- package/dist/commands/branch-upstream-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +19 -3
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/cherry-pick-command.d.ts +59 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +12 -0
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +191 -5
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/commit-reuse.d.ts +33 -0
- package/dist/commands/commit-reuse.d.ts.map +1 -0
- package/dist/commands/config-command.d.ts +236 -0
- package/dist/commands/config-command.d.ts.map +1 -0
- package/dist/commands/config-value-types.d.ts +91 -0
- package/dist/commands/config-value-types.d.ts.map +1 -0
- package/dist/commands/core-config.d.ts +20 -0
- package/dist/commands/core-config.d.ts.map +1 -1
- package/dist/commands/diff-color-config.d.ts +73 -0
- package/dist/commands/diff-color-config.d.ts.map +1 -0
- package/dist/commands/diff-command.d.ts +252 -5
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +20 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fmt-merge-msg-command.d.ts +124 -0
- package/dist/commands/fmt-merge-msg-command.d.ts.map +1 -0
- package/dist/commands/fork-point.d.ts +38 -0
- package/dist/commands/fork-point.d.ts.map +1 -0
- package/dist/commands/format-patch-command.d.ts +41 -1
- package/dist/commands/format-patch-command.d.ts.map +1 -1
- package/dist/commands/fsck/fetch-fsck.d.ts +51 -0
- package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -1
- package/dist/commands/gc-command.d.ts +8 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-describe.d.ts +4 -0
- package/dist/commands/git-describe.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +35 -0
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/grep/grep-command.d.ts +210 -0
- package/dist/commands/grep/grep-command.d.ts.map +1 -0
- package/dist/commands/grep/grep-engine.d.ts +218 -0
- package/dist/commands/grep/grep-engine.d.ts.map +1 -0
- package/dist/commands/grep/index.d.ts +3 -0
- package/dist/commands/grep/index.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +13 -2
- package/dist/commands/index-adder.d.ts.map +1 -1
- package/dist/commands/index.d.ts +26 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/interpret-trailers-command.d.ts +90 -0
- package/dist/commands/interpret-trailers-command.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts +36 -5
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +296 -11
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +26 -1
- package/dist/commands/log-graph.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +133 -5
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/ls-remote-command.d.ts +2 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/mailmap.d.ts +30 -0
- package/dist/commands/mailmap.d.ts.map +1 -1
- package/dist/commands/merge-base-command.d.ts +60 -0
- package/dist/commands/merge-base-command.d.ts.map +1 -0
- package/dist/commands/merge-bases.d.ts +23 -0
- package/dist/commands/merge-bases.d.ts.map +1 -1
- package/dist/commands/merge-command.d.ts +96 -9
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/mv-command.d.ts +4 -0
- package/dist/commands/mv-command.d.ts.map +1 -1
- package/dist/commands/name-rev.d.ts +48 -0
- package/dist/commands/name-rev.d.ts.map +1 -0
- package/dist/commands/notes-command.d.ts.map +1 -1
- package/dist/commands/pathspec-file.d.ts +39 -0
- package/dist/commands/pathspec-file.d.ts.map +1 -0
- package/dist/commands/pathspec.d.ts +3 -0
- package/dist/commands/pathspec.d.ts.map +1 -1
- package/dist/commands/pretty-format.d.ts +43 -3
- package/dist/commands/pretty-format.d.ts.map +1 -1
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts +10 -0
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +160 -9
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/read-tree-command.d.ts +6 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +168 -6
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/ref-filter/for-each-ref-command.d.ts +121 -0
- package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -0
- package/dist/commands/ref-filter/index.d.ts +8 -0
- package/dist/commands/ref-filter/index.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-atoms.d.ts +88 -0
- package/dist/commands/ref-filter/ref-atoms.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-filter.d.ts +178 -0
- package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-format.d.ts +222 -0
- package/dist/commands/ref-filter/ref-format.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-listing-command.d.ts +56 -0
- package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-quote.d.ts +20 -0
- package/dist/commands/ref-filter/ref-quote.d.ts.map +1 -0
- package/dist/commands/ref-filter/version-compare.d.ts +20 -0
- package/dist/commands/ref-filter/version-compare.d.ts.map +1 -0
- package/dist/commands/reflog-command.d.ts +120 -0
- package/dist/commands/reflog-command.d.ts.map +1 -1
- package/dist/commands/reflog-walk.d.ts +72 -0
- package/dist/commands/reflog-walk.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +138 -29
- package/dist/commands/remote-command.d.ts.map +1 -1
- package/dist/commands/remote-transport.d.ts +7 -1
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/reset-command.d.ts +2 -3
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +2 -3
- package/dist/commands/restore-command.d.ts.map +1 -1
- package/dist/commands/rev-filter/commit-filter.d.ts +95 -0
- package/dist/commands/rev-filter/commit-filter.d.ts.map +1 -0
- package/dist/commands/rev-filter/commit-grep.d.ts +91 -0
- package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -0
- package/dist/commands/rev-filter/index.d.ts +3 -0
- package/dist/commands/rev-filter/index.d.ts.map +1 -0
- package/dist/commands/rev-list-command.d.ts +154 -2
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +32 -0
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +32 -1
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +15 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/rm-command.d.ts +70 -2
- package/dist/commands/rm-command.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +84 -4
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/sequencer-support.d.ts +2 -0
- package/dist/commands/sequencer-support.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +7 -0
- package/dist/commands/serve-repository.d.ts.map +1 -1
- package/dist/commands/show-command.d.ts +130 -0
- package/dist/commands/show-command.d.ts.map +1 -0
- package/dist/commands/show-commit.d.ts +11 -0
- package/dist/commands/show-commit.d.ts.map +1 -0
- package/dist/commands/signature-check.d.ts +164 -0
- package/dist/commands/signature-check.d.ts.map +1 -0
- package/dist/commands/signing.d.ts +160 -0
- package/dist/commands/signing.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-command.d.ts.map +1 -1
- package/dist/commands/sparse-index-view.d.ts +45 -0
- package/dist/commands/sparse-index-view.d.ts.map +1 -0
- package/dist/commands/ssh-signer.d.ts +29 -0
- package/dist/commands/ssh-signer.d.ts.map +1 -0
- package/dist/commands/ssh-verifier.d.ts +42 -0
- package/dist/commands/ssh-verifier.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +5 -0
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-branch-command.d.ts +34 -0
- package/dist/commands/stash-branch-command.d.ts.map +1 -0
- package/dist/commands/stash-create-command.d.ts +17 -0
- package/dist/commands/stash-create-command.d.ts.map +1 -1
- package/dist/commands/stash-info.d.ts +93 -0
- package/dist/commands/stash-info.d.ts.map +1 -0
- package/dist/commands/stash-list-command.d.ts +16 -0
- package/dist/commands/stash-list-command.d.ts.map +1 -1
- package/dist/commands/stash-pop-command.d.ts +39 -0
- package/dist/commands/stash-pop-command.d.ts.map +1 -0
- package/dist/commands/stash-show-command.d.ts +48 -0
- package/dist/commands/stash-show-command.d.ts.map +1 -0
- package/dist/commands/stash-store-command.d.ts +29 -0
- package/dist/commands/stash-store-command.d.ts.map +1 -0
- package/dist/commands/stash-working-tree.d.ts.map +1 -1
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-header.d.ts +5 -0
- package/dist/commands/status-header.d.ts.map +1 -1
- package/dist/commands/submodule-add-command.d.ts +89 -0
- package/dist/commands/submodule-add-command.d.ts.map +1 -0
- package/dist/commands/submodule-auth.d.ts +90 -0
- package/dist/commands/submodule-auth.d.ts.map +1 -0
- package/dist/commands/submodule-commands.d.ts +375 -0
- package/dist/commands/submodule-commands.d.ts.map +1 -0
- package/dist/commands/submodule-model.d.ts +288 -0
- package/dist/commands/submodule-model.d.ts.map +1 -0
- package/dist/commands/submodule-update-command.d.ts +198 -0
- package/dist/commands/submodule-update-command.d.ts.map +1 -0
- package/dist/commands/switch-command.d.ts.map +1 -1
- package/dist/commands/tag-command.d.ts +259 -10
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/trailers.d.ts +218 -17
- package/dist/commands/trailers.d.ts.map +1 -1
- package/dist/commands/tree-restore.d.ts +7 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/verify-command.d.ts +92 -0
- package/dist/commands/verify-command.d.ts.map +1 -0
- package/dist/commands/worktree-add-command.d.ts +79 -7
- package/dist/commands/worktree-add-command.d.ts.map +1 -1
- package/dist/commands/worktree-path-rules.d.ts +66 -0
- package/dist/commands/worktree-path-rules.d.ts.map +1 -0
- package/dist/commands/worktree-remove-command.d.ts +10 -3
- package/dist/commands/worktree-remove-command.d.ts.map +1 -1
- package/dist/commands/worktree-repair-command.d.ts +15 -2
- package/dist/commands/worktree-repair-command.d.ts.map +1 -1
- package/dist/commands/worktree-support.d.ts +5 -0
- package/dist/commands/worktree-support.d.ts.map +1 -1
- package/dist/{commands-DIJ91NnD.js → commands-ISM52N0n.js} +70736 -54492
- package/dist/errors/checkout-errors.d.ts +19 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -1
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +57 -3
- package/dist/errors/ref-errors.d.ts +19 -0
- package/dist/errors/ref-errors.d.ts.map +1 -1
- package/dist/errors/worktree-errors.d.ts +6 -1
- package/dist/errors/worktree-errors.d.ts.map +1 -1
- package/dist/{git-command-BGiOJ8Zk.js → fsck-DLRpbwTj.js} +6230 -71
- package/dist/git-command.d.ts +27 -1
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +267 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/remote-config/index.d.ts +1 -1
- package/dist/remote-config/index.d.ts.map +1 -1
- package/dist/remote-config/remote-config-store.d.ts +55 -0
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/results/combined-diff.d.ts +3 -0
- package/dist/results/combined-diff.d.ts.map +1 -1
- package/dist/results/diff-check.d.ts +38 -0
- package/dist/results/diff-check.d.ts.map +1 -0
- package/dist/results/diff-color.d.ts +135 -0
- package/dist/results/diff-color.d.ts.map +1 -0
- package/dist/results/diff-output.d.ts +85 -1
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/diff-pickaxe.d.ts +67 -0
- package/dist/results/diff-pickaxe.d.ts.map +1 -0
- package/dist/results/diff-words.d.ts +55 -0
- package/dist/results/diff-words.d.ts.map +1 -0
- package/dist/results/index.d.ts +4 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/push-result.d.ts +7 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/rebase-result.d.ts +2 -0
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/stash-result.d.ts +6 -0
- package/dist/results/stash-result.d.ts.map +1 -1
- package/dist/{results-WVlBhVb1.js → results-TB2IJ64h.js} +2168 -403
- package/dist/whitespace/index.d.ts +2 -0
- package/dist/whitespace/index.d.ts.map +1 -0
- package/dist/whitespace/whitespace-rule.d.ts +94 -0
- package/dist/whitespace/whitespace-rule.d.ts.map +1 -0
- package/package.json +12 -12
- package/src/commands/add-command.ts +178 -17
- package/src/commands/am/am-command.ts +262 -42
- package/src/commands/am/index.ts +1 -0
- package/src/commands/am/mailsplit.ts +326 -0
- package/src/commands/apply/apply-command.ts +6 -6
- package/src/commands/apply/apply-engine.ts +1 -1
- package/src/commands/apply/apply-parse.ts +7 -8
- package/src/commands/bisect/bisect-command.ts +18 -5
- package/src/commands/branch-command.ts +528 -53
- package/src/commands/branch-info-command.ts +150 -0
- package/src/commands/branch-tracking.ts +335 -60
- package/src/commands/branch-upstream-command.ts +218 -0
- package/src/commands/checkout-command.ts +69 -43
- package/src/commands/cherry-pick-command.ts +143 -0
- package/src/commands/clean-command.ts +34 -3
- package/src/commands/clone-command.ts +2 -1
- package/src/commands/commit-command.ts +782 -64
- package/src/commands/commit-reuse.ts +94 -0
- package/src/commands/config-command.ts +1256 -0
- package/src/commands/config-value-types.ts +358 -0
- package/src/commands/core-config.ts +40 -0
- package/src/commands/diff-color-config.ts +274 -0
- package/src/commands/diff-command.ts +1009 -49
- package/src/commands/fetch-command.ts +142 -8
- package/src/commands/fmt-merge-msg-command.ts +715 -0
- package/src/commands/fork-point.ts +63 -0
- package/src/commands/format-patch-command.ts +314 -46
- package/src/commands/fsck/fetch-fsck.ts +172 -18
- package/src/commands/gc-command.ts +31 -1
- package/src/commands/git-describe.ts +31 -11
- package/src/commands/git-hooks.ts +81 -0
- package/src/commands/grep/grep-command.ts +1077 -0
- package/src/commands/grep/grep-engine.ts +1024 -0
- package/src/commands/grep/index.ts +2 -0
- package/src/commands/index-adder.ts +46 -7
- package/src/commands/index.ts +26 -0
- package/src/commands/interpret-trailers-command.ts +256 -0
- package/src/commands/local-transport.ts +109 -10
- package/src/commands/log-command.ts +1246 -210
- package/src/commands/log-graph.ts +123 -26
- package/src/commands/log-output.ts +280 -21
- package/src/commands/ls-remote-command.ts +5 -0
- package/src/commands/mailmap.ts +119 -0
- package/src/commands/merge-base-command.ts +170 -0
- package/src/commands/merge-bases.ts +63 -8
- package/src/commands/merge-command.ts +330 -82
- package/src/commands/merge-support.ts +14 -1
- package/src/commands/mv-command.ts +6 -3
- package/src/commands/name-rev.ts +171 -0
- package/src/commands/notes-command.ts +11 -1
- package/src/commands/pathspec-file.ts +72 -0
- package/src/commands/pathspec.ts +14 -2
- package/src/commands/pretty-format.ts +103 -19
- package/src/commands/promisor-remote.ts +10 -1
- package/src/commands/pull-command.ts +26 -7
- package/src/commands/push-command.ts +682 -65
- package/src/commands/read-tree-command.ts +28 -1
- package/src/commands/rebase-command.ts +933 -129
- package/src/commands/ref-filter/for-each-ref-command.ts +298 -0
- package/src/commands/ref-filter/index.ts +7 -0
- package/src/commands/ref-filter/ref-atoms.ts +581 -0
- package/src/commands/ref-filter/ref-filter.ts +651 -0
- package/src/commands/ref-filter/ref-format.ts +1070 -0
- package/src/commands/ref-filter/ref-listing-command.ts +421 -0
- package/src/commands/ref-filter/ref-quote.ts +69 -0
- package/src/commands/ref-filter/version-compare.ts +177 -0
- package/src/commands/reflog-command.ts +492 -2
- package/src/commands/reflog-walk.ts +234 -0
- package/src/commands/remote-command.ts +449 -69
- package/src/commands/remote-transport.ts +9 -1
- package/src/commands/reset-command.ts +36 -31
- package/src/commands/restore-command.ts +12 -41
- package/src/commands/rev-filter/commit-filter.ts +159 -0
- package/src/commands/rev-filter/commit-grep.ts +444 -0
- package/src/commands/rev-filter/index.ts +2 -0
- package/src/commands/rev-list-command.ts +402 -15
- package/src/commands/revert-command.ts +82 -0
- package/src/commands/revision-range.ts +204 -4
- package/src/commands/revision-resolver.ts +23 -8
- package/src/commands/rm-command.ts +282 -21
- package/src/commands/sequencer-pick.ts +498 -85
- package/src/commands/sequencer-support.ts +20 -2
- package/src/commands/serve-repository.ts +18 -3
- package/src/commands/show-command.ts +490 -0
- package/src/commands/show-commit.ts +24 -0
- package/src/commands/signature-check.ts +657 -0
- package/src/commands/signing.ts +385 -0
- package/src/commands/sparse-checkout-command.ts +2 -9
- package/src/commands/sparse-checkout-support.ts +2 -2
- package/src/commands/sparse-index-view.ts +135 -0
- package/src/commands/ssh-signer.ts +199 -0
- package/src/commands/ssh-verifier.ts +523 -0
- package/src/commands/stash-apply-command.ts +16 -4
- package/src/commands/stash-branch-command.ts +88 -0
- package/src/commands/stash-create-command.ts +28 -0
- package/src/commands/stash-info.ts +243 -0
- package/src/commands/stash-list-command.ts +33 -0
- package/src/commands/stash-pop-command.ts +83 -0
- package/src/commands/stash-show-command.ts +141 -0
- package/src/commands/stash-store-command.ts +82 -0
- package/src/commands/stash-working-tree.ts +2 -2
- package/src/commands/status-command.ts +5 -2
- package/src/commands/status-header.ts +41 -7
- package/src/commands/submodule-add-command.ts +509 -0
- package/src/commands/submodule-auth.ts +276 -0
- package/src/commands/submodule-commands.ts +1517 -0
- package/src/commands/submodule-model.ts +930 -0
- package/src/commands/submodule-update-command.ts +1092 -0
- package/src/commands/switch-command.ts +3 -1
- package/src/commands/tag-command.ts +876 -64
- package/src/commands/trailers.ts +837 -100
- package/src/commands/tree-restore.ts +38 -10
- package/src/commands/verify-command.ts +235 -0
- package/src/commands/worktree-add-command.ts +268 -24
- package/src/commands/worktree-path-rules.ts +183 -0
- package/src/commands/worktree-remove-command.ts +39 -5
- package/src/commands/worktree-repair-command.ts +52 -5
- package/src/commands/worktree-support.ts +22 -1
- package/src/errors/checkout-errors.ts +29 -0
- package/src/errors/command-errors.ts +2 -1
- package/src/errors/ref-errors.ts +23 -0
- package/src/errors/worktree-errors.ts +8 -1
- package/src/git-command.ts +66 -1
- package/src/git.ts +404 -1
- package/src/remote-config/index.ts +2 -0
- package/src/remote-config/remote-config-store.ts +101 -0
- package/src/results/combined-diff.ts +38 -18
- package/src/results/diff-check.ts +185 -0
- package/src/results/diff-color.ts +868 -0
- package/src/results/diff-output.ts +195 -30
- package/src/results/diff-pickaxe.ts +304 -0
- package/src/results/diff-words.ts +395 -0
- package/src/results/index.ts +4 -0
- package/src/results/push-result.ts +7 -0
- package/src/results/rebase-result.ts +3 -0
- package/src/results/stash-result.ts +7 -0
- package/src/whitespace/index.ts +1 -0
- package/src/{commands/apply/whitespace.ts → whitespace/whitespace-rule.ts} +173 -23
- package/dist/commands/apply/whitespace.d.ts +0 -58
- package/dist/commands/apply/whitespace.d.ts.map +0 -1
|
@@ -61,6 +61,15 @@ export interface ConfigValueWhere {
|
|
|
61
61
|
/** The scope of that file (`local`, `global`, `system`, `worktree`), where the config tells */
|
|
62
62
|
scope?: string;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* A remote chosen from the configuration (git's `remote_for_branch` / `pushremote_for_branch`
|
|
66
|
+
* with their `explicit` flag): an explicit name may be a URL or path, a fallback must name a
|
|
67
|
+
* configured remote.
|
|
68
|
+
*/
|
|
69
|
+
export interface RemoteChoice {
|
|
70
|
+
name: string;
|
|
71
|
+
explicit: boolean;
|
|
72
|
+
}
|
|
64
73
|
/**
|
|
65
74
|
* The `[remote "<name>"]` sections of a working copy's configuration.
|
|
66
75
|
*
|
|
@@ -83,11 +92,50 @@ export declare class RemoteConfigStore {
|
|
|
83
92
|
static from(workingCopy: WorkingCopy): RemoteConfigStore;
|
|
84
93
|
/** Remote names that have a config section (git's `for_each_remote`: no legacy remotes). */
|
|
85
94
|
configuredNames(): string[];
|
|
95
|
+
/**
|
|
96
|
+
* The remote `branch` fetches from (git's `remote_for_branch`): `branch.<name>.remote`, the
|
|
97
|
+
* one configured remote, else `origin`. A detached HEAD passes no branch.
|
|
98
|
+
*/
|
|
99
|
+
remoteForBranch(branch: string | undefined): string;
|
|
100
|
+
/**
|
|
101
|
+
* The remote `git push` without a remote pushes `branch` to (git's `pushremote_for_branch`):
|
|
102
|
+
* `branch.<name>.pushRemote`, `remote.pushDefault`, then {@link remoteForBranch}. A detached
|
|
103
|
+
* HEAD passes no branch, so only `remote.pushDefault` and the fallbacks apply.
|
|
104
|
+
*/
|
|
105
|
+
pushRemoteForBranch(branch: string | undefined): string;
|
|
106
|
+
/**
|
|
107
|
+
* {@link remoteForBranch} with git's `explicit` flag: true when the name comes from the
|
|
108
|
+
* configuration (`branch.<name>.remote`), so it may be a URL, a path or `.`; false for the
|
|
109
|
+
* fallbacks (the one configured remote, `origin`), which must name a configured remote.
|
|
110
|
+
*/
|
|
111
|
+
remoteChoiceForBranch(branch: string | undefined): RemoteChoice;
|
|
112
|
+
/** {@link pushRemoteForBranch} with git's `explicit` flag (see {@link remoteChoiceForBranch}). */
|
|
113
|
+
pushRemoteChoiceForBranch(branch: string | undefined): RemoteChoice;
|
|
86
114
|
/**
|
|
87
115
|
* Whether the remote is configured (git's `remote_is_configured`): it has a config section,
|
|
88
116
|
* or a legacy remote file loaded for it defines it ({@link legacyOrigin}).
|
|
89
117
|
*/
|
|
90
118
|
isConfigured(name: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Whether the repository's own configuration names the remote (git's
|
|
121
|
+
* `remote_is_configured(remote, 1)`): a `remote.<name>.*` variable read from the local or
|
|
122
|
+
* worktree configuration, or a legacy remote file loaded for it ({@link legacyOrigin}).
|
|
123
|
+
* A remote of the global or system configuration, or of `git -c`, is not one; a config
|
|
124
|
+
* that cannot tell where its variables come from counts every section.
|
|
125
|
+
*/
|
|
126
|
+
isConfiguredInRepo(name: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* The values of a variable in the repository's own configuration file, in file order, as
|
|
129
|
+
* git's config writer sees them (`undefined` for a variable without `=`); a config without
|
|
130
|
+
* that distinction gives every value.
|
|
131
|
+
*/
|
|
132
|
+
localValues(key: string): (string | undefined)[];
|
|
133
|
+
/**
|
|
134
|
+
* git's fetch URLs of a remote (`remote->url` after `alias_all_urls`) or, with `push`, its
|
|
135
|
+
* `pushurl` list as `alias_all_urls` leaves it (empty when the fetch URLs are pushed to):
|
|
136
|
+
* what `git remote set-url` matches its `<oldurl>` pattern against.
|
|
137
|
+
*/
|
|
138
|
+
urlSet(name: string, push: boolean): string[];
|
|
91
139
|
/** Whether the remote has a `[remote "<name>"]` config section. */
|
|
92
140
|
hasSection(name: string): boolean;
|
|
93
141
|
/**
|
|
@@ -251,6 +299,13 @@ export declare class RemoteConfigStore {
|
|
|
251
299
|
entriesWithOriginFor(keys: string[]): (ConfigValueWhere & {
|
|
252
300
|
key: string;
|
|
253
301
|
})[] | undefined;
|
|
302
|
+
/**
|
|
303
|
+
* Every variable in the configuration's order with where it was read (canonical keys);
|
|
304
|
+
* undefined when the config cannot list its variables.
|
|
305
|
+
*/
|
|
306
|
+
allEntriesWithOrigin(): (ConfigValueWhere & {
|
|
307
|
+
key: string;
|
|
308
|
+
})[] | undefined;
|
|
254
309
|
/** Every value of a config variable (`branch.main.merge` may repeat). */
|
|
255
310
|
values(key: string): string[];
|
|
256
311
|
/** Sets a config variable, replacing every value it had. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-config-store.d.ts","sourceRoot":"","sources":["../../src/remote-config/remote-config-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,+BAA+B,CAAC;AAIpF;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oDAAoD;IACpD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qBAAqB;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,oBAAoB;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAID;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,uFAAuF;IACvF,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/B,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oFAAoF;IACpF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,uEAAuE;IACvE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,+FAA+F;IAC/F,UAAU,EAAE,OAAO,CAAC;CACrB;AAKD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,GAAG,SAAS,GAC/B,IAAI,CAWN;
|
|
1
|
+
{"version":3,"file":"remote-config-store.d.ts","sourceRoot":"","sources":["../../src/remote-config/remote-config-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,+BAA+B,CAAC;AAIpF;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oDAAoD;IACpD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qBAAqB;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,oBAAoB;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAID;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,uFAAuF;IACvF,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/B,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oFAAoF;IACpF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,uEAAuE;IACvE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,+FAA+F;IAC/F,UAAU,EAAE,OAAO,CAAC;CACrB;AAKD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,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cs-utils";
|
|
31
|
+
import type { DiffColors } from "./diff-color.js";
|
|
31
32
|
/** One version of a combined diff: a parent or the result */
|
|
32
33
|
export interface CombinedSide {
|
|
33
34
|
/** Object id (the null id for a worktree file) */
|
|
@@ -49,6 +50,8 @@ export interface CombinedDiffOptions extends Pick<UnifiedDiffOptions, "algorithm
|
|
|
49
50
|
context?: number;
|
|
50
51
|
/** `core.quotePath` (default true) */
|
|
51
52
|
quotePath?: boolean;
|
|
53
|
+
/** The colors of `--color` (`color.diff.<slot>`); unset, none are written */
|
|
54
|
+
colors?: DiffColors;
|
|
52
55
|
/** Treat the files as binary (a `diff` attribute) or text, regardless of content */
|
|
53
56
|
binary?: boolean;
|
|
54
57
|
/** Prefix of old paths (default "a/") */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combined-diff.d.ts","sourceRoot":"","sources":["../../src/results/combined-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,kBAAkB,EAOxB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"combined-diff.d.ts","sourceRoot":"","sources":["../../src/results/combined-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,kBAAkB,EAOxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,gCAAgC;AAChC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,2CAA2C;AAC3C,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,kBAAkB,EAChB,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,kBAAkB,GAClB,wBAAwB,GACxB,uBAAuB,GACvB,eAAe,GACf,kBAAkB,CACrB;IACD,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAqbD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,YAAY,EAClB,OAAO,GAAE,mBAAwB,GAChC,IAAI,CAkDN"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `git diff --check` (diff.c's `builtin_checkdiff` and `checkdiff_consume`): the whitespace
|
|
3
|
+
* errors and leftover conflict markers the new side of a pair adds, one
|
|
4
|
+
* `<file>:<line>: <error>.` line each, followed by the offending line with its errors in the
|
|
5
|
+
* `whitespace` color.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const sink = new ByteSink();
|
|
10
|
+
* const failed = await writePairCheck(sink, pair, { whitespaceRule: () => WS_DEFAULT_RULE });
|
|
11
|
+
* // sink: "x:2: trailing whitespace.\n+foo(); \n"
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { type ByteSink } from "@statewalker/vcs-utils";
|
|
17
|
+
import { type DiffFilePair, type DiffOutputOptions } from "./diff-output.js";
|
|
18
|
+
/** `DEFAULT_CONFLICT_MARKER_SIZE` */
|
|
19
|
+
export declare const DEFAULT_CONFLICT_MARKER_SIZE = 7;
|
|
20
|
+
/** What {@link writePairCheck} reads besides the diff options */
|
|
21
|
+
export interface PairCheckOptions {
|
|
22
|
+
/** The `conflict-marker-size` of a path (`ll_merge_marker_size`), default 7 */
|
|
23
|
+
conflictMarkerSize?: (path: string) => Promise<number> | number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* merge-ll.c's `ll_merge_marker_size` over a `conflict-marker-size` attribute value: its
|
|
27
|
+
* integer, else 7 (with git's warning for a value that is no integer)
|
|
28
|
+
*/
|
|
29
|
+
export declare function conflictMarkerSizeOf(attribute: boolean | string | undefined, warn?: (message: string) => void): number;
|
|
30
|
+
/** merge-ll.c's `is_conflict_marker_line` over a line (its LF included) */
|
|
31
|
+
export declare function isConflictMarkerLine(line: Uint8Array, markerSize: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Writes the `--check` report of one pair (`run_checkdiff`); true when it found an error
|
|
34
|
+
* (git's `check_failed`). A tree side or an unmerged pair is not checked; the new side's
|
|
35
|
+
* whitespace rule and marker size are those of its path, and a binary new side is not read.
|
|
36
|
+
*/
|
|
37
|
+
export declare function writePairCheck(sink: ByteSink, pair: DiffFilePair, options?: DiffOutputOptions, check?: PairCheckOptions): Promise<boolean>;
|
|
38
|
+
//# sourceMappingURL=diff-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-check.d.ts","sourceRoot":"","sources":["../../src/results/diff-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAoB,MAAM,wBAAwB,CAAC;AAWzE,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAIvB,MAAM,kBAAkB,CAAC;AAK1B,qCAAqC;AACrC,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CACjE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,EACvC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC/B,MAAM,CAaR;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CASlF;AAWD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,YAAY,EAClB,OAAO,GAAE,iBAAsB,EAC/B,KAAK,GAAE,gBAAqB,GAC3B,OAAO,CAAC,OAAO,CAAC,CAkFlB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git's colored diff output (diff.c's `emit_*` functions, ws.c's `ws_check_emit`) and its
|
|
3
|
+
* moved-line detection (`--color-moved`: `add_lines_to_move_detection`,
|
|
4
|
+
* `mark_color_as_moved`, `dim_moved_lines`), byte for byte as `git diff --color=always`
|
|
5
|
+
* prints them.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const colors = { ...DEFAULT_DIFF_COLORS, old: parseGitColor("magenta") ?? "" };
|
|
10
|
+
* const patch = await formatPatch(pairs, { colors, colorMoved: "zebra" });
|
|
11
|
+
* // "\x1b[1mdiff --git a/f b/f\x1b[m\n...\x1b[31m-old line\x1b[m\n..."
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The palette ({@link DiffColors}) holds the escape sequence of each of git's
|
|
15
|
+
* `color.diff.<slot>` slots; an empty string is git's `normal` (nothing written before the
|
|
16
|
+
* text, a reset still written after it). With a palette, every `+` line (`-` and context
|
|
17
|
+
* lines too, with `--ws-error-highlight`) shows the whitespace errors of the path's
|
|
18
|
+
* whitespace rule (`core.whitespace`, the `whitespace` attribute) in the `whitespace` color.
|
|
19
|
+
* Moved lines are found over all the files of one diff: a writer buffers the lines in a
|
|
20
|
+
* {@link MovedLineBuffer} and {@link MovedLineBuffer.flushTo} marks and prints them.
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
import { ByteSink } from "@statewalker/vcs-utils";
|
|
25
|
+
/** git's color slots of the diff (`color.diff.<slot>`, diff.c's `color_diff_slots`) */
|
|
26
|
+
export declare const DIFF_COLOR_SLOTS: readonly ["context", "meta", "frag", "old", "new", "commit", "whitespace", "func", "oldMoved", "oldMovedAlternative", "oldMovedDimmed", "oldMovedAlternativeDimmed", "newMoved", "newMovedAlternative", "newMovedDimmed", "newMovedAlternativeDimmed", "contextDimmed", "oldDimmed", "newDimmed", "contextBold", "oldBold", "newBold"];
|
|
27
|
+
/** One of {@link DIFF_COLOR_SLOTS} */
|
|
28
|
+
export type DiffColorSlot = (typeof DIFF_COLOR_SLOTS)[number];
|
|
29
|
+
/** The escape sequence of each slot ("" for `normal`), and the reset that ends one */
|
|
30
|
+
export type DiffColors = Record<DiffColorSlot, string> & {
|
|
31
|
+
reset: string;
|
|
32
|
+
};
|
|
33
|
+
/** diff.c's `diff_colors`: git's default palette */
|
|
34
|
+
export declare const DEFAULT_DIFF_COLORS: Readonly<DiffColors>;
|
|
35
|
+
/** `parse_diff_color_slot`: the slot a `color.diff.<name>` names (any case), `plain` the context */
|
|
36
|
+
export declare function diffColorSlotOf(name: string): DiffColorSlot | undefined;
|
|
37
|
+
/** `--color-moved=<mode>` (`default` is `zebra`) */
|
|
38
|
+
export type ColorMovedMode = "no" | "plain" | "blocks" | "zebra" | "dimmed-zebra";
|
|
39
|
+
/**
|
|
40
|
+
* `parse_color_moved`: a boolean (`true` is `zebra`), `no`, `plain`, `blocks`, `zebra`,
|
|
41
|
+
* `default`, `dimmed-zebra` (or `dimmed_zebra`); undefined for anything else
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseColorMoved(arg: string | undefined): ColorMovedMode | undefined;
|
|
44
|
+
/** The message git gives a `--color-moved` mode it does not know */
|
|
45
|
+
export declare const COLOR_MOVED_MODE_ERROR = "error: color moved setting must be one of 'no', 'default', 'blocks', 'zebra', 'dimmed-zebra', 'plain'";
|
|
46
|
+
/** `COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE` (the `XDF_*` whitespace bits are xdiff's) */
|
|
47
|
+
export declare const COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE: number;
|
|
48
|
+
/**
|
|
49
|
+
* `parse_color_moved_ws`: the comma-separated modes as flags, with git's `error:` lines
|
|
50
|
+
* for the modes it refuses (the flags are not to be used then)
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseColorMovedWs(arg: string): {
|
|
53
|
+
flags: number;
|
|
54
|
+
errors: string[];
|
|
55
|
+
};
|
|
56
|
+
/** `WSEH_NEW`: whitespace errors highlighted on `+` lines */
|
|
57
|
+
export declare const WSEH_NEW: number;
|
|
58
|
+
/** `WSEH_CONTEXT`: on context lines */
|
|
59
|
+
export declare const WSEH_CONTEXT: number;
|
|
60
|
+
/** `WSEH_OLD`: on `-` lines */
|
|
61
|
+
export declare const WSEH_OLD: number;
|
|
62
|
+
/**
|
|
63
|
+
* `parse_ws_error_highlight`: `none`, `default`, `all`, `new`, `old`, `context`, comma
|
|
64
|
+
* separated; undefined for anything else
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseWsErrorHighlight(arg: string): number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* {@link parseWsErrorHighlight}, or for a value git refuses the text before the token it
|
|
69
|
+
* stopped at (what its error message quotes)
|
|
70
|
+
*/
|
|
71
|
+
export declare function wsErrorHighlightOf(arg: string): number | {
|
|
72
|
+
badPrefix: string;
|
|
73
|
+
};
|
|
74
|
+
/** What the colored writer needs besides the palette */
|
|
75
|
+
export interface ColoredLineOptions {
|
|
76
|
+
colors: DiffColors;
|
|
77
|
+
/** `--ws-error-highlight` (`WSEH_*` bits, default {@link WSEH_NEW}) */
|
|
78
|
+
wsErrorHighlight: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The output of one diff's patches while moved lines are looked for: what the writers push
|
|
82
|
+
* is kept, `+` and `-` lines apart ({@link MovedLineBuffer.content}), until
|
|
83
|
+
* {@link MovedLineBuffer.flushTo} marks the moved lines and prints everything.
|
|
84
|
+
*/
|
|
85
|
+
export declare class MovedLineBuffer extends ByteSink {
|
|
86
|
+
private readonly mode;
|
|
87
|
+
/** `--color-moved-ws` flags */
|
|
88
|
+
private readonly wsFlags;
|
|
89
|
+
private readonly symbols;
|
|
90
|
+
private buffered;
|
|
91
|
+
constructor(mode: Exclude<ColorMovedMode, "no">,
|
|
92
|
+
/** `--color-moved-ws` flags */
|
|
93
|
+
wsFlags: number);
|
|
94
|
+
push(bytes: Uint8Array): void;
|
|
95
|
+
get length(): number;
|
|
96
|
+
bytes(): Uint8Array;
|
|
97
|
+
/** A `+` or `-` line (the line without its sign, LF included) and its flags */
|
|
98
|
+
content(kind: "+" | "-", line: Uint8Array, flags: number): void;
|
|
99
|
+
/** diff_flush_patch_all_file_pairs' end: marks the moved lines and prints everything */
|
|
100
|
+
flushTo(sink: ByteSink, o: ColoredLineOptions): void;
|
|
101
|
+
}
|
|
102
|
+
/** A text line of a hunk as {@link writeColoredHunks} gets it */
|
|
103
|
+
export interface ColoredHunkLine {
|
|
104
|
+
kind: " " | "-" | "+";
|
|
105
|
+
/** The line without its sign; an incomplete last line without LF */
|
|
106
|
+
bytes: Uint8Array;
|
|
107
|
+
}
|
|
108
|
+
/** A hunk: its header (as git prints it, LF included) and lines */
|
|
109
|
+
export interface ColoredHunk {
|
|
110
|
+
header: Uint8Array;
|
|
111
|
+
oldStart: number;
|
|
112
|
+
newStart: number;
|
|
113
|
+
lines: ColoredHunkLine[];
|
|
114
|
+
}
|
|
115
|
+
/** What {@link writeColoredHunks} knows of the pair */
|
|
116
|
+
export interface ColoredPatchContext extends ColoredLineOptions {
|
|
117
|
+
/** The whitespace rule of the path (`whitespace_rule`) */
|
|
118
|
+
wsRule: number;
|
|
119
|
+
/** The two sides' contents, for `blank-at-eof` (`check_blank_at_eof`) */
|
|
120
|
+
oldContent: Uint8Array;
|
|
121
|
+
newContent: Uint8Array;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The hunks of a text pair as diff.c's `fn_out_consume` prints them in color: the header
|
|
125
|
+
* in `frag` (`func` for its function line), each line in its color with its whitespace
|
|
126
|
+
* errors marked; into a {@link MovedLineBuffer}, the `+` and `-` lines are kept for move
|
|
127
|
+
* detection.
|
|
128
|
+
*/
|
|
129
|
+
export declare function writeColoredHunks(sink: ByteSink, hunks: readonly ColoredHunk[], ctx: ColoredPatchContext): void;
|
|
130
|
+
/**
|
|
131
|
+
* diff.c's `emit_hunk_header` in color: the `@@ ... @@` part in `frag`, the function line in
|
|
132
|
+
* `func` (the header as xdiff made it, LF included)
|
|
133
|
+
*/
|
|
134
|
+
export declare function coloredHunkHeader(line: Uint8Array, c: DiffColors): Uint8Array;
|
|
135
|
+
//# sourceMappingURL=diff-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-color.d.ts","sourceRoot":"","sources":["../../src/results/diff-color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAoD,MAAM,wBAAwB,CAAC;AAapG,uFAAuF;AACvF,eAAO,MAAM,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nB;AAED,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,GAAG,EAAE,mBAAmB,GACvB,IAAI,CA4FN;AAwDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAE7E"}
|
|
@@ -22,9 +22,15 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { type Blobs } from "@statewalker/vcs-core";
|
|
24
24
|
import { ByteSink, type FindFunction, type UnifiedDiffOptions, type UnifiedDiffResult, type XdiffAlgorithm } from "@statewalker/vcs-utils";
|
|
25
|
+
import { type DiffColors } from "./diff-color.js";
|
|
25
26
|
/** One side of a file pair */
|
|
26
27
|
export interface DiffSideSpec {
|
|
27
28
|
path: string;
|
|
29
|
+
/**
|
|
30
|
+
* The path attributes (the diff driver, textconv) are looked up by, when {@link path} is
|
|
31
|
+
* shown shortened (`--relative` strips its prefix from the names, not from attributes)
|
|
32
|
+
*/
|
|
33
|
+
attrPath?: string;
|
|
28
34
|
/** git file mode, e.g. `0o100644` */
|
|
29
35
|
mode: number;
|
|
30
36
|
/** Object id of the content (a worktree file: the id of its cleaned content) */
|
|
@@ -80,6 +86,8 @@ export interface DiffDriver {
|
|
|
80
86
|
findFunction?: FindFunction;
|
|
81
87
|
/** `diff.<name>.algorithm` */
|
|
82
88
|
algorithm?: XdiffAlgorithm;
|
|
89
|
+
/** `diff.<name>.wordRegex`, or the builtin driver's word regex (extended POSIX) */
|
|
90
|
+
wordRegex?: Uint8Array;
|
|
83
91
|
/** The driver's name (`diff=<name>`) */
|
|
84
92
|
name?: string;
|
|
85
93
|
/** `diff.<name>.textconv`: the command git would run to turn the content into text */
|
|
@@ -132,12 +140,86 @@ export interface DiffOutputOptions extends Omit<UnifiedDiffOptions, "findFunctio
|
|
|
132
140
|
dstPrefix?: string;
|
|
133
141
|
/** The diff driver of a path (from its `diff` attribute), if any */
|
|
134
142
|
driver?: (path: string) => Promise<DiffDriver | undefined> | DiffDriver | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* The colors of the patch (`--color`, `color.diff.<slot>`); unset, none are written. Moved
|
|
145
|
+
* lines are colored when the sink is a {@link MovedLineBuffer}.
|
|
146
|
+
*/
|
|
147
|
+
colors?: DiffColors;
|
|
148
|
+
/** `--ws-error-highlight` (`WSEH_*` bits; default {@link WSEH_NEW}), with `colors` */
|
|
149
|
+
wsHighlight?: number;
|
|
150
|
+
/**
|
|
151
|
+
* The whitespace rule of a path (`core.whitespace`, its `whitespace` attribute: git's
|
|
152
|
+
* `whitespace_rule`), whose errors a colored patch marks; default git's
|
|
153
|
+
* `blank-at-eol,space-before-tab,blank-at-eof`
|
|
154
|
+
*/
|
|
155
|
+
whitespaceRule?: (path: string) => Promise<number> | number;
|
|
156
|
+
/**
|
|
157
|
+
* `--word-diff=<mode>` (`--color-words` is `color`, which also turns `--color` on); unset
|
|
158
|
+
* or `none`, the patch shows lines
|
|
159
|
+
*/
|
|
160
|
+
wordDiff?: "plain" | "color" | "porcelain" | "none";
|
|
161
|
+
/**
|
|
162
|
+
* `--word-diff-regex=<regex>` (`--color-words=<regex>`): what a word is, over the drivers'
|
|
163
|
+
* `wordRegex` and `diff.wordRegex` (extended POSIX, `REG_NEWLINE`); without `wordDiff`, it
|
|
164
|
+
* asks for the plain word diff
|
|
165
|
+
*/
|
|
166
|
+
wordDiffRegex?: string;
|
|
167
|
+
/** `diff.wordRegex`: the word regex of a pair whose drivers give none */
|
|
168
|
+
defaultWordRegex?: string;
|
|
135
169
|
}
|
|
170
|
+
/** @internal git diff's `big_file_threshold` default (512 MiB) */
|
|
171
|
+
export declare const GIT_DIFF_BIG_FILE_THRESHOLD: number;
|
|
136
172
|
/**
|
|
137
173
|
* The driver of a `diff` attribute value (git's `userdiff_find_by_path`): set means text,
|
|
138
174
|
* unset means binary, a name means `diff.<name>.*` from `config` or a builtin driver.
|
|
139
175
|
*/
|
|
140
|
-
export declare function diffDriverOf(attribute: true | false | string | undefined | null, config?: (key: string) => string | undefined
|
|
176
|
+
export declare function diffDriverOf(attribute: true | false | string | undefined | null, config?: (key: string) => string | undefined,
|
|
177
|
+
/** The builtin drivers of that git version (2.43 lacks `ini`, `r`, `swift`, ...) */
|
|
178
|
+
compatibility?: "2.43" | "2.56"): DiffDriver | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* A side as the diff reads it: its content and binary state, read once
|
|
181
|
+
*
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
export declare class LoadedSide {
|
|
185
|
+
readonly spec: DiffSideSpec | undefined;
|
|
186
|
+
readonly driver: DiffDriver | undefined;
|
|
187
|
+
/** The other side's id: an absent side's null id is as long (64 zeros in SHA-256) */
|
|
188
|
+
private readonly otherId?;
|
|
189
|
+
private content?;
|
|
190
|
+
private probed?;
|
|
191
|
+
constructor(spec: DiffSideSpec | undefined, driver: DiffDriver | undefined,
|
|
192
|
+
/** The other side's id: an absent side's null id is as long (64 zeros in SHA-256) */
|
|
193
|
+
otherId?: string | undefined);
|
|
194
|
+
get valid(): boolean;
|
|
195
|
+
get mode(): number;
|
|
196
|
+
get id(): string;
|
|
197
|
+
read(): Promise<Uint8Array>;
|
|
198
|
+
/** The bytes textconv converts ({@link DiffSideSpec.readTextconvInput}) */
|
|
199
|
+
textconvInput(): Promise<Uint8Array>;
|
|
200
|
+
/** `diff_filespec_is_binary` */
|
|
201
|
+
isBinary(threshold: number): Promise<boolean>;
|
|
202
|
+
probe(threshold: number): Promise<{
|
|
203
|
+
size: number;
|
|
204
|
+
binary: boolean;
|
|
205
|
+
}>;
|
|
206
|
+
size(threshold: number): Promise<number>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The driver a side's content is read with (`diff_filespec_load_driver`): a regular file's;
|
|
210
|
+
* an absent side, a symbolic link and a submodule take the default driver
|
|
211
|
+
*
|
|
212
|
+
* @internal
|
|
213
|
+
*/
|
|
214
|
+
export declare function contentDriver(spec: DiffSideSpec | undefined, driver: DiffDriver | undefined): DiffDriver | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* The full path of a pair's side for attributes; the other side's for an absent one
|
|
217
|
+
*
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
export declare function attrPathOf(side: DiffSideSpec | undefined, other: DiffSideSpec | undefined, fallback: string): string;
|
|
221
|
+
/** @internal The diff driver of a path, from {@link DiffOutputOptions.driver} */
|
|
222
|
+
export declare function driverOf(options: DiffOutputOptions, path: string | undefined): Promise<DiffDriver | undefined>;
|
|
141
223
|
/**
|
|
142
224
|
* The patch of the pairs, as `git diff` prints it.
|
|
143
225
|
*/
|
|
@@ -185,6 +267,8 @@ export interface DiffstatOptions {
|
|
|
185
267
|
count?: number;
|
|
186
268
|
/** `core.quotePath` (default true) */
|
|
187
269
|
quotePath?: boolean;
|
|
270
|
+
/** The colors of `--color` (the `+` run in `new`, the `-` run in `old`) */
|
|
271
|
+
colors?: DiffColors;
|
|
188
272
|
}
|
|
189
273
|
/** git's `pprint_rename`: `a/{b => c}/d` */
|
|
190
274
|
export declare function pprintRename(a: string, b: string, quote?: boolean): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-output.d.ts","sourceRoot":"","sources":["../../src/results/diff-output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;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ps a pair whose two sides hold the string a different number
|
|
4
|
+
* of times, `-G<regex>` a pair whose added or removed lines match the regex, `--find-object`
|
|
5
|
+
* a pair with that object on either side.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const pickaxe = DiffPickaxe.compile({ string: "frotz" });
|
|
10
|
+
* const kept = await pickaxe.filter(pairs, (p) => p, outputOptions);
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Both sides are read as the patch reads them: through the path's textconv when one applies,
|
|
14
|
+
* and `-G` passes over binary pairs unless `--text` is given (or textconv makes them text),
|
|
15
|
+
* as git does. `-S` counts non-overlapping occurrences, ASCII case folded under `-i`;
|
|
16
|
+
* `--pickaxe-regex` and `-G` compile POSIX extended regexes with `REG_NEWLINE` (and
|
|
17
|
+
* `REG_ICASE` under `-i`), so no JavaScript `RegExp` ever runs a user's pattern. `-G`
|
|
18
|
+
* diffs the two texts with xdiff's defaults (Myers, no indent heuristic, no whitespace
|
|
19
|
+
* options), whatever the patch shown uses.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import { type DiffFilePair, type DiffOutputOptions } from "./diff-output.js";
|
|
24
|
+
/** What a pickaxe looks for (one kind of `-S`, `-G`, `--find-object`) */
|
|
25
|
+
export interface PickaxeSpec {
|
|
26
|
+
/** `-S<string>`: pairs whose sides hold it a different number of times */
|
|
27
|
+
string?: string;
|
|
28
|
+
/** `-G<regex>`: pairs whose added or removed lines match it */
|
|
29
|
+
grep?: string;
|
|
30
|
+
/** `--find-object=<id>`: pairs with one of these objects on either side */
|
|
31
|
+
objects?: ReadonlySet<string>;
|
|
32
|
+
/** `--pickaxe-regex`: `-S` takes a POSIX extended regex */
|
|
33
|
+
regex?: boolean;
|
|
34
|
+
/** `--pickaxe-all`: a match keeps the whole queue, none empties it */
|
|
35
|
+
all?: boolean;
|
|
36
|
+
/** `-i` / `--regexp-ignore-case` */
|
|
37
|
+
ignoreCase?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** The compiled pickaxe of a diff (git's `diffcore_pickaxe`) */
|
|
40
|
+
export declare class DiffPickaxe {
|
|
41
|
+
private readonly spec;
|
|
42
|
+
/** `-G`, `--pickaxe-regex`, or `-S -i` of a non-ASCII string */
|
|
43
|
+
private readonly regex;
|
|
44
|
+
/** `-S`'s string, lowercased under `-i` (kwset) */
|
|
45
|
+
private readonly needle;
|
|
46
|
+
private constructor();
|
|
47
|
+
/**
|
|
48
|
+
* Compiles a pickaxe as diffcore_pickaxe does; an invalid regex throws git's `fatal:
|
|
49
|
+
* invalid regex: <glibc's message>` (exit 128).
|
|
50
|
+
*/
|
|
51
|
+
static compile(spec: PickaxeSpec): DiffPickaxe;
|
|
52
|
+
/** Whether the pickaxe reads the blobs of the pairs (`-S`, `-G`; not `--find-object`) */
|
|
53
|
+
get readsContent(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The queue the pickaxe leaves (git's `pickaxe`): the items whose pair matches, or, under
|
|
56
|
+
* `--pickaxe-all`, every item when one matches and none otherwise. An item without a pair
|
|
57
|
+
* (an unmerged path) never matches.
|
|
58
|
+
*/
|
|
59
|
+
filter<T>(queue: readonly T[], pairOf: (item: T) => DiffFilePair | undefined, options: DiffOutputOptions): Promise<T[]>;
|
|
60
|
+
/** pickaxe_match: whether one pair matches */
|
|
61
|
+
matches(pair: DiffFilePair, options: DiffOutputOptions): Promise<boolean>;
|
|
62
|
+
/** diff_grep: whether an added or removed line of the xdiff of `a` and `b` matches */
|
|
63
|
+
private diffGrep;
|
|
64
|
+
/** contains(): the occurrences in `data`, up to `limit` (0: all) */
|
|
65
|
+
private contains;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=diff-pickaxe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-pickaxe.d.ts","sourceRoot":"","sources":["../../src/results/diff-pickaxe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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|
|
|
1
|
+
/**
|
|
2
|
+
* git's word diff (diff.c's `diff_words_*` and `fn_out_diff_words_*`): `--word-diff=plain`,
|
|
3
|
+
* `--word-diff=color` (`--color-words`) and `--word-diff=porcelain`, byte for byte as git
|
|
4
|
+
* prints the hunks of a text pair.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const words = compileWordRegex("[a-z]+");
|
|
9
|
+
* writeWordDiffHunks(sink, hunks, { mode: "plain", regex: words });
|
|
10
|
+
* // "@@ -1 +1 @@\nh(4),{+hh+}[44]\n"
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* The removed and added lines between two context lines are gathered, split into words
|
|
14
|
+
* (each match of the word regex, cut at a newline; without one, each run of non-spaces),
|
|
15
|
+
* and the two word lists are diffed as lines (xdiff with no context, the common tail
|
|
16
|
+
* trimmed). The added side's text is printed with the removed words before the added ones
|
|
17
|
+
* that replace them: `[-old-]{+new+}` in plain mode, the `old` and `new` colors in color
|
|
18
|
+
* mode, one `-`/`+`/` ` line per piece with `~` for each newline in porcelain mode. Context
|
|
19
|
+
* lines are printed without their sign (porcelain: with it, followed by `~`).
|
|
20
|
+
*
|
|
21
|
+
* Not reproduced: under `log --graph` git writes the graph's line prefix in word mode only
|
|
22
|
+
* where a word hunk starts on a new line or a piece's text has a newline, so porcelain lines
|
|
23
|
+
* (and some plain or color lines) go without it; `git log` prefixes every line of ours.
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
import { type ByteSink, type PosixRegex } from "@statewalker/vcs-utils";
|
|
28
|
+
import { type ColoredHunk, type DiffColors } from "./diff-color.js";
|
|
29
|
+
/** `--word-diff=<mode>` (`--color-words` is `color`) */
|
|
30
|
+
export type WordDiffMode = "plain" | "color" | "porcelain";
|
|
31
|
+
/** The modes `--word-diff=` takes (`none` turns the word diff off) */
|
|
32
|
+
export declare const WORD_DIFF_MODES: readonly ["plain", "color", "porcelain", "none"];
|
|
33
|
+
/** What {@link writeWordDiffHunks} prints with */
|
|
34
|
+
export interface WordDiffOptions {
|
|
35
|
+
mode: WordDiffMode;
|
|
36
|
+
/** The word regex (`--word-diff-regex`, the driver's, `diff.wordRegex`); unset, non-spaces */
|
|
37
|
+
regex?: PosixRegex;
|
|
38
|
+
/** The palette of `--color`; unset, no colors */
|
|
39
|
+
colors?: DiffColors;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The word regex as `init_diff_words_data` compiles it (`REG_EXTENDED | REG_NEWLINE`).
|
|
43
|
+
*
|
|
44
|
+
* @throws GitApiError git's `fatal: invalid regular expression: <regex>` (exit 128)
|
|
45
|
+
*/
|
|
46
|
+
export declare function compileWordRegex(pattern: string | Uint8Array): PosixRegex;
|
|
47
|
+
/**
|
|
48
|
+
* The hunks of a text pair as diff.c's `fn_out_consume` prints them under `--word-diff`:
|
|
49
|
+
* each header as usual (in color, `frag` and `func`), the removed and added lines between
|
|
50
|
+
* two context lines as their word diff, context lines without their sign (porcelain mode:
|
|
51
|
+
* with it, then `~`). An incomplete last line counts as ending in a newline; git's
|
|
52
|
+
* "" is not printed.
|
|
53
|
+
*/
|
|
54
|
+
export declare function writeWordDiffHunks(sink: ByteSink, hunks: readonly ColoredHunk[], options: WordDiffOptions): void;
|
|
55
|
+
//# sourceMappingURL=diff-words.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-words.d.ts","sourceRoot":"","sources":["../../src/results/diff-words.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,KAAK,WAAW,EAAqB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEvF,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;AAE3D,sEAAsE;AACtE,eAAO,MAAM,eAAe,YAAI,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,CAAU,CAAC;AAEhF,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,CAAC;IACnB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,iDAAiD;IACjD,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AA+DD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAezE;AAqND;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,EAAE,eAAe,GACvB,IAAI,CA6BN"}
|
package/dist/results/index.d.ts
CHANGED
|
@@ -2,10 +2,14 @@ export * from "./blame-format.js";
|
|
|
2
2
|
export * from "./cherry-pick-result.js";
|
|
3
3
|
export * from "./clone-result.js";
|
|
4
4
|
export * from "./combined-diff.js";
|
|
5
|
+
export * from "./diff-check.js";
|
|
6
|
+
export * from "./diff-color.js";
|
|
5
7
|
export * from "./diff-entry.js";
|
|
6
8
|
export * from "./diff-formatter.js";
|
|
7
9
|
export * from "./diff-order.js";
|
|
8
10
|
export * from "./diff-output.js";
|
|
11
|
+
export * from "./diff-pickaxe.js";
|
|
12
|
+
export * from "./diff-words.js";
|
|
9
13
|
export * from "./fetch-result.js";
|
|
10
14
|
export * from "./init-result.js";
|
|
11
15
|
export * from "./merge-result.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/results/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/results/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|