@gitkraken/core-gitlens 0.45.0 → 0.47.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.
Files changed (261) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/dist/git/models/remote.js +2 -2
  3. package/dist/git/models/remote.js.map +1 -1
  4. package/dist/git/remotes/matcher.js +25 -3
  5. package/dist/git/remotes/matcher.js.map +1 -1
  6. package/dist/git/utils/branchLanded.utils.d.ts +7 -0
  7. package/dist/git/utils/branchLanded.utils.js +10 -1
  8. package/dist/git/utils/branchLanded.utils.js.map +1 -1
  9. package/dist/git/utils/remote.utils.d.ts +1 -0
  10. package/dist/git/utils/remote.utils.js +14 -5
  11. package/dist/git/utils/remote.utils.js.map +1 -1
  12. package/dist/git-cli/parsers/logParser.js +227 -468
  13. package/dist/git-cli/parsers/logParser.js.map +1 -1
  14. package/dist/git-cli/parsers/refParser.js +4 -4
  15. package/dist/git-cli/parsers/refParser.js.map +1 -1
  16. package/dist/git-cli/providers/branches.d.ts +5 -0
  17. package/dist/git-cli/providers/branches.js +25 -21
  18. package/dist/git-cli/providers/branches.js.map +1 -1
  19. package/dist/git-cli/providers/config.js +2 -2
  20. package/dist/git-cli/providers/pausedOperations.js +2 -2
  21. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  22. package/dist/git-cli/providers/staging.js +1 -1
  23. package/dist/ipc/discovery.js +1 -1
  24. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  25. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  26. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  27. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.d.ts +31 -0
  28. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js +166 -0
  29. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js.map +1 -0
  30. package/dist/plus/git-github/api/github.d.ts +13 -5
  31. package/dist/plus/git-github/api/github.js +53 -13
  32. package/dist/plus/git-github/api/github.js.map +1 -1
  33. package/dist/plus/git-github/api/issueWrites.d.ts +7 -1
  34. package/dist/plus/git-github/api/issueWrites.js +62 -32
  35. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  36. package/dist/plus/git-github/api/pullRequestWrites.d.ts +7 -3
  37. package/dist/plus/git-github/api/pullRequestWrites.js +120 -67
  38. package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -1
  39. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
  40. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
  41. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
  42. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
  43. package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
  44. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  45. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
  46. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
  47. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
  48. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
  49. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  50. package/dist/plus/integrations/authentication/models.d.ts +0 -1
  51. package/dist/plus/integrations/authentication/models.js +1 -2
  52. package/dist/plus/integrations/authentication/models.js.map +1 -1
  53. package/dist/plus/integrations/constants.d.ts +0 -10
  54. package/dist/plus/integrations/constants.js +1 -95
  55. package/dist/plus/integrations/constants.js.map +1 -1
  56. package/dist/plus/integrations/context.d.ts +17 -17
  57. package/dist/plus/integrations/index.d.ts +44 -25
  58. package/dist/plus/integrations/index.js +41 -8
  59. package/dist/plus/integrations/index.js.map +1 -1
  60. package/dist/plus/integrations/integrationService.d.ts +24 -24
  61. package/dist/plus/integrations/integrationService.js +125 -34
  62. package/dist/plus/integrations/integrationService.js.map +1 -1
  63. package/dist/plus/integrations/lite.js +1 -1
  64. package/dist/plus/integrations/lite.js.map +1 -1
  65. package/dist/plus/integrations/manager.d.ts +81 -21
  66. package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
  67. package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
  68. package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
  69. package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
  70. package/dist/plus/integrations/models/gitHostIntegration.js +22 -8
  71. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  72. package/dist/plus/integrations/models/integration.d.ts +11 -175
  73. package/dist/plus/integrations/models/integration.js +22 -76
  74. package/dist/plus/integrations/models/integration.js.map +1 -1
  75. package/dist/plus/integrations/models/issueTrackerWrites.d.ts +128 -0
  76. package/dist/plus/integrations/models/issueTrackerWrites.js +0 -0
  77. package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
  78. package/dist/plus/integrations/models/issuesIntegration.js +5 -3
  79. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  80. package/dist/plus/integrations/models/publicIntegration.d.ts +257 -0
  81. package/dist/plus/integrations/models/publicIntegration.js +21 -0
  82. package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
  83. package/dist/plus/integrations/providerFilters.d.ts +58 -0
  84. package/dist/plus/integrations/providerFilters.js.map +1 -1
  85. package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
  86. package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
  87. package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
  88. package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
  89. package/dist/plus/integrations/providers/apiClients.js.map +1 -1
  90. package/dist/plus/integrations/providers/asana.d.ts +3 -2
  91. package/dist/plus/integrations/providers/asana.js +2 -1
  92. package/dist/plus/integrations/providers/asana.js.map +1 -1
  93. package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
  94. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  95. package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
  96. package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
  97. package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
  98. package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
  99. package/dist/plus/integrations/providers/azure/models.js +1 -1
  100. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  101. package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
  102. package/dist/plus/integrations/providers/azureDevOps.js +2 -1
  103. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  104. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
  105. package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
  106. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  107. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
  108. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  109. package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
  110. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  111. package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
  112. package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
  113. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  114. package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
  115. package/dist/plus/integrations/providers/bitbucket.js +2 -1
  116. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  117. package/dist/plus/integrations/providers/github/github.d.ts +0 -1
  118. package/dist/plus/integrations/providers/github/github.js +1 -1
  119. package/dist/plus/integrations/providers/github/github.js.map +1 -1
  120. package/dist/plus/integrations/providers/github.d.ts +29 -11
  121. package/dist/plus/integrations/providers/github.js +195 -78
  122. package/dist/plus/integrations/providers/github.js.map +1 -1
  123. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
  124. package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
  125. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  126. package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
  127. package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
  128. package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
  129. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  130. package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
  131. package/dist/plus/integrations/providers/gitlab.js +2 -1
  132. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  133. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  134. package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
  135. package/dist/plus/integrations/providers/jira-server.js +3 -2
  136. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  137. package/dist/plus/integrations/providers/jira.d.ts +3 -3
  138. package/dist/plus/integrations/providers/jira.js +4 -3
  139. package/dist/plus/integrations/providers/jira.js.map +1 -1
  140. package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -1
  141. package/dist/plus/integrations/providers/jiraIssueByKey.js +1 -1
  142. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  143. package/dist/plus/integrations/providers/jiraIssueWriteErrors.d.ts +10 -0
  144. package/dist/plus/integrations/providers/jiraIssueWriteErrors.js +68 -0
  145. package/dist/plus/integrations/providers/jiraIssueWriteErrors.js.map +1 -0
  146. package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +40 -0
  147. package/dist/plus/integrations/providers/jiraIssueWrites.js +397 -0
  148. package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -0
  149. package/dist/plus/integrations/providers/linear.d.ts +4 -3
  150. package/dist/plus/integrations/providers/linear.js +3 -2
  151. package/dist/plus/integrations/providers/linear.js.map +1 -1
  152. package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
  153. package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
  154. package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
  155. package/dist/plus/integrations/providers/metadata.d.ts +136 -0
  156. package/dist/plus/integrations/providers/metadata.js +513 -0
  157. package/dist/plus/integrations/providers/metadata.js.map +1 -0
  158. package/dist/plus/integrations/providers/models.d.ts +10 -206
  159. package/dist/plus/integrations/providers/models.js +8 -539
  160. package/dist/plus/integrations/providers/models.js.map +1 -1
  161. package/dist/plus/integrations/providers/providersApi.d.ts +7 -3
  162. package/dist/plus/integrations/providers/providersApi.js +23 -11
  163. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  164. package/dist/plus/integrations/providers/trello.d.ts +1 -1
  165. package/dist/plus/integrations/providers/trello.js +2 -1
  166. package/dist/plus/integrations/providers/trello.js.map +1 -1
  167. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
  168. package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
  169. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  170. package/dist/plus/integrations/providers/utils.d.ts +119 -10
  171. package/dist/plus/integrations/providers/utils.js +57 -3
  172. package/dist/plus/integrations/providers/utils.js.map +1 -1
  173. package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
  174. package/dist/plus/integrations/reads/autolinks.js +1 -1
  175. package/dist/plus/integrations/reads/autolinks.js.map +1 -1
  176. package/dist/plus/integrations/reads/broaden.d.ts +1 -1
  177. package/dist/plus/integrations/reads/broaden.js +3 -2
  178. package/dist/plus/integrations/reads/broaden.js.map +1 -1
  179. package/dist/plus/integrations/reads/context.d.ts +1 -1
  180. package/dist/plus/integrations/reads/counts.d.ts +1 -88
  181. package/dist/plus/integrations/reads/counts.js +4 -2
  182. package/dist/plus/integrations/reads/counts.js.map +1 -1
  183. package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
  184. package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
  185. package/dist/plus/integrations/reads/drains.d.ts +4 -3
  186. package/dist/plus/integrations/reads/drains.js +1 -1
  187. package/dist/plus/integrations/reads/drains.js.map +1 -1
  188. package/dist/plus/integrations/reads/etag.d.ts +174 -3
  189. package/dist/plus/integrations/reads/etag.js +69 -14
  190. package/dist/plus/integrations/reads/etag.js.map +1 -1
  191. package/dist/plus/integrations/reads/filters.d.ts +3 -61
  192. package/dist/plus/integrations/reads/filters.js +1 -1
  193. package/dist/plus/integrations/reads/filters.js.map +1 -1
  194. package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
  195. package/dist/plus/integrations/reads/hierarchy.js +4 -2
  196. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  197. package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
  198. package/dist/plus/integrations/reads/issueBatch.js +3 -4
  199. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  200. package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
  201. package/dist/plus/integrations/reads/issueTracker.js +4 -3
  202. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  203. package/dist/plus/integrations/reads/issues.d.ts +1 -1
  204. package/dist/plus/integrations/reads/issues.js +4 -2
  205. package/dist/plus/integrations/reads/issues.js.map +1 -1
  206. package/dist/plus/integrations/reads/paging.d.ts +1 -1
  207. package/dist/plus/integrations/reads/paging.js +1 -1
  208. package/dist/plus/integrations/reads/paging.js.map +1 -1
  209. package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
  210. package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
  211. package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
  212. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
  213. package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
  214. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  215. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
  216. package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
  217. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  218. package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
  219. package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
  220. package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
  221. package/dist/plus/integrations/reads/pullRequests.js +4 -2
  222. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  223. package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
  224. package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
  225. package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
  226. package/dist/plus/integrations/reads/resolveRepository.js +10 -5
  227. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  228. package/dist/plus/integrations/reads/searchIssues.js +2 -1
  229. package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
  230. package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
  231. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  232. package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
  233. package/dist/plus/integrations/reads/sweeps.js +3 -2
  234. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  235. package/dist/plus/integrations/reads/warnings.d.ts +1 -1
  236. package/dist/plus/integrations/reads/warnings.js +1 -1
  237. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  238. package/dist/plus/integrations/results.d.ts +324 -2
  239. package/dist/plus/integrations/results.js.map +1 -1
  240. package/dist/plus/integrations/telemetry.d.ts +0 -10
  241. package/dist/plus/integrations/telemetry.js +0 -11
  242. package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
  243. package/dist/plus/integrations/utils/domain.utils.js +10 -2
  244. package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
  245. package/dist/plus/integrations/utils/integration.utils.d.ts +2 -6
  246. package/dist/plus/integrations/utils/integration.utils.js +8 -9
  247. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  248. package/dist/utils/env/node/exec.js +2 -2
  249. package/dist/utils/keys/chord.d.ts +13 -2
  250. package/dist/utils/keys/chord.js +76 -17
  251. package/dist/utils/keys/chord.js.map +1 -1
  252. package/dist/utils/keys/keybinding.d.ts +12 -0
  253. package/dist/utils/keys/keybinding.js +52 -2
  254. package/dist/utils/keys/keybinding.js.map +1 -1
  255. package/dist/utils/markdown.d.ts +21 -0
  256. package/dist/utils/markdown.js +33 -1
  257. package/dist/utils/markdown.js.map +1 -1
  258. package/docs/integrations.md +174 -19
  259. package/package.json +5 -1
  260. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
  261. package/dist/plus/integrations/telemetry.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { flattenString, iterateAsyncByDelimiter, iterateByDelimiter, unquoteCString } from "../../utils/string.js";
