chore: upgrade vite-plus to 0.3.0 (#9327)

Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-09-03 03:40:31 +00:00
1 parent 3b2de9da1c
commit f5fbb1bcb0
31 files changed
+1134 -971

No files matched your search

@@ -157,23 +157,21 @@ export const make = Effect.gen(function* () {
getChangeRequest: (input) =>
cli.getPullRequest({ cwd: input.cwd, number: input.number }).pipe(
Effect.mapError(fail("getChangeRequest")),
Effect.map(
(pullRequest): ProviderChangeRequestDetail => ({
...toChangeRequest(pullRequest),
body: pullRequest.body,
changedFiles: 0,
mergedAt: pullRequest.state === "merged" ? pullRequest.closedAt : null,
closedAt: pullRequest.state === "closed" ? pullRequest.closedAt : null,
reviewers: pullRequest.reviewers,
checks: [],
mergeCapabilities: { merge: true, squash: true, rebase: false },
viewerPermissions: AZURE_DEVOPS_VIEWER_PERMISSIONS,
autoMergeEnabled: pullRequest.autoMergeEnabled,
...(pullRequest.autoMergeMethod === undefined
? {}
: { autoMergeMethod: pullRequest.autoMergeMethod }),
}),
),
Effect.map((pullRequest): ProviderChangeRequestDetail => ({
...toChangeRequest(pullRequest),
body: pullRequest.body,
changedFiles: 0,
mergedAt: pullRequest.state === "merged" ? pullRequest.closedAt : null,
closedAt: pullRequest.state === "closed" ? pullRequest.closedAt : null,
reviewers: pullRequest.reviewers,
checks: [],
mergeCapabilities: { merge: true, squash: true, rebase: false },
viewerPermissions: AZURE_DEVOPS_VIEWER_PERMISSIONS,
autoMergeEnabled: pullRequest.autoMergeEnabled,
...(pullRequest.autoMergeMethod === undefined
? {}
: { autoMergeMethod: pullRequest.autoMergeMethod }),
})),
),
getChangeRequestActivity: (input) =>
@@ -187,15 +185,13 @@ export const make = Effect.gen(function* () {
Effect.orElseSucceed(() => ({ comments: [], truncated: true })),
)
).pipe(
Effect.map(
(conversation): ProviderChangeRequestActivity => ({
comments: conversation.comments,
commentCount: conversation.comments.length,
commentsTruncated: conversation.truncated,
reviewThreads: [],
commits: [],
}),
),
Effect.map((conversation): ProviderChangeRequestActivity => ({
comments: conversation.comments,
commentCount: conversation.comments.length,
commentsTruncated: conversation.truncated,
reviewThreads: [],
commits: [],
})),
),
),
),
@@ -203,17 +203,15 @@ export const make = Effect.gen(function* () {
{ concurrency: 3 },
).pipe(
Effect.mapError(fail("getChangeRequestActivity")),
Effect.map(
([pullRequest, comments, commits]): ProviderChangeRequestActivity => ({
comments: [...comments.comments, ...pullRequest.reviews].toSorted((left, right) =>
left.createdAt.localeCompare(right.createdAt),
),
commentCount: comments.comments.length + pullRequest.reviews.length,
commentsTruncated: comments.truncated,
reviewThreads: comments.threads,
commits,
}),
),
Effect.map(([pullRequest, comments, commits]): ProviderChangeRequestActivity => ({
comments: [...comments.comments, ...pullRequest.reviews].toSorted((left, right) =>
left.createdAt.localeCompare(right.createdAt),
),
commentCount: comments.comments.length + pullRequest.reviews.length,
commentsTruncated: comments.truncated,
reviewThreads: comments.threads,
commits,
})),
);
},
@@ -144,14 +144,12 @@ function withWorkflowApprovals(
}
const approvalChecks = runs
.filter((run) => !representedRunIds.has(run.id))
.map(
(run): PullRequestCheck => ({
name: run.name,
status: "action-required",
description: "A maintainer must approve this workflow before it can run.",
url: run.url,
}),
);
.map((run): PullRequestCheck => ({
name: run.name,
status: "action-required",
description: "A maintainer must approve this workflow before it can run.",
url: run.url,
}));
return [
...checks,
...approvalChecks,
@@ -363,38 +361,34 @@ export const make = Effect.gen(function* () {
{ concurrency: 3 },
).pipe(
Effect.mapError(fail("getChangeRequest")),
Effect.map(
([detail, repository, viewerAccess]): ProviderChangeRequestDetail => ({
...detail.pullRequest,
checks: withWorkflowApprovals(
detail.pullRequest.checks,
detail.workflowApprovals.runs,
detail.workflowApprovals.unavailable,
),
...(detail.workflowApprovals.unavailable
? {}
: { workflowApprovalsRequired: detail.workflowApprovals.runs.length }),
reviewers: detail.pullRequest.reviewRequestLogins.map((login) => ({
login,
name: null,
avatarUrl: null,
})),
mergeCapabilities: repository.mergeCapabilities,
viewerPermissions: gitHubViewerPermissions({
...viewerAccess,
canUpdateBranch: detail.comparison?.viewerCanUpdate === true,
}),
baseComparison:
detail.comparison === null || detail.comparison.behindBy === null
? "unknown"
: detail.comparison.behindBy > 0
? "behind"
: "up-to-date",
...(detail.comparison?.behindBy == null
? {}
: { behindBy: detail.comparison.behindBy }),
Effect.map(([detail, repository, viewerAccess]): ProviderChangeRequestDetail => ({
...detail.pullRequest,
checks: withWorkflowApprovals(
detail.pullRequest.checks,
detail.workflowApprovals.runs,
detail.workflowApprovals.unavailable,
),
...(detail.workflowApprovals.unavailable
? {}
: { workflowApprovalsRequired: detail.workflowApprovals.runs.length }),
reviewers: detail.pullRequest.reviewRequestLogins.map((login) => ({
login,
name: null,
avatarUrl: null,
})),
mergeCapabilities: repository.mergeCapabilities,
viewerPermissions: gitHubViewerPermissions({
...viewerAccess,
canUpdateBranch: detail.comparison?.viewerCanUpdate === true,
}),
),
baseComparison:
detail.comparison === null || detail.comparison.behindBy === null
? "unknown"
: detail.comparison.behindBy > 0
? "behind"
: "up-to-date",
...(detail.comparison?.behindBy == null ? {} : { behindBy: detail.comparison.behindBy }),
})),
),
getChangeRequestActivity: (input) =>
@@ -426,53 +420,51 @@ export const make = Effect.gen(function* () {
{ concurrency: 2 },
).pipe(
Effect.mapError(fail("getChangeRequestActivity")),
Effect.map(
([pullRequest, reviewThreads]): ProviderChangeRequestActivity => ({
author: withAvatar(pullRequest.author, reviewThreads.avatarsByLogin, input.host),
reviewers: reviewThreads.reviewers,
reactions: reviewThreads.reactions,
commits: (reviewThreads.commits.length > 0
? reviewThreads.commits
: pullRequest.commits
).map((commit) => ({
...commit,
...reviewThreads.commitStats.get(commit.oid),
authors: commit.authors?.map(
(author) => withAvatar(author, reviewThreads.avatarsByLogin, input.host) ?? author,
),
Effect.map(([pullRequest, reviewThreads]): ProviderChangeRequestActivity => ({
author: withAvatar(pullRequest.author, reviewThreads.avatarsByLogin, input.host),
reviewers: reviewThreads.reviewers,
reactions: reviewThreads.reactions,
commits: (reviewThreads.commits.length > 0
? reviewThreads.commits
: pullRequest.commits
).map((commit) => ({
...commit,
...reviewThreads.commitStats.get(commit.oid),
authors: commit.authors?.map(
(author) => withAvatar(author, reviewThreads.avatarsByLogin, input.host) ?? author,
),
})),
comments: [...pullRequest.comments, ...reviewThreads.comments]
.map((comment) => ({
...comment,
// GitHub keeps the dismissal reason on the timeline event, not on the review,
// so a dismissed review with nothing visible of its own reads its words from
// there. "Visible" and not "empty": bot reviews often carry only an HTML
// marker comment, which markdown renders as nothing.
body:
comment.kind === "review" &&
comment.reviewState?.toUpperCase() === "DISMISSED" &&
rendersEmpty(comment.body)
? (reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body)
: comment.body,
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
// A comment out of `gh pr view --json` carries none of its own: that read
// reports no reaction at all, so they arrive from the GraphQL page by node id.
reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? [],
}))
.toSorted((left, right) => left.createdAt.localeCompare(right.createdAt)),
// `gh pr view --json comments,reviews` follows GitHub's cursors itself, so those two
// are always whole and only the thread walk can stop short of the host.
commentCount: pullRequest.comments.length + reviewThreads.commentCount,
commentsTruncated: reviewThreads.truncated,
reviewThreads: reviewThreads.reviewThreads.map((thread) => ({
...thread,
comments: thread.comments.map((comment) => ({
...comment,
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
})),
comments: [...pullRequest.comments, ...reviewThreads.comments]
.map((comment) => ({
...comment,
// GitHub keeps the dismissal reason on the timeline event, not on the review,
// so a dismissed review with nothing visible of its own reads its words from
// there. "Visible" and not "empty": bot reviews often carry only an HTML
// marker comment, which markdown renders as nothing.
body:
comment.kind === "review" &&
comment.reviewState?.toUpperCase() === "DISMISSED" &&
rendersEmpty(comment.body)
? (reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body)
: comment.body,
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
// A comment out of `gh pr view --json` carries none of its own: that read
// reports no reaction at all, so they arrive from the GraphQL page by node id.
reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? [],
}))
.toSorted((left, right) => left.createdAt.localeCompare(right.createdAt)),
// `gh pr view --json comments,reviews` follows GitHub's cursors itself, so those two
// are always whole and only the thread walk can stop short of the host.
commentCount: pullRequest.comments.length + reviewThreads.commentCount,
commentsTruncated: reviewThreads.truncated,
reviewThreads: reviewThreads.reviewThreads.map((thread) => ({
...thread,
comments: thread.comments.map((comment) => ({
...comment,
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
})),
})),
}),
),
})),
})),
),
getReviewThreadComments: (input) =>
@@ -147,24 +147,22 @@ export const make = Effect.gen(function* () {
{ concurrency: 2 },
).pipe(
Effect.mapError(fail("getChangeRequest")),
Effect.map(
([mergeRequest, mergeCapabilities]): ProviderChangeRequestDetail => ({
...mergeRequest,
mergeCapabilities,
viewerPermissions: gitLabViewerPermissions(mergeRequest),
// A GitLab too old to count the divergence says nothing here rather than "up to
// date": the banner is worth missing, and a wrong all-clear is not worth showing.
baseComparison:
mergeRequest.divergedCommits === undefined
? "unknown"
: mergeRequest.divergedCommits > 0
? "behind"
: "up-to-date",
...(mergeRequest.divergedCommits === undefined
? {}
: { behindBy: mergeRequest.divergedCommits }),
}),
),
Effect.map(([mergeRequest, mergeCapabilities]): ProviderChangeRequestDetail => ({
...mergeRequest,
mergeCapabilities,
viewerPermissions: gitLabViewerPermissions(mergeRequest),
// A GitLab too old to count the divergence says nothing here rather than "up to
// date": the banner is worth missing, and a wrong all-clear is not worth showing.
baseComparison:
mergeRequest.divergedCommits === undefined
? "unknown"
: mergeRequest.divergedCommits > 0
? "behind"
: "up-to-date",
...(mergeRequest.divergedCommits === undefined
? {}
: { behindBy: mergeRequest.divergedCommits }),
})),
),
getChangeRequestActivity: (input) =>
@@ -189,28 +187,26 @@ export const make = Effect.gen(function* () {
{ concurrency: 4 },
).pipe(
Effect.mapError(fail("getChangeRequestActivity")),
Effect.map(
([notes, commits, discussions, awards]): ProviderChangeRequestActivity => ({
reactions: awards.reactions,
comments: notes.comments.map((comment) => ({
Effect.map(([notes, commits, discussions, awards]): ProviderChangeRequestActivity => ({
reactions: awards.reactions,
comments: notes.comments.map((comment) => ({
...comment,
reactions: awards.reactionsByNoteId.get(comment.id) ?? [],
})),
// GitLab reports no count of its own, so the walk's own total is the host's: the
// notes endpoint carries every comment on the merge request, including the ones
// written under a discussion, and it is read until GitLab runs out.
commentCount: notes.comments.length,
commentsTruncated: notes.truncated || discussions.truncated,
reviewThreads: discussions.threads.map((thread) => ({
...thread,
comments: thread.comments.map((comment) => ({
...comment,
reactions: awards.reactionsByNoteId.get(comment.id) ?? [],
})),
// GitLab reports no count of its own, so the walk's own total is the host's: the
// notes endpoint carries every comment on the merge request, including the ones
// written under a discussion, and it is read until GitLab runs out.
commentCount: notes.comments.length,
commentsTruncated: notes.truncated || discussions.truncated,
reviewThreads: discussions.threads.map((thread) => ({
...thread,
comments: thread.comments.map((comment) => ({
...comment,
reactions: awards.reactionsByNoteId.get(comment.id) ?? [],
})),
})),
commits,
}),
),
})),
commits,
})),
),
// The same read the detail takes it from, on its own: `user.can_merge` lives on the merge
+98 -107
View File
@@ -1035,21 +1035,19 @@ export const make = Effect.gen(function* () {
}),
// One unreachable repository must not blank the page. A host-level failure is
// already reported through `providers`, so it degrades the same way here.
Effect.orElseSucceed(
(): RepositoryBatch => ({
key,
entries: [],
errors: [
{
projectId: project.project.id,
projectTitle: project.project.title,
message: `${project.repository} could not be read.`,
},
],
truncated: false,
nextCursor: null,
}),
),
Effect.orElseSucceed((): RepositoryBatch => ({
key,
entries: [],
errors: [
{
projectId: project.project.id,
projectTitle: project.project.title,
message: `${project.repository} could not be read.`,
},
],
truncated: false,
nextCursor: null,
})),
);
}
};
@@ -1230,20 +1228,18 @@ export const make = Effect.gen(function* () {
: project.api.getChangeRequestSummary(providerInput);
return read.pipe(
Effect.mapError(toPullRequestError("summary")),
Effect.map(
(changeRequest): PullRequestSummary => ({
provider: project.api.kind,
projectId: project.project.id,
repository: project.repository,
number: changeRequest.number,
title: changeRequest.title,
url: changeRequest.url,
state: changeRequest.state,
headBranch: changeRequest.headBranch,
baseBranch: changeRequest.baseBranch,
updatedAt: changeRequest.updatedAt,
}),
),
Effect.map((changeRequest): PullRequestSummary => ({
provider: project.api.kind,
projectId: project.project.id,
repository: project.repository,
number: changeRequest.number,
title: changeRequest.title,
url: changeRequest.url,
state: changeRequest.state,
headBranch: changeRequest.headBranch,
baseBranch: changeRequest.baseBranch,
updatedAt: changeRequest.updatedAt,
})),
);
}),
);
@@ -1265,55 +1261,53 @@ export const make = Effect.gen(function* () {
],
{ concurrency: 2 },
).pipe(
Effect.map(
([changeRequest, viewer]): PullRequestDetail => ({
provider: project.api.kind,
capabilities: project.api.capabilities,
projectId: project.project.id,
projectTitle: project.project.title,
workspaceRoot: project.project.workspaceRoot,
repository: project.repository,
number: changeRequest.number,
title: changeRequest.title,
body: changeRequest.body,
url: changeRequest.url,
author: changeRequest.author,
state: changeRequest.state,
isDraft: changeRequest.isDraft,
mergeability: changeRequest.mergeability,
additions: changeRequest.additions,
deletions: changeRequest.deletions,
changedFiles: changeRequest.changedFiles,
headBranch: changeRequest.headBranch,
...(changeRequest.headRepositoryNameWithOwner === undefined
? {}
: { headRepositoryNameWithOwner: changeRequest.headRepositoryNameWithOwner }),
baseBranch: changeRequest.baseBranch,
createdAt: changeRequest.createdAt,
updatedAt: changeRequest.updatedAt,
mergedAt: changeRequest.mergedAt,
closedAt: changeRequest.closedAt,
reviewers: changeRequest.reviewers,
labels: changeRequest.labels,
checks: changeRequest.checks,
mergeCapabilities: changeRequest.mergeCapabilities,
viewerPermissions: changeRequest.viewerPermissions,
...(viewer === null || viewer.trim().length === 0 ? {} : { viewer }),
...(changeRequest.baseComparison === undefined
? {}
: { baseComparison: changeRequest.baseComparison }),
...(changeRequest.behindBy === undefined ? {} : { behindBy: changeRequest.behindBy }),
...(changeRequest.autoMergeEnabled === undefined
? {}
: { autoMergeEnabled: changeRequest.autoMergeEnabled }),
...(changeRequest.autoMergeMethod === undefined
? {}
: { autoMergeMethod: changeRequest.autoMergeMethod }),
...(changeRequest.workflowApprovalsRequired === undefined
? {}
: { workflowApprovalsRequired: changeRequest.workflowApprovalsRequired }),
}),
),
Effect.map(([changeRequest, viewer]): PullRequestDetail => ({
provider: project.api.kind,
capabilities: project.api.capabilities,
projectId: project.project.id,
projectTitle: project.project.title,
workspaceRoot: project.project.workspaceRoot,
repository: project.repository,
number: changeRequest.number,
title: changeRequest.title,
body: changeRequest.body,
url: changeRequest.url,
author: changeRequest.author,
state: changeRequest.state,
isDraft: changeRequest.isDraft,
mergeability: changeRequest.mergeability,
additions: changeRequest.additions,
deletions: changeRequest.deletions,
changedFiles: changeRequest.changedFiles,
headBranch: changeRequest.headBranch,
...(changeRequest.headRepositoryNameWithOwner === undefined
? {}
: { headRepositoryNameWithOwner: changeRequest.headRepositoryNameWithOwner }),
baseBranch: changeRequest.baseBranch,
createdAt: changeRequest.createdAt,
updatedAt: changeRequest.updatedAt,
mergedAt: changeRequest.mergedAt,
closedAt: changeRequest.closedAt,
reviewers: changeRequest.reviewers,
labels: changeRequest.labels,
checks: changeRequest.checks,
mergeCapabilities: changeRequest.mergeCapabilities,
viewerPermissions: changeRequest.viewerPermissions,
...(viewer === null || viewer.trim().length === 0 ? {} : { viewer }),
...(changeRequest.baseComparison === undefined
? {}
: { baseComparison: changeRequest.baseComparison }),
...(changeRequest.behindBy === undefined ? {} : { behindBy: changeRequest.behindBy }),
...(changeRequest.autoMergeEnabled === undefined
? {}
: { autoMergeEnabled: changeRequest.autoMergeEnabled }),
...(changeRequest.autoMergeMethod === undefined
? {}
: { autoMergeMethod: changeRequest.autoMergeMethod }),
...(changeRequest.workflowApprovalsRequired === undefined
? {}
: { workflowApprovalsRequired: changeRequest.workflowApprovalsRequired }),
})),
),
),
);
@@ -1330,18 +1324,16 @@ export const make = Effect.gen(function* () {
})
.pipe(
Effect.mapError(toPullRequestError("activity")),
Effect.map(
(activity): PullRequestActivity => ({
...(activity.author === undefined ? {} : { author: activity.author }),
...(activity.reviewers === undefined ? {} : { reviewers: activity.reviewers }),
comments: activity.comments,
commentCount: activity.commentCount,
commentsTruncated: activity.commentsTruncated,
reviewThreads: activity.reviewThreads,
commits: activity.commits,
...(activity.reactions === undefined ? {} : { reactions: activity.reactions }),
}),
),
Effect.map((activity): PullRequestActivity => ({
...(activity.author === undefined ? {} : { author: activity.author }),
...(activity.reviewers === undefined ? {} : { reviewers: activity.reviewers }),
comments: activity.comments,
commentCount: activity.commentCount,
commentsTruncated: activity.commentsTruncated,
reviewThreads: activity.reviewThreads,
commits: activity.commits,
...(activity.reactions === undefined ? {} : { reactions: activity.reactions }),
})),
),
),
);
@@ -1906,23 +1898,22 @@ export const make = Effect.gen(function* () {
);
}
return viewerPermissionsOf(project, input, "setLabels").pipe(
Effect.flatMap(
(viewer): Effect.Effect<void, PullRequestError> =>
viewer.labels === false
? Effect.fail(
new PullRequestOperationError({
operation: "setLabels",
detail: LABEL_CHANGE_REFUSAL,
}),
)
: change({
cwd: project.project.workspaceRoot,
repository: project.repository,
host: project.host,
number: input.number,
labels: input.labels,
applied: input.applied,
}).pipe(Effect.mapError(toPullRequestError("setLabels"))),
Effect.flatMap((viewer): Effect.Effect<void, PullRequestError> =>
viewer.labels === false
? Effect.fail(
new PullRequestOperationError({
operation: "setLabels",
detail: LABEL_CHANGE_REFUSAL,
}),
)
: change({
cwd: project.project.workspaceRoot,
repository: project.repository,
host: project.host,
number: input.number,
labels: input.labels,
applied: input.applied,
}).pipe(Effect.mapError(toPullRequestError("setLabels"))),
),
);
}),
@@ -1339,18 +1339,16 @@ function toComments(raw: {
readonly comments?: ReadonlyArray<Schema.Schema.Type<typeof RawCommentSchema>> | undefined;
readonly reviews?: ReadonlyArray<Schema.Schema.Type<typeof RawReviewSchema>> | undefined;
}): ReadonlyArray<PullRequestComment> {
const issueComments = (raw.comments ?? []).map(
(comment): PullRequestComment => ({
id: comment.id,
kind: "issue-comment",
author: toActor(comment.author),
body: comment.body ?? "",
createdAt: comment.createdAt,
url: trimmed(comment.url),
path: null,
reviewState: null,
}),
);
const issueComments = (raw.comments ?? []).map((comment): PullRequestComment => ({
id: comment.id,
kind: "issue-comment",
author: toActor(comment.author),
body: comment.body ?? "",
createdAt: comment.createdAt,
url: trimmed(comment.url),
path: null,
reviewState: null,
}));
// A review with no body is kept only when its state is the event itself — an approval, a
// request for changes, a dismissal. GitHub also opens a bodiless `COMMENTED` review as the
// container for line comments, and those comments are read from the review threads, so
@@ -1743,19 +1741,17 @@ export function reviewThreadConversation(
threads: ReadonlyArray<PullRequestReviewThread>,
): ReadonlyArray<PullRequestComment> {
return threads.flatMap((thread) =>
thread.comments.map(
(comment): PullRequestComment => ({
id: comment.id,
kind: "review-comment",
author: comment.author,
body: comment.body,
createdAt: comment.createdAt,
url: comment.url,
path: thread.path,
reviewState: null,
reactions: comment.reactions ?? [],
}),
),
thread.comments.map((comment): PullRequestComment => ({
id: comment.id,
kind: "review-comment",
author: comment.author,
body: comment.body,
createdAt: comment.createdAt,
url: comment.url,
path: thread.path,
reviewState: null,
reactions: comment.reactions ?? [],
})),
);
}