@vite-hub/workspace 0.0.4 → 0.1.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/README.md +225 -58
- package/dist/{ai-CjxvGqM0.d.ts → ai-BW2ZhizI.d.ts} +22 -7
- package/dist/{ai-BqCC8BpY.js → ai-BZyLwULx.js} +147 -66
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +1 -1
- package/dist/{asset-registry-8QI3ML3K.js → asset-registry-DfBV5kmw.js} +3 -2
- package/dist/association-Cm0dUTDU-CDDhJnIh-Cv3bWnVb.js +19 -0
- package/dist/blob-database.d.ts +521 -0
- package/dist/blob-database.js +601 -0
- package/dist/cloudflare.d.ts +5 -6
- package/dist/cloudflare.js +1 -1
- package/dist/config-B7dmzDX3.js +1112 -0
- package/dist/{config-DE9xlaIw.d.ts → config-DLKdaFWN.d.ts} +1 -2
- package/dist/error-diagnostics-A_8Kp-48.js +116 -0
- package/dist/error-diagnostics-DY5GP47p.js +96 -0
- package/dist/events-7EBoeIPd-A2RUkJi5-BxrICQ17.js +354 -0
- package/dist/events-CRaLy7U3-3PNNp5WZ-Gv9nd0cH.js +214 -0
- package/dist/events-CeChclTf-CX-gD8oy-4aL2j6V-.js +527 -0
- package/dist/feed-DsC7Vws1-M_de2nSK-tKc0Pwo8.js +248 -0
- package/dist/feed-Dyf730Ys-D0HgBba6-BUnCa5gS.js +179 -0
- package/dist/file-C0_aPWSS.js +26 -0
- package/dist/file-metadata-CxDy-E2H.js +58 -0
- package/dist/{files-Q6xZjDHA.js → files-C7Px8uaC.js} +3 -3
- package/dist/forgejo-BN8ItCfl-Bbn4vhDd.js +2278 -0
- package/dist/{github-DHnjxQIX.js → github-CPxHtFB7.js} +16 -23
- package/dist/github-DtncTfmv-Du2S8lGF.js +4159 -0
- package/dist/gitlab-BoDm8-BC-xzZsW9eW.js +2530 -0
- package/dist/glob--XcLlcml.js +22 -0
- package/dist/glob--kNYDbfU.js +30 -0
- package/dist/graphql-DG5aJBT3-DceyFYdM-C4saqX37.js +489 -0
- package/dist/{host-DJH8cuoU.js → host-CFnrTXTK.js} +97 -41
- package/dist/{hosted-RPeJOCFz.js → hosted-acMA5XyL.js} +102 -19
- package/dist/hosted-vercel-blob-DKntsHaf.js +12603 -0
- package/dist/hosted-vercel-blob.d.ts +5 -6
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +6 -7
- package/dist/hosted.js +1 -1
- package/dist/index.d.ts +57 -36
- package/dist/index.js +56 -56
- package/dist/inspect-BoObD2cJ.js +167 -0
- package/dist/internal/path.d.ts +2 -0
- package/dist/internal/path.js +2 -0
- package/dist/lifecycle-BwZ7c9hb.js +596 -0
- package/dist/loader.d.ts +5 -6
- package/dist/loader.js +3 -2
- package/dist/mcp-resources-BREFCmtn.js +39 -0
- package/dist/memory-BbwOqDXl.js +248 -0
- package/dist/metadata-target-DZEZQGHA.js +1588 -0
- package/dist/mountx.d.ts +4 -6
- package/dist/mountx.js +10 -8
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +1 -1
- package/dist/nuxt.d.ts +13 -12
- package/dist/nuxt.js +4 -8
- package/dist/operations-BcpWr41m.js +159 -0
- package/dist/operations-CGqY1XeG.js +965 -0
- package/dist/operations-DnOwKsJT.d.ts +136 -0
- package/dist/operations.d.ts +53 -0
- package/dist/operations.js +2 -0
- package/dist/path-CNAwN7pw.js +114 -0
- package/dist/path-DrSIenjj.js +59 -0
- package/dist/path-zHxQUbqa.d.ts +9 -0
- package/dist/plugins-DqQ8b4T5.d.ts +10 -0
- package/dist/provider-kXjfli9u.js +1457 -0
- package/dist/providers/github/store.d.ts +3 -5
- package/dist/providers/github/store.js +1 -1
- package/dist/{registry-D3yzt8HQ.js → registry-Bp-8UUfG.js} +9 -7
- package/dist/{registry-Uj6IVxes.d.ts → registry-Cg1TJVVZ.d.ts} +1 -2
- package/dist/{request-execution-B-dSFlGB.js → request-execution-Dk9rY-Yh.js} +19 -19
- package/dist/{chunk-2rV9d50f.js → rolldown-runtime-B4iAMlE-.js} +2 -2
- package/dist/runtime/assets.d.ts +3 -5
- package/dist/runtime/assets.js +7 -6
- package/dist/runtime/empty-assets-registry.d.ts +1 -2
- package/dist/runtime/empty-registry.d.ts +1 -2
- package/dist/runtime/state.d.ts +3 -3
- package/dist/runtime/state.js +6 -6
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +51 -17
- package/dist/runtime.js +320 -60
- package/dist/{search-BpiCF2Tw.js → search-CrTmXj5h.js} +10 -9
- package/dist/server-BNQ-Nbjj.js +290 -0
- package/dist/server.d.ts +22 -34
- package/dist/server.js +2 -328
- package/dist/shared-DalXdP0i.js +2158 -0
- package/dist/source-metadata.d.ts +6 -7
- package/dist/source-metadata.js +7 -7
- package/dist/{state-tYcRWEh2.d.ts → state-B8zbLi5t.d.ts} +3 -3
- package/dist/store-CXgmu-uw.js +1729 -0
- package/dist/{sync-DnTQwt8r.js → sync-CN6ec-5M.js} +61 -41
- package/dist/templates-Bn8a-pd2-D9DhJEVD-CBfXNRzz.js +125 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{token-CVzURBxC.js → token-CO62GglH.js} +3 -3
- package/dist/{types-CYuwjJ4V.d.ts → types-DeK9GIxy.d.ts} +256 -24
- package/dist/{use-BTNDR5Rd.js → use-BQj7nSz6.js} +82 -41
- package/dist/{use-BiHzt0xA.d.ts → use-DhwhbAVV.d.ts} +16 -11
- package/dist/utils-Blrh4N2n.js +545 -0
- package/dist/vite-BEvgU2GY.js +20909 -0
- package/dist/vite-CcZmMQ7S.d.ts +476 -0
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +2 -2
- package/dist/webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js +1565 -0
- package/dist/{workspace-Dq08Yn72.js → workspace-6pxkOuxr.js} +361 -230
- package/dist/{workspace-Xddf4G1B.d.ts → workspace-BWJQBK1u.d.ts} +4 -3
- package/package.json +89 -55
- package/dist/collections/client.d.ts +0 -39
- package/dist/collections/client.js +0 -137
- package/dist/collections.d.ts +0 -59
- package/dist/collections.js +0 -159
- package/dist/config-Bc3c4Su1.js +0 -7904
- package/dist/config-CHLLWklZ.js +0 -36
- package/dist/file-Bc1X7pco.js +0 -23
- package/dist/glob-CEZKeZFC.js +0 -18
- package/dist/hosted-vercel-blob-d6C8ND5j.js +0 -23580
- package/dist/lifecycle-LrL3sA4n.js +0 -316
- package/dist/metadata-target-B0tOmVW7.js +0 -717
- package/dist/path-Cp59koVz.js +0 -139
- package/dist/provider-B1yLjCJJ.js +0 -746
- package/dist/publish.d.ts +0 -35
- package/dist/publish.js +0 -112
- package/dist/runtime-options-BsPSv5O7.js +0 -13
- package/dist/runtime-type-iEE6BjQJ.js +0 -34
- package/dist/shared-DTR1Hhma.js +0 -331
- package/dist/store-Dt_Jyys3.js +0 -608
- package/dist/vite-BptCrpv2.js +0 -4526
- package/dist/vite-CtA9guIM.d.ts +0 -66
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { It as toDate } from "./shared-DalXdP0i.js";
|
|
2
|
+
import { g as refEvent, s as eventTime } from "./webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js";
|
|
3
|
+
import { n as toActor, r as toRepoRef } from "./forgejo-BN8ItCfl-Bbn4vhDd.js";
|
|
4
|
+
//#region ../forge/dist/feed-DsC7Vws1-M_de2nSK.js
|
|
5
|
+
/** Activity types about an issue or a pull request, whose `content` starts with its number. */
|
|
6
|
+
const FEED_THREAD_OPS = {
|
|
7
|
+
create_issue: {
|
|
8
|
+
thread: "issue",
|
|
9
|
+
kind: "state_change",
|
|
10
|
+
action: "opened",
|
|
11
|
+
state: "open",
|
|
12
|
+
titled: true
|
|
13
|
+
},
|
|
14
|
+
close_issue: {
|
|
15
|
+
thread: "issue",
|
|
16
|
+
kind: "state_change",
|
|
17
|
+
action: "closed",
|
|
18
|
+
state: "closed"
|
|
19
|
+
},
|
|
20
|
+
reopen_issue: {
|
|
21
|
+
thread: "issue",
|
|
22
|
+
kind: "state_change",
|
|
23
|
+
action: "reopened",
|
|
24
|
+
state: "open"
|
|
25
|
+
},
|
|
26
|
+
comment_issue: {
|
|
27
|
+
thread: "issue",
|
|
28
|
+
kind: "comment",
|
|
29
|
+
action: "created"
|
|
30
|
+
},
|
|
31
|
+
create_pull_request: {
|
|
32
|
+
thread: "pull_request",
|
|
33
|
+
kind: "state_change",
|
|
34
|
+
action: "opened",
|
|
35
|
+
state: "open",
|
|
36
|
+
titled: true
|
|
37
|
+
},
|
|
38
|
+
close_pull_request: {
|
|
39
|
+
thread: "pull_request",
|
|
40
|
+
kind: "state_change",
|
|
41
|
+
action: "closed",
|
|
42
|
+
state: "closed"
|
|
43
|
+
},
|
|
44
|
+
reopen_pull_request: {
|
|
45
|
+
thread: "pull_request",
|
|
46
|
+
kind: "state_change",
|
|
47
|
+
action: "reopened",
|
|
48
|
+
state: "open"
|
|
49
|
+
},
|
|
50
|
+
merge_pull_request: {
|
|
51
|
+
thread: "pull_request",
|
|
52
|
+
kind: "state_change",
|
|
53
|
+
action: "merged",
|
|
54
|
+
state: "merged",
|
|
55
|
+
titled: true
|
|
56
|
+
},
|
|
57
|
+
auto_merge_pull_request: {
|
|
58
|
+
thread: "pull_request",
|
|
59
|
+
kind: "state_change",
|
|
60
|
+
action: "merged",
|
|
61
|
+
state: "merged",
|
|
62
|
+
titled: true
|
|
63
|
+
},
|
|
64
|
+
pull_request_ready_for_review: {
|
|
65
|
+
thread: "pull_request",
|
|
66
|
+
kind: "state_change",
|
|
67
|
+
action: "ready_for_review",
|
|
68
|
+
state: "open"
|
|
69
|
+
},
|
|
70
|
+
comment_pull: {
|
|
71
|
+
thread: "pull_request",
|
|
72
|
+
kind: "comment",
|
|
73
|
+
action: "created"
|
|
74
|
+
},
|
|
75
|
+
approve_pull_request: {
|
|
76
|
+
thread: "pull_request",
|
|
77
|
+
kind: "review",
|
|
78
|
+
action: "submitted",
|
|
79
|
+
review: "approved"
|
|
80
|
+
},
|
|
81
|
+
reject_pull_request: {
|
|
82
|
+
thread: "pull_request",
|
|
83
|
+
kind: "review",
|
|
84
|
+
action: "submitted",
|
|
85
|
+
review: "changes_requested"
|
|
86
|
+
},
|
|
87
|
+
pull_review_dismissed: {
|
|
88
|
+
thread: "pull_request",
|
|
89
|
+
kind: "review",
|
|
90
|
+
action: "other",
|
|
91
|
+
review: "dismissed"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/** Splits thread activity `content` into the thread number and its text. */
|
|
95
|
+
function threadContent(content = "") {
|
|
96
|
+
if (content.startsWith("[")) try {
|
|
97
|
+
const [number = "", text = ""] = JSON.parse(content);
|
|
98
|
+
return [String(number), text];
|
|
99
|
+
} catch {
|
|
100
|
+
return ["", content];
|
|
101
|
+
}
|
|
102
|
+
const index = content.indexOf("|");
|
|
103
|
+
return index < 0 ? [content, ""] : [content.slice(0, index), content.slice(index + 1)];
|
|
104
|
+
}
|
|
105
|
+
function pushContent(content) {
|
|
106
|
+
try {
|
|
107
|
+
return content ? JSON.parse(content) : {};
|
|
108
|
+
} catch {
|
|
109
|
+
return {};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function feedLevel(origin, raw, repo, who) {
|
|
113
|
+
const ref = raw.ref_name ?? "";
|
|
114
|
+
const name = ref.replace(/^refs\/(?:heads|tags)\//, "");
|
|
115
|
+
const refType = raw.op_type === "push_tag" || raw.op_type === "delete_tag" || ref.startsWith("refs/tags/") ? "tag" : "branch";
|
|
116
|
+
switch (raw.op_type) {
|
|
117
|
+
case "commit_repo":
|
|
118
|
+
case "mirror_sync_push": {
|
|
119
|
+
const push = pushContent(raw.content);
|
|
120
|
+
return refEvent(who, {
|
|
121
|
+
ref,
|
|
122
|
+
before: /\/compare\/([0-9a-f]+)\.\.\./.exec(push.CompareURL ?? "")?.[1],
|
|
123
|
+
after: push.HeadCommit?.Sha1 ?? push.Commits?.[0]?.Sha1,
|
|
124
|
+
commits: push.Commits?.map((commit) => ({
|
|
125
|
+
sha: commit.Sha1,
|
|
126
|
+
message: commit.Message,
|
|
127
|
+
author: commit.AuthorName
|
|
128
|
+
})),
|
|
129
|
+
commitCount: push.Len
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
case "push_tag":
|
|
133
|
+
case "mirror_sync_create":
|
|
134
|
+
case "delete_tag":
|
|
135
|
+
case "delete_branch":
|
|
136
|
+
case "mirror_sync_delete": {
|
|
137
|
+
const action = raw.op_type === "push_tag" || raw.op_type === "mirror_sync_create" ? "created" : "deleted";
|
|
138
|
+
return {
|
|
139
|
+
kind: "ref",
|
|
140
|
+
action,
|
|
141
|
+
detail: {
|
|
142
|
+
type: "ref",
|
|
143
|
+
ref: name,
|
|
144
|
+
refType
|
|
145
|
+
},
|
|
146
|
+
summary: `${who} ${action} ${refType} ${name}`
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
case "create_repo": return {
|
|
150
|
+
kind: "repo",
|
|
151
|
+
action: "created",
|
|
152
|
+
summary: `${who} created the repository`
|
|
153
|
+
};
|
|
154
|
+
case "rename_repo": return {
|
|
155
|
+
kind: "repo",
|
|
156
|
+
action: "renamed",
|
|
157
|
+
detail: {
|
|
158
|
+
type: "repo_renamed",
|
|
159
|
+
from: raw.content ?? "",
|
|
160
|
+
to: raw.repo?.name ?? ""
|
|
161
|
+
},
|
|
162
|
+
summary: `${who} renamed the repository`
|
|
163
|
+
};
|
|
164
|
+
case "transfer_repo": return {
|
|
165
|
+
kind: "repo",
|
|
166
|
+
action: "transferred",
|
|
167
|
+
detail: {
|
|
168
|
+
type: "repo_transferred",
|
|
169
|
+
fromOwner: raw.content?.split("/")[0],
|
|
170
|
+
toOwner: raw.repo?.owner?.login
|
|
171
|
+
},
|
|
172
|
+
summary: `${who} transferred the repository`
|
|
173
|
+
};
|
|
174
|
+
case "publish_release": return {
|
|
175
|
+
kind: "release",
|
|
176
|
+
action: "published",
|
|
177
|
+
detail: {
|
|
178
|
+
type: "release",
|
|
179
|
+
tag: name || void 0,
|
|
180
|
+
name: raw.content || void 0
|
|
181
|
+
},
|
|
182
|
+
summary: `${who} published ${raw.content || name || "a release"}`
|
|
183
|
+
};
|
|
184
|
+
case "star_repo": return {
|
|
185
|
+
kind: "star",
|
|
186
|
+
action: "created",
|
|
187
|
+
summary: `${who} starred the repository`
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const op = FEED_THREAD_OPS[raw.op_type];
|
|
191
|
+
if (!op) return {
|
|
192
|
+
kind: "other",
|
|
193
|
+
summary: `${who} ${raw.op_type.replaceAll("_", " ")}`
|
|
194
|
+
};
|
|
195
|
+
const [number, text] = threadContent(raw.content);
|
|
196
|
+
const thread = repo && number ? {
|
|
197
|
+
...origin,
|
|
198
|
+
repo,
|
|
199
|
+
kind: op.thread,
|
|
200
|
+
number
|
|
201
|
+
} : void 0;
|
|
202
|
+
const noun = op.thread === "issue" ? "issue" : "pull request";
|
|
203
|
+
const detail = op.kind === "comment" ? {
|
|
204
|
+
type: "comment",
|
|
205
|
+
comment: thread && raw.comment ? {
|
|
206
|
+
...origin,
|
|
207
|
+
thread,
|
|
208
|
+
id: String(raw.comment.id)
|
|
209
|
+
} : void 0,
|
|
210
|
+
body: raw.comment?.body ?? text
|
|
211
|
+
} : op.review ? {
|
|
212
|
+
type: "review",
|
|
213
|
+
state: op.review,
|
|
214
|
+
stateRaw: raw.op_type,
|
|
215
|
+
body: text || void 0
|
|
216
|
+
} : {
|
|
217
|
+
type: "state_change",
|
|
218
|
+
state: op.state
|
|
219
|
+
};
|
|
220
|
+
const summary = op.kind === "comment" ? `${who} commented on ${noun} ${number}` : op.review ? `${who} reviewed ${noun} ${number} (${op.review})` : `${who} ${op.action.replaceAll("_", " ")} ${noun} ${number}`;
|
|
221
|
+
return {
|
|
222
|
+
kind: op.kind,
|
|
223
|
+
action: op.action,
|
|
224
|
+
thread,
|
|
225
|
+
...thread && op.titled && text ? { threadSnapshot: { title: text } } : {},
|
|
226
|
+
detail,
|
|
227
|
+
summary: summary.trim()
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/** Normalises an item of a repository's or a user's activity feed. */
|
|
231
|
+
function toFeedEvent(origin, raw) {
|
|
232
|
+
const actor = toActor(origin, raw.act_user);
|
|
233
|
+
const repo = raw.repo ? toRepoRef(origin, raw.repo) : void 0;
|
|
234
|
+
return {
|
|
235
|
+
...origin,
|
|
236
|
+
id: String(raw.id),
|
|
237
|
+
kindRaw: raw.op_type,
|
|
238
|
+
...feedLevel(origin, raw, repo, actor?.login ?? "someone"),
|
|
239
|
+
...eventTime(toDate(raw.created)),
|
|
240
|
+
actor,
|
|
241
|
+
repo,
|
|
242
|
+
...typeof raw.is_private === "boolean" ? { isPublic: !raw.is_private } : {},
|
|
243
|
+
source: "poll",
|
|
244
|
+
payload: raw
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
export { toFeedEvent };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { It as toDate } from "./shared-DalXdP0i.js";
|
|
2
|
+
import { a as eventAction, g as refEvent, s as eventTime } from "./webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js";
|
|
3
|
+
import { n as approvalId, r as toActor, s as toThreadKind, t as FORGE } from "./gitlab-BoDm8-BC-xzZsW9eW.js";
|
|
4
|
+
//#region ../forge/dist/feed-Dyf730Ys-D0HgBba6.js
|
|
5
|
+
const FEED_STATES = {
|
|
6
|
+
opened: {
|
|
7
|
+
action: "opened",
|
|
8
|
+
state: "open"
|
|
9
|
+
},
|
|
10
|
+
closed: {
|
|
11
|
+
action: "closed",
|
|
12
|
+
state: "closed"
|
|
13
|
+
},
|
|
14
|
+
reopened: {
|
|
15
|
+
action: "reopened",
|
|
16
|
+
state: "open"
|
|
17
|
+
},
|
|
18
|
+
accepted: {
|
|
19
|
+
action: "merged",
|
|
20
|
+
state: "merged"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function feedThread(repo, type, number) {
|
|
24
|
+
const kind = toThreadKind(type === "WorkItem" ? "Issue" : type ?? "");
|
|
25
|
+
return repo && kind && number !== null && number !== void 0 ? {
|
|
26
|
+
forge: FORGE,
|
|
27
|
+
instance: repo.instance,
|
|
28
|
+
repo,
|
|
29
|
+
kind,
|
|
30
|
+
number: String(number)
|
|
31
|
+
} : void 0;
|
|
32
|
+
}
|
|
33
|
+
function feedLevel(instance, raw, repo, who) {
|
|
34
|
+
const push = raw.push_data;
|
|
35
|
+
if (push) {
|
|
36
|
+
const tag = push.ref_type === "tag";
|
|
37
|
+
return refEvent(who, {
|
|
38
|
+
ref: `${tag ? "refs/tags/" : "refs/heads/"}${push.ref ?? ""}`,
|
|
39
|
+
refType: tag ? "tag" : "branch",
|
|
40
|
+
before: push.commit_from ?? void 0,
|
|
41
|
+
after: push.commit_to ?? void 0,
|
|
42
|
+
created: push.action === "created",
|
|
43
|
+
deleted: push.action === "removed",
|
|
44
|
+
commits: push.commit_to && push.commit_title ? [{
|
|
45
|
+
sha: push.commit_to,
|
|
46
|
+
message: push.commit_title
|
|
47
|
+
}] : [],
|
|
48
|
+
commitCount: push.commit_count
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const note = raw.note;
|
|
52
|
+
if (note) {
|
|
53
|
+
const kind = note.type === "DiffNote" || note.position ? "review_comment" : "comment";
|
|
54
|
+
if (note.noteable_type === "Commit") {
|
|
55
|
+
const commit = repo && note.commit_id ? {
|
|
56
|
+
forge: FORGE,
|
|
57
|
+
instance: repo.instance,
|
|
58
|
+
repo,
|
|
59
|
+
sha: note.commit_id
|
|
60
|
+
} : void 0;
|
|
61
|
+
return {
|
|
62
|
+
kind: "comment",
|
|
63
|
+
action: "created",
|
|
64
|
+
commit,
|
|
65
|
+
detail: {
|
|
66
|
+
type: "comment",
|
|
67
|
+
comment: commit && {
|
|
68
|
+
forge: "gitlab",
|
|
69
|
+
instance: commit.instance,
|
|
70
|
+
commit,
|
|
71
|
+
id: String(note.id)
|
|
72
|
+
},
|
|
73
|
+
body: note.body
|
|
74
|
+
},
|
|
75
|
+
summary: `${who} commented`
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const thread = feedThread(repo, note.noteable_type, note.noteable_iid);
|
|
79
|
+
return {
|
|
80
|
+
kind,
|
|
81
|
+
action: "created",
|
|
82
|
+
thread,
|
|
83
|
+
detail: {
|
|
84
|
+
type: kind,
|
|
85
|
+
comment: thread && {
|
|
86
|
+
forge: "gitlab",
|
|
87
|
+
instance: thread.instance,
|
|
88
|
+
thread,
|
|
89
|
+
id: String(note.id)
|
|
90
|
+
},
|
|
91
|
+
body: note.body
|
|
92
|
+
},
|
|
93
|
+
summary: `${who} commented`
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const thread = feedThread(repo, raw.target_type, raw.target_iid);
|
|
97
|
+
const noun = thread?.kind === "pull_request" ? "merge request" : "issue";
|
|
98
|
+
const state = FEED_STATES[raw.action_name];
|
|
99
|
+
if (thread && state) return {
|
|
100
|
+
kind: "state_change",
|
|
101
|
+
action: state.action,
|
|
102
|
+
thread,
|
|
103
|
+
detail: {
|
|
104
|
+
type: "state_change",
|
|
105
|
+
state: state.state
|
|
106
|
+
},
|
|
107
|
+
summary: `${who} ${state.action} ${noun}`
|
|
108
|
+
};
|
|
109
|
+
if (thread && raw.action_name === "approved") return {
|
|
110
|
+
kind: "review",
|
|
111
|
+
action: "submitted",
|
|
112
|
+
thread,
|
|
113
|
+
detail: {
|
|
114
|
+
type: "review",
|
|
115
|
+
state: "approved",
|
|
116
|
+
stateRaw: "approved",
|
|
117
|
+
review: {
|
|
118
|
+
forge: FORGE,
|
|
119
|
+
instance: thread.instance,
|
|
120
|
+
thread,
|
|
121
|
+
id: approvalId(raw.author ?? { username: raw.author_username })
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
summary: `${who} approved ${noun}`
|
|
125
|
+
};
|
|
126
|
+
if (raw.target_type === "Project" && (raw.action_name === "joined" || raw.action_name === "left")) return {
|
|
127
|
+
kind: "membership",
|
|
128
|
+
action: raw.action_name === "joined" ? "added" : "removed",
|
|
129
|
+
detail: {
|
|
130
|
+
type: "membership",
|
|
131
|
+
actionRaw: raw.action_name,
|
|
132
|
+
member: toActor(instance, raw.author)
|
|
133
|
+
},
|
|
134
|
+
summary: `${who} ${raw.action_name} the project`
|
|
135
|
+
};
|
|
136
|
+
if (raw.target_type === "Project" && (raw.action_name === "created" || raw.action_name === "deleted" || raw.action_name === "destroyed")) return {
|
|
137
|
+
kind: "repo",
|
|
138
|
+
action: raw.action_name === "created" ? "created" : "deleted",
|
|
139
|
+
summary: `${who} ${raw.action_name} the project`
|
|
140
|
+
};
|
|
141
|
+
if (raw.target_type === "WikiPage::Meta") {
|
|
142
|
+
const action = raw.action_name === "destroyed" ? "deleted" : eventAction(raw.action_name) ?? "other";
|
|
143
|
+
return {
|
|
144
|
+
kind: "wiki",
|
|
145
|
+
action,
|
|
146
|
+
detail: {
|
|
147
|
+
type: "wiki",
|
|
148
|
+
title: raw.target_title ?? void 0
|
|
149
|
+
},
|
|
150
|
+
summary: `${who} ${action} wiki page ${raw.target_title ?? ""}`.trim()
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
kind: "other",
|
|
155
|
+
thread,
|
|
156
|
+
summary: `${who} ${raw.action_name} ${raw.target_type ?? ""}`.trim()
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/** Normalises an item of a project's or a user's activity feed; `repo` is the project, where it is known. */
|
|
160
|
+
function toFeedEvent(instance, raw, repo) {
|
|
161
|
+
const actor = toActor(instance, raw.author);
|
|
162
|
+
const level = feedLevel(instance, raw, repo, actor?.login ?? raw.author_username ?? "someone");
|
|
163
|
+
return {
|
|
164
|
+
forge: FORGE,
|
|
165
|
+
instance,
|
|
166
|
+
id: String(raw.id),
|
|
167
|
+
kindRaw: [raw.target_type, raw.action_name].filter(Boolean).join("."),
|
|
168
|
+
actionRaw: raw.action_name,
|
|
169
|
+
...level,
|
|
170
|
+
...level.thread && raw.target_title ? { threadSnapshot: { title: raw.target_title } } : {},
|
|
171
|
+
...eventTime(toDate(raw.created_at)),
|
|
172
|
+
actor,
|
|
173
|
+
repo,
|
|
174
|
+
source: "poll",
|
|
175
|
+
payload: raw
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
export { toFeedEvent };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
+
import { t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
3
|
+
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-B7dmzDX3.js";
|
|
4
|
+
import { file } from "@vite-hub/source/file";
|
|
5
|
+
//#region src/sources/file.ts
|
|
6
|
+
var file_exports = /* @__PURE__ */ __exportAll({ file: () => file$1 });
|
|
7
|
+
function file$1(input) {
|
|
8
|
+
const options = typeof input === "string" ? { path: input } : input;
|
|
9
|
+
const workspacePath = ownSourceOption(options, "workspacePath") || ownSourceOption(options, "path") || "";
|
|
10
|
+
const key = normalizeSafeWorkspacePath(workspacePath);
|
|
11
|
+
const declaredMount = ownSourceOption(options, "mount");
|
|
12
|
+
const mount = typeof declaredMount === "object" && declaredMount && !Object.hasOwn(declaredMount, "path") ? {
|
|
13
|
+
...declaredMount,
|
|
14
|
+
path: ""
|
|
15
|
+
} : declaredMount ?? "";
|
|
16
|
+
const source = file(options);
|
|
17
|
+
return {
|
|
18
|
+
...withWorkspaceRuntimeOptions(source, {
|
|
19
|
+
...options,
|
|
20
|
+
mount
|
|
21
|
+
}),
|
|
22
|
+
probeKeys: ownSourceOption(options, "probeKeys") || [key]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { file_exports as n, file$1 as t };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { s as workspaceError } from "./path-DrSIenjj.js";
|
|
2
|
+
//#region src/core/file-metadata.ts
|
|
3
|
+
function copyJsonValue(value, ancestors, normalizeOptional = false) {
|
|
4
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
5
|
+
if (typeof value === "number" && Number.isFinite(value) && !Object.is(value, -0)) return value;
|
|
6
|
+
if (typeof value !== "object" || ancestors.has(value)) throw new Error("Invalid JSON metadata");
|
|
7
|
+
const array = Array.isArray(value);
|
|
8
|
+
const prototype = Object.getPrototypeOf(value);
|
|
9
|
+
if (!array && prototype !== Object.prototype && prototype !== null) throw new Error("Invalid JSON metadata");
|
|
10
|
+
ancestors.add(value);
|
|
11
|
+
try {
|
|
12
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
13
|
+
const keys = Reflect.ownKeys(descriptors).filter((key) => !array || key !== "length");
|
|
14
|
+
if (array && !normalizeOptional && keys.length !== descriptors.length?.value) throw new Error("Invalid JSON metadata");
|
|
15
|
+
const copy = array ? [] : {};
|
|
16
|
+
for (const [index, key] of keys.entries()) {
|
|
17
|
+
if (typeof key !== "string" || array && (normalizeOptional ? !/^(0|[1-9]\d*)$/.test(key) || Number(key) >= descriptors.length?.value : key !== String(index))) throw new Error("Invalid JSON metadata");
|
|
18
|
+
const descriptor = descriptors[key];
|
|
19
|
+
if (!descriptor.enumerable || !("value" in descriptor)) throw new Error("Invalid JSON metadata");
|
|
20
|
+
if (normalizeOptional && descriptor.value === void 0 && !array) continue;
|
|
21
|
+
Object.defineProperty(copy, key, {
|
|
22
|
+
value: normalizeOptional && descriptor.value === void 0 ? null : copyJsonValue(descriptor.value, ancestors, normalizeOptional),
|
|
23
|
+
enumerable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
configurable: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (array && normalizeOptional) {
|
|
29
|
+
for (let index = 0; index < descriptors.length?.value; index++) if (!Object.hasOwn(copy, index)) Object.defineProperty(copy, index, {
|
|
30
|
+
value: null,
|
|
31
|
+
enumerable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
configurable: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return copy;
|
|
37
|
+
} finally {
|
|
38
|
+
ancestors.delete(value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function copyJsonWorkspaceMetadata(path, metadata, normalizeOptional = false) {
|
|
42
|
+
if (metadata === void 0) return;
|
|
43
|
+
let copy;
|
|
44
|
+
try {
|
|
45
|
+
if (typeof metadata === "object" && metadata !== null && !Array.isArray(metadata)) copy = copyJsonValue(metadata, /* @__PURE__ */ new Set(), normalizeOptional);
|
|
46
|
+
} catch {}
|
|
47
|
+
if (!copy) throw workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. Metadata must contain only JSON-safe plain objects, dense arrays, strings, booleans, null, and finite numbers other than negative zero.`);
|
|
48
|
+
return copy;
|
|
49
|
+
}
|
|
50
|
+
function copyJsonFileMetadata(path, metadata, normalizeOptional = false) {
|
|
51
|
+
const copy = copyJsonWorkspaceMetadata(path, metadata, normalizeOptional);
|
|
52
|
+
if (!copy) return;
|
|
53
|
+
const source = Object.getOwnPropertyDescriptor(copy, "source");
|
|
54
|
+
if (source && typeof source.value !== "string") throw workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. metadata.source must be a string when provided.`);
|
|
55
|
+
return copy;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { copyJsonWorkspaceMetadata as n, copyJsonFileMetadata as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as normalizeWorkspacePath, o as matchesAny } from "./path-
|
|
2
|
-
import {
|
|
1
|
+
import { l as normalizeWorkspacePath, o as isWorkspaceBytes, s as matchesAny } from "./path-CNAwN7pw.js";
|
|
2
|
+
import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-B7dmzDX3.js";
|
|
3
3
|
//#region src/loaders/files.ts
|
|
4
4
|
function shouldLoad(path, options) {
|
|
5
5
|
if (options.include && !matchesAny(path, options.include)) return false;
|
|
@@ -30,7 +30,7 @@ function files(options = {}) {
|
|
|
30
30
|
if (!shouldLoad(rawPath, options)) continue;
|
|
31
31
|
const transformed = options.transform ? await options.transform(rawItem) : rawItem;
|
|
32
32
|
ctx.abortSignal?.throwIfAborted();
|
|
33
|
-
const item = typeof transformed === "string" || transformed
|
|
33
|
+
const item = typeof transformed === "string" || isWorkspaceBytes(transformed) ? {
|
|
34
34
|
...rawItem,
|
|
35
35
|
content: transformed
|
|
36
36
|
} : transformed;
|