1
+ import { flattenString, iterateByDelimiter, unquoteCString } from "../../utils/string.js";
2
2
  import { joinPaths, normalizePath } from "../../utils/path.js";
3
3
  import { maybeStopWatch } from "../../utils/stopwatch.js";
4
4
  import _usingCtx from "../../_virtual/@oxc-project+runtime/helpers/esm/usingCtx.js";
@@ -159,35 +159,95 @@ function getStashFilesOnlyLogParser() {
159
159
  _stashFilesOnlyParser ??= createLogParserWithFilesAndStats();
160
160
  return _stashFilesOnlyParser;
161
161
  }
162
- const recordSep = "";
163
- const recordFormatSep = "%x1E";
164
- const fieldSep = "";
165
- const fieldFormatSep = "%x1D";
166
- function appendAll(target, items) {
167
- for (const item of items) target.push(item);
162
+ const recordSep = "\0";
163
+ const recordFormatSep = "%x00%x1E";
164
+ const fieldSep = "\0";
165
+ const fieldFormatSep = "%x00%x1D";
166
+ function indexOfSeparator(s, separator, from) {
167
+ const marker = separator[1];
168
+ let index = s.indexOf(marker, from + 1);
169
+ while (index !== -1 && s.charCodeAt(index - 1) !== 0) index = s.indexOf(marker, index + 1);
170
+ return index === -1 ? -1 : index - 1;
168
171
  }
169
- function isCompleteRecord(record, requiredFields) {
170
- let count = 0;
171
- let index = -1;
172
- while (count < requiredFields) {
173
- index = record.indexOf(fieldSep, index + 1);
174
- if (index === -1) return false;
175
- count++;
172
+ const flattenSourceThreshold = 131072;
173
+ function readFields(record, keys, entry) {
174
+ let start = 0;
175
+ for (const key of keys) {
176
+ const end = indexOfSeparator(record, fieldSep, start);
177
+ if (end === -1) return -1;
178
+ entry[key] = record.substring(start, end);
179
+ start = end + 2;
180
+ }
181
+ return start;
182
+ }
183
+ function getPayload(record, start) {
184
+ if (record.charCodeAt(start) === 10) {
185
+ start++;
186
+ if (record.charCodeAt(start) === 10) start++;
176
187
  }
177
- return true;
188
+ const end = indexOfSeparator(record, fieldSep, start);
189
+ return record.substring(start, end === -1 ? record.length : end);
178
190
  }
179
- function createLogParser(mapping) {
180
- let format = recordFormatSep;
181
- const keys = [];
182
- for (const key in mapping) {
183
- keys.push(key);
184
- format += `${mapping[key]}${fieldFormatSep}`;
191
+ var RecordScanner = class {
192
+ copy;
193
+ pieces = [];
194
+ chunk = "";
195
+ start = 0;
196
+ from = 0;
197
+ constructor(copy = false) {
198
+ this.copy = copy;
199
+ }
200
+ push(chunk) {
201
+ if (this.start < this.chunk.length) this.pieces.push(this.start === 0 ? this.chunk : this.chunk.substring(this.start));
202
+ this.chunk = chunk;
203
+ this.start = 0;
204
+ this.from = 0;
205
+ }
206
+ next() {
207
+ if (this.from === 0 && this.pieces.length !== 0 && this.chunk.charCodeAt(0) === recordSep.charCodeAt(1)) {
208
+ const last = this.pieces.length - 1;
209
+ const piece = this.pieces[last];
210
+ if (piece.charCodeAt(piece.length - 1) === 0) {
211
+ if (piece.length === 1) this.pieces.pop();
212
+ else this.pieces[last] = piece.substring(0, piece.length - 1);
213
+ this.start = this.from = 1;
214
+ return this.complete("");
215
+ }
216
+ }
217
+ const end = indexOfSeparator(this.chunk, recordSep, this.from);
218
+ if (end === -1) {
219
+ this.from = this.chunk.length;
220
+ return;
221
+ }
222
+ const record = this.complete(this.chunk.substring(this.start, end));
223
+ this.start = this.from = end + 2;
224
+ return record;
225
+ }
226
+ end() {
227
+ const record = this.complete(this.chunk.substring(this.start));
228
+ this.chunk = "";
229
+ this.start = this.from = 0;
230
+ return record;
231
+ }
232
+ complete(text) {
233
+ if (text.length) this.pieces.push(text);
234
+ let record;
235
+ if (this.pieces.length > 1) record = this.pieces.join("");
236
+ else {
237
+ record = this.pieces[0] ?? "";
238
+ if (this.copy) record = flattenString(record, 1);
239
+ }
240
+ this.pieces.length = 0;
241
+ return record;
185
242
  }
186
- const args = [`--format=${format}`];
243
+ };
244
+ function createRecordParsers(scope, parseRecord) {
245
+ const parseScope = `${scope}.parse`;
246
+ const parseAsyncScope = `${scope}.parseAsync`;
187
247
  function* parse(data) {
188
248
  try {
189
249
  var _usingCtx$1 = _usingCtx();
190
- const sw = _usingCtx$1.u(maybeStopWatch("Git.LogParser.parse", { log: {
250
+ const sw = _usingCtx$1.u(maybeStopWatch(parseScope, { log: {
191
251
  onlyExit: true,
192
252
  level: "debug"
193
253
  } }));
@@ -195,26 +255,33 @@ function createLogParser(mapping) {
195
255
  sw?.stop({ suffix: ` no data` });
196
256
  return;
197
257
  }
198
- const records = iterateByDelimiter(data, recordSep);
258
+ const scanner = new RecordScanner(typeof data === "string" && data.length > flattenSourceThreshold);
199
259
  let count = 0;
260
+ let dropped = 0;
200
261
  let entry;
201
- let fields;
202
- for (const record of records) {
203
- if (!record.length) continue;
204
- entry = {};
205
- fields = iterateByDelimiter(record, fieldSep);
206
- let fieldCount = 0;
207
- let field;
208
- while (true) {
209
- field = fields.next();
210
- if (field.done) break;
211
- if (fieldCount >= keys.length) continue;
262
+ for (const chunk of typeof data === "string" ? [data] : data) {
263
+ scanner.push(chunk);
264
+ for (let record = scanner.next(); record != null; record = scanner.next()) {
265
+ if (!record.length) continue;
266
+ entry = parseRecord(record);
267
+ if (entry == null) {
268
+ dropped++;
269
+ continue;
270
+ }
271
+ count++;
272
+ yield entry;
273
+ }
274
+ }
275
+ const tail = scanner.end();
276
+ if (tail.length) {
277
+ entry = parseRecord(tail);
278
+ if (entry == null) dropped++;
279
+ else {
212
280
  count++;
213
- entry[keys[fieldCount++]] = field.value;
281
+ yield entry;
214
282
  }
215
- yield entry;
216
283
  }
217
- sw?.stop({ suffix: ` parsed ${count} records` });
284
+ sw?.stop({ suffix: ` parsed ${count} records${dropped > 0 ? `, dropped ${dropped}` : ""}` });
218
285
  } catch (_) {
219
286
  _usingCtx$1.e = _;
220
287
  } finally {
@@ -224,48 +291,59 @@ function createLogParser(mapping) {
224
291
  async function* parseAsync(stream) {
225
292
  try {
226
293
  var _usingCtx3 = _usingCtx();
227
- const sw = _usingCtx3.u(maybeStopWatch("Git.LogParser.parseAsync", { log: {
294
+ const sw = _usingCtx3.u(maybeStopWatch(parseAsyncScope, { log: {
228
295
  onlyExit: true,
229
296
  level: "debug"
230
297
  } }));
231
- const records = iterateAsyncByDelimiter(stream, recordSep);
298
+ const scanner = new RecordScanner(true);
232
299
  let count = 0;
300
+ let dropped = 0;
233
301
  let entry;
234
- let fields;
235
- for await (const record of records) {
236
- if (!record.length) continue;
237
- if (!isCompleteRecord(record, keys.length)) continue;
238
- entry = {};
239
- fields = iterateByDelimiter(record, fieldSep);
240
- let fieldCount = 0;
241
- let field;
242
- while (true) {
243
- field = fields.next();
244
- if (field.done) break;
245
- if (fieldCount >= keys.length) continue;
302
+ for (let result = await stream.next(); !result.done; result = await stream.next()) {
303
+ scanner.push(result.value);
304
+ for (let record = scanner.next(); record != null; record = scanner.next()) {
305
+ if (!record.length) continue;
306
+ entry = parseRecord(record);
307
+ if (entry == null) {
308
+ dropped++;
309
+ continue;
310
+ }
246
311
  count++;
247
- entry[keys[fieldCount++]] = field.value;
312
+ yield entry;
248
313
  }
249
- yield entry;
250
314
  }
251
- sw?.stop({ suffix: ` parsed ${count} records` });
315
+ const tail = scanner.end();
316
+ if (tail.length) {
317
+ entry = parseRecord(tail);
318
+ if (entry == null) dropped++;
319
+ else {
320
+ count++;
321
+ yield entry;
322
+ }
323
+ }
324
+ sw?.stop({ suffix: ` parsed ${count} records${dropped > 0 ? `, dropped ${dropped}` : ""}` });
252
325
  } catch (_) {
253
326
  _usingCtx3.e = _;
254
327
  } finally {
255
328
  _usingCtx3.d();
256
329
  }
257
330
  }
331
+ return {
332
+ parse,
333
+ parseAsync
334
+ };
335
+ }
336
+ function createLogParser(mapping) {
337
+ let format = recordFormatSep;
338
+ const keys = [];
339
+ for (const key in mapping) {
340
+ keys.push(key);
341
+ format += `${mapping[key]}${fieldFormatSep}`;
342
+ }
343
+ const args = [`--format=${format}`];
258
344
  function parseRecord(record) {
259
- record = flattenString(record);
260
345
  const entry = {};
261
- let start = 0;
262
- for (const key of keys) {
263
- const end = record.indexOf(fieldSep, start);
264
- if (end === -1) break;
265
- entry[key] = record.substring(start, end);
266
- start = end + 1;
267
- }
268
- return entry;
346
+ return readFields(record, keys, entry) === -1 ? void 0 : entry;
269
347
  }
270
348
  async function* parseAsyncBatched(stream) {
271
349
  try {
@@ -274,35 +352,42 @@ function createLogParser(mapping) {
274
352
  onlyExit: true,
275
353
  level: "debug"
276
354
  } }));
355
+ const scanner = new RecordScanner(true);
277
356
  let count = 0;
278
- let buffer = "";
357
+ let dropped = 0;
358
+ let entry;
279
359
  for await (const chunk of stream) {
280
- buffer += chunk;
360
+ scanner.push(chunk);
281
361
  let batch;
282
- let start = 0;
283
- while (true) {
284
- const end = buffer.indexOf(recordSep, start);
285
- if (end === -1) break;
286
- if (end > start) {
287
- (batch ??= []).push(parseRecord(buffer.substring(start, end)));
288
- count++;
362
+ for (let record = scanner.next(); record != null; record = scanner.next()) {
363
+ if (!record.length) continue;
364
+ entry = parseRecord(record);
365
+ if (entry == null) {
366
+ dropped++;
367
+ continue;
289
368
  }
290
- start = end + 1;
369
+ (batch ??= []).push(entry);
370
+ count++;
291
371
  }
292
- if (start > 0) buffer = buffer.substring(start);
293
372
  if (batch != null) yield batch;
294
373
  }
295
- if (buffer.length > 0 && isCompleteRecord(buffer, keys.length)) {
296
- count++;
297
- yield [parseRecord(buffer)];
374
+ const tail = scanner.end();
375
+ if (tail.length) {
376
+ entry = parseRecord(tail);
377
+ if (entry == null) dropped++;
378
+ else {
379
+ count++;
380
+ yield [entry];
381
+ }
298
382
  }
299
- sw?.stop({ suffix: ` parsed ${count} records` });
383
+ sw?.stop({ suffix: ` parsed ${count} records${dropped > 0 ? `, dropped ${dropped}` : ""}` });
300
384
  } catch (_) {
301
385
  _usingCtx4.e = _;
302
386
  } finally {
303
387
  _usingCtx4.d();
304
388
  }
305
389
  }
390
+ const { parse, parseAsync } = createRecordParsers("Git.LogParser", parseRecord);
306
391
  return {
307
392
  arguments: args,
308
393
  separators: {
@@ -406,125 +491,33 @@ function createLogParserWithFilesAndStats(mapping) {
406
491
  }
407
492
  return files;
408
493
  }
409
- function* parse(data) {
410
- try {
411
- var _usingCtx5 = _usingCtx();
412
- const sw = _usingCtx5.u(maybeStopWatch("Git.LogParserWithFilesAndStats.parse", { log: {
413
- onlyExit: true,
414
- level: "debug"
415
- } }));
416
- if (!data) {
417
- sw?.stop({ suffix: ` no data` });
418
- return;
419
- }
420
- const records = iterateByDelimiter(data, recordSep);
421
- let count = 0;
422
- let entry;
423
- let files;
424
- let fields;
425
- for (const record of records) {
426
- if (!record.length) continue;
427
- count++;
428
- entry = {};
429
- files = [];
430
- fields = iterateByDelimiter(record, fieldSep);
431
- let fieldCount = 0;
432
- let field;
433
- while (true) {
434
- field = fields.next();
435
- if (field.done) break;
436
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
437
- else if (fieldCount === keys.length) {
438
- const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
439
- appendAll(files, parseFilesAndStats(summary));
440
- } else debugger;
441
- }
442
- entry.files = files;
443
- if (files.length) {
444
- entry.stats = {
445
- additions: 0,
446
- deletions: 0,
447
- files: {
448
- added: 0,
449
- deleted: 0,
450
- changed: 0
451
- }
452
- };
453
- for (const f of files) if (f.additions || f.deletions) {
454
- entry.stats.additions += f.additions ?? 0;
455
- entry.stats.deletions += f.deletions ?? 0;
456
- if (f.status === "A" || f.status === "?") entry.stats.files.added++;
457
- else if (f.status === "D") entry.stats.files.deleted++;
458
- else entry.stats.files.changed++;
459
- }
460
- }
461
- yield entry;
462
- }
463
- sw?.stop({ suffix: ` parsed ${count} records` });
464
- } catch (_) {
465
- _usingCtx5.e = _;
466
- } finally {
467
- _usingCtx5.d();
468
- }
469
- }
470
- async function* parseAsync(stream) {
471
- try {
472
- var _usingCtx6 = _usingCtx();
473
- const sw = _usingCtx6.u(maybeStopWatch("Git.LogParserWithFilesAndStats.parseAsync", { log: {
474
- onlyExit: true,
475
- level: "debug"
476
- } }));
477
- const records = iterateAsyncByDelimiter(stream, recordSep);
478
- let count = 0;
479
- let entry;
480
- let files;
481
- let fields;
482
- for await (const record of records) {
483
- if (!record.length) continue;
484
- if (!isCompleteRecord(record, keys.length)) continue;
485
- count++;
486
- entry = {};
487
- files = [];
488
- fields = iterateByDelimiter(record, fieldSep);
489
- let fieldCount = 0;
490
- let field;
491
- while (true) {
492
- field = fields.next();
493
- if (field.done) break;
494
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
495
- else if (fieldCount === keys.length) {
496
- const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
497
- appendAll(files, parseFilesAndStats(summary));
498
- } else debugger;
499
- }
500
- entry.files = files;
501
- if (files.length) {
502
- entry.stats = {
503
- additions: 0,
504
- deletions: 0,
505
- files: {
506
- added: 0,
507
- deleted: 0,
508
- changed: 0
509
- }
510
- };
511
- for (const f of files) if (f.additions || f.deletions) {
512
- entry.stats.additions += f.additions ?? 0;
513
- entry.stats.deletions += f.deletions ?? 0;
514
- if (f.status === "A" || f.status === "?") entry.stats.files.added++;
515
- else if (f.status === "D") entry.stats.files.deleted++;
516
- else entry.stats.files.changed++;
517
- }
494
+ function parseRecord(record) {
495
+ const entry = {};
496
+ const payloadStart = readFields(record, keys, entry);
497
+ if (payloadStart === -1) return void 0;
498
+ const files = parseFilesAndStats(getPayload(record, payloadStart));
499
+ entry.files = files;
500
+ if (files.length) {
501
+ entry.stats = {
502
+ additions: 0,
503
+ deletions: 0,
504
+ files: {
505
+ added: 0,
506
+ deleted: 0,
507
+ changed: 0
518
508
  }
519
- yield entry;
509
+ };
510
+ for (const f of files) if (f.additions || f.deletions) {
511
+ entry.stats.additions += f.additions ?? 0;
512
+ entry.stats.deletions += f.deletions ?? 0;
513
+ if (f.status === "A" || f.status === "?") entry.stats.files.added++;
514
+ else if (f.status === "D") entry.stats.files.deleted++;
515
+ else entry.stats.files.changed++;
520
516
  }
521
- sw?.stop({ suffix: ` parsed ${count} records` });
522
- } catch (_) {
523
- _usingCtx6.e = _;
524
- } finally {
525
- _usingCtx6.d();
526
517
  }
518
+ return entry;
527
519
  }
520
+ const { parse, parseAsync } = createRecordParsers("Git.LogParserWithFilesAndStats", parseRecord);
528
521
  return {
529
522
  arguments: args,
530
523
  separators: {
@@ -585,49 +578,14 @@ function createLogParserWithFileSummary(mapping) {
585
578
  }
586
579
  return files;
587
580
  }
588
- function* parse(data) {
589
- try {
590
- var _usingCtx7 = _usingCtx();
591
- const sw = _usingCtx7.u(maybeStopWatch("Git.LogParserWithFileSummary.parse", { log: {
592
- onlyExit: true,
593
- level: "debug"
594
- } }));
595
- if (!data) {
596
- sw?.stop({ suffix: ` no data` });
597
- return;
598
- }
599
- const records = iterateByDelimiter(data, recordSep);
600
- let count = 0;
601
- let entry;
602
- let files;
603
- let fields;
604
- for (const record of records) {
605
- if (!record.length) continue;
606
- count++;
607
- entry = {};
608
- files = [];
609
- fields = iterateByDelimiter(record, fieldSep);
610
- let fieldCount = 0;
611
- let field;
612
- while (true) {
613
- field = fields.next();
614
- if (field.done) break;
615
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
616
- else if (fieldCount === keys.length) {
617
- const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
618
- appendAll(files, parseFileSummary(summary));
619
- } else debugger;
620
- }
621
- entry.files = files;
622
- yield entry;
623
- }
624
- sw?.stop({ suffix: ` parsed ${count} records` });
625
- } catch (_) {
626
- _usingCtx7.e = _;
627
- } finally {
628
- _usingCtx7.d();
629
- }
581
+ function parseRecord(record) {
582
+ const entry = {};
583
+ const payloadStart = readFields(record, keys, entry);
584
+ if (payloadStart === -1) return void 0;
585
+ entry.files = parseFileSummary(getPayload(record, payloadStart));
586
+ return entry;
630
587
  }
588
+ const { parse } = createRecordParsers("Git.LogParserWithFileSummary", parseRecord);
631
589
  return {
632
590
  arguments: args,
633
591
  separators: {
@@ -684,16 +642,16 @@ function createLogParserSingle(field) {
684
642
  const args = ["-z", `--format=${field}`];
685
643
  function parse(data) {
686
644
  try {
687
- var _usingCtx8 = _usingCtx();
688
- _usingCtx8.u(maybeStopWatch("Git.LogParserSingle.parse", { log: {
645
+ var _usingCtx5 = _usingCtx();
646
+ _usingCtx5.u(maybeStopWatch("Git.LogParserSingle.parse", { log: {
689
647
  onlyExit: true,
690
648
  level: "debug"
691
649
  } }));
692
650
  return data ? iterateByDelimiter(data, "\0") : [];
693
651
  } catch (_) {
694
- _usingCtx8.e = _;
652
+ _usingCtx5.e = _;
695
653
  } finally {
696
- _usingCtx8.d();
654
+ _usingCtx5.d();
697
655
  }
698
656
  }
699
657
  return {
@@ -718,10 +676,10 @@ function createLogParserWithPatch(mapping) {
718
676
  let line = lines.next();
719
677
  if (line.done) return void 0;
720
678
  if (!content.startsWith("diff --git ")) return void 0;
721
- const paths = parseDiffFilePaths(content);
679
+ const paths = parseDiffFilePaths(content.endsWith("\n") ? content : content.substring(0, content.lastIndexOf("\n") + 1) || content);
722
680
  if (paths == null) return void 0;
723
681
  while (!line.done && !line.value.startsWith("@@ ")) line = lines.next();
724
- const rangeMatch = line.value.match(diffHunkRegex);
682
+ const rangeMatch = line.done ? void 0 : line.value.match(diffHunkRegex);
725
683
  let range;
726
684
  let originalRange;
727
685
  if (rangeMatch != null) {
@@ -746,83 +704,15 @@ function createLogParserWithPatch(mapping) {
746
704
  originalRange
747
705
  };
748
706
  }
749
- function* parse(data) {
750
- try {
751
- var _usingCtx9 = _usingCtx();
752
- const sw = _usingCtx9.u(maybeStopWatch("Git.LogParserWithPatch.parse", { log: {
753
- onlyExit: true,
754
- level: "debug"
755
- } }));
756
- if (!data) {
757
- sw?.stop({ suffix: ` no data` });
758
- return;
759
- }
760
- const records = iterateByDelimiter(data, recordSep);
761
- let count = 0;
762
- let entry;
763
- let fields;
764
- for (const record of records) {
765
- if (!record.length) continue;
766
- count++;
767
- entry = {};
768
- fields = iterateByDelimiter(record, fieldSep);
769
- let fieldCount = 0;
770
- let field;
771
- while (true) {
772
- field = fields.next();
773
- if (field.done) break;
774
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
775
- else if (fieldCount === keys.length) {
776
- const file = parsePatch(field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value);
777
- entry.files = file != null ? [file] : [];
778
- } else debugger;
779
- }
780
- yield entry;
781
- }
782
- sw?.stop({ suffix: ` parsed ${count} records` });
783
- } catch (_) {
784
- _usingCtx9.e = _;
785
- } finally {
786
- _usingCtx9.d();
787
- }
788
- }
789
- async function* parseAsync(stream) {
790
- try {
791
- var _usingCtx10 = _usingCtx();
792
- const sw = _usingCtx10.u(maybeStopWatch("Git.LogParserWithPatch.parseAsync", { log: {
793
- onlyExit: true,
794
- level: "debug"
795
- } }));
796
- const records = iterateAsyncByDelimiter(stream, recordSep);
797
- let count = 0;
798
- let entry;
799
- let fields;
800
- for await (const record of records) {
801
- if (!record.length) continue;
802
- if (!isCompleteRecord(record, keys.length)) continue;
803
- count++;
804
- entry = {};
805
- fields = iterateByDelimiter(record, fieldSep);
806
- let fieldCount = 0;
807
- let field;
808
- while (true) {
809
- field = fields.next();
810
- if (field.done) break;
811
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
812
- else if (fieldCount === keys.length) {
813
- const file = parsePatch(field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value);
814
- entry.files = file != null ? [file] : [];
815
- } else debugger;
816
- }
817
- yield entry;
818
- }
819
- sw?.stop({ suffix: ` parsed ${count} records` });
820
- } catch (_) {
821
- _usingCtx10.e = _;
822
- } finally {
823
- _usingCtx10.d();
824
- }
707
+ function parseRecord(record) {
708
+ const entry = { files: [] };
709
+ const payloadStart = readFields(record, keys, entry);
710
+ if (payloadStart === -1) return void 0;
711
+ const file = parsePatch(getPayload(record, payloadStart));
712
+ if (file != null) entry.files = [file];
713
+ return entry;
825
714
  }
715
+ const { parse, parseAsync } = createRecordParsers("Git.LogParserWithPatch", parseRecord);
826
716
  return {
827
717
  arguments: args,
828
718
  separators: {
@@ -880,82 +770,19 @@ function createLogParserWithStats(mapping) {
880
770
  }
881
771
  return stats;
882
772
  }
883
- function* parse(data) {
884
- try {
885
- var _usingCtx11 = _usingCtx();
886
- const sw = _usingCtx11.u(maybeStopWatch("Git.LogParserWithStats.parse", { log: {
887
- onlyExit: true,
888
- level: "debug"
889
- } }));
890
- if (!data) {
891
- sw?.stop({ suffix: ` no data` });
892
- return;
893
- }
894
- const records = iterateByDelimiter(data, recordSep);
895
- let count = 0;
896
- let entry;
897
- let fields;
898
- for (const record of records) {
899
- if (!record.length) continue;
900
- count++;
901
- entry = {};
902
- fields = iterateByDelimiter(record, fieldSep);
903
- let fieldCount = 0;
904
- let field;
905
- while (true) {
906
- field = fields.next();
907
- if (field.done) break;
908
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
909
- else if (fieldCount === keys.length) {
910
- const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
911
- entry.stats = parseStats(summary);
912
- } else debugger;
913
- }
914
- yield entry;
915
- }
916
- sw?.stop({ suffix: ` parsed ${count} records` });
917
- } catch (_) {
918
- _usingCtx11.e = _;
919
- } finally {
920
- _usingCtx11.d();
921
- }
922
- }
923
- async function* parseAsync(stream) {
924
- try {
925
- var _usingCtx12 = _usingCtx();
926
- const sw = _usingCtx12.u(maybeStopWatch("Git.LogParserWithStats.parseAsync", { log: {
927
- onlyExit: true,
928
- level: "debug"
929
- } }));
930
- const records = iterateAsyncByDelimiter(stream, recordSep);
931
- let count = 0;
932
- let entry;
933
- let fields;
934
- for await (const record of records) {
935
- if (!record.length) continue;
936
- count++;
937
- entry = {};
938
- fields = iterateByDelimiter(record, fieldSep);
939
- let fieldCount = 0;
940
- let field;
941
- while (true) {
942
- field = fields.next();
943
- if (field.done) break;
944
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
945
- else if (fieldCount === keys.length) {
946
- const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
947
- entry.stats = parseStats(summary);
948
- } else debugger;
949
- }
950
- yield entry;
951
- }
952
- sw?.stop({ suffix: ` parsed ${count} records` });
953
- } catch (_) {
954
- _usingCtx12.e = _;
955
- } finally {
956
- _usingCtx12.d();
957
- }
773
+ function parseRecord(record) {
774
+ const entry = { stats: {
775
+ files: 0,
776
+ additions: 0,
777
+ deletions: 0
778
+ } };
779
+ const payloadStart = readFields(record, keys, entry);
780
+ if (payloadStart === -1) return void 0;
781
+ const payload = getPayload(record, payloadStart);
782
+ if (payload.length) entry.stats = parseStats(payload);
783
+ return entry;
958
784
  }
785
+ const { parse, parseAsync } = createRecordParsers("Git.LogParserWithStats", parseRecord);
959
786
  return {
960
787
  arguments: args,
961
788
  separators: {
@@ -984,82 +811,14 @@ function createLogParserWithFiles(mapping) {
984
811
  }
985
812
  return files;
986
813
  }
987
- function* parse(data) {
988
- try {
989
- var _usingCtx13 = _usingCtx();
990
- const sw = _usingCtx13.u(maybeStopWatch("Git.createLogParserWithFiles.parse", { log: {
991
- onlyExit: true,
992
- level: "debug"
993
- } }));
994
- if (!data) {
995
- sw?.stop({ suffix: ` no data` });
996
- return;
997
- }
998
- const records = iterateByDelimiter(data, recordSep);
999
- let count = 0;
1000
- let entry;
1001
- let fields;
1002
- for (const record of records) {
1003
- if (!record.length) continue;
1004
- count++;
1005
- entry = {};
1006
- fields = iterateByDelimiter(record, fieldSep);
1007
- let fieldCount = 0;
1008
- let field;
1009
- while (true) {
1010
- field = fields.next();
1011
- if (field.done) break;
1012
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
1013
- else if (fieldCount === keys.length) {
1014
- const files = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
1015
- entry.files = parseFileNames(files);
1016
- } else debugger;
1017
- }
1018
- yield entry;
1019
- }
1020
- sw?.stop({ suffix: ` parsed ${count} records` });
1021
- } catch (_) {
1022
- _usingCtx13.e = _;
1023
- } finally {
1024
- _usingCtx13.d();
1025
- }
1026
- }
1027
- async function* parseAsync(stream) {
1028
- try {
1029
- var _usingCtx14 = _usingCtx();
1030
- const sw = _usingCtx14.u(maybeStopWatch("Git.createLogParserWithFiles.parseAsync", { log: {
1031
- onlyExit: true,
1032
- level: "debug"
1033
- } }));
1034
- const records = iterateAsyncByDelimiter(stream, recordSep);
1035
- let count = 0;
1036
- let entry;
1037
- let fields;
1038
- for await (const record of records) {
1039
- if (!record.length) continue;
1040
- count++;
1041
- entry = {};
1042
- fields = iterateByDelimiter(record, fieldSep);
1043
- let fieldCount = 0;
1044
- let field;
1045
- while (true) {
1046
- field = fields.next();
1047
- if (field.done) break;
1048
- if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
1049
- else if (fieldCount === keys.length) {
1050
- const files = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
1051
- entry.files = parseFileNames(files);
1052
- } else debugger;
1053
- }
1054
- yield entry;
1055
- }
1056
- sw?.stop({ suffix: ` parsed ${count} records` });
1057
- } catch (_) {
1058
- _usingCtx14.e = _;
1059
- } finally {
1060
- _usingCtx14.d();
1061
- }
814
+ function parseRecord(record) {
815
+ const entry = { files: [] };
816
+ const payloadStart = readFields(record, keys, entry);
817
+ if (payloadStart === -1) return void 0;
818
+ entry.files = parseFileNames(getPayload(record, payloadStart));
819
+ return entry;
1062
820
  }
821
+ const { parse, parseAsync } = createRecordParsers("Git.createLogParserWithFiles", parseRecord);
1063
822
  return {
1064
823
  arguments: args,
1065
824
  separators: {