@evandu/super-pi 0.1.292 → 0.1.293
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/.super-pi-client-sources.json +9 -9
- package/dist/client/assets/{CodeMirrorEditor-O7UpftQ-.css → CodeMirrorEditor-7EW-C8kx.css} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BItIClMY.js → CodeMirrorEditor-CRYNvn14.js} +1 -1
- package/dist/client/assets/GitDiffEditor-WONJq3t4.js +29 -0
- package/dist/client/assets/index-B2HH9caF.css +1 -0
- package/dist/client/assets/{index-Cwt3-oUx.js → index-MxsSEfDh.js} +28 -28
- package/dist/client/index.html +2 -2
- package/dist/server/git.js +16 -3
- package/package.json +1 -1
- package/dist/.super-pi-check-inputs.json +0 -4
- package/dist/client/assets/GitDiffEditor-CgWWgUsi.js +0 -29
- package/dist/client/assets/index-C3aSjjM8.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<link rel="alternate icon" href="/favicon.ico" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/favicon.svg" />
|
|
10
10
|
<title>Super Pi</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-MxsSEfDh.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B2HH9caF.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
package/dist/server/git.js
CHANGED
|
@@ -86,9 +86,9 @@ function parseGitCommits(raw) {
|
|
|
86
86
|
}
|
|
87
87
|
const COMMIT_HASH = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i;
|
|
88
88
|
export async function gitGraph(root, limit, offset, snapshot, after, knownSnapshot = "") {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
return readGitGraph(root, limit, offset, snapshot, after, knownSnapshot, 1);
|
|
90
|
+
}
|
|
91
|
+
async function graphSnapshot(repo) {
|
|
92
92
|
const [refs, checkout] = await Promise.all([
|
|
93
93
|
git(repo, ["for-each-ref", "--format=%(refname)%00%(objectname)%00%(*objectname)%00%(symref)"], { maxBuffer: 32 * 1024 * 1024, timeout: 12_000 }),
|
|
94
94
|
gitWorktrees(repo),
|
|
@@ -96,6 +96,13 @@ export async function gitGraph(root, limit, offset, snapshot, after, knownSnapsh
|
|
|
96
96
|
const worktrees = checkout.worktrees.filter(entry => !entry.missing && COMMIT_HASH.test(entry.head) && !/^0+$/.test(entry.head));
|
|
97
97
|
const heads = worktrees.map(({ id, branch, head, current, name }) => ({ id, branch, head, current, name }));
|
|
98
98
|
const version = createHash("sha256").update(refs.stdout).update(JSON.stringify(heads)).digest("hex");
|
|
99
|
+
return { refs, worktrees, version };
|
|
100
|
+
}
|
|
101
|
+
async function readGitGraph(root, limit, offset, snapshot, after, knownSnapshot, retries) {
|
|
102
|
+
const size = pageNumber(limit, 50, 1, 100);
|
|
103
|
+
const start = pageNumber(offset, 0, 0, 2_147_483_647);
|
|
104
|
+
const repo = await worktreeRoot(root);
|
|
105
|
+
const { refs, worktrees, version } = await graphSnapshot(repo);
|
|
99
106
|
const changed = () => gitFailure("提交图已变化,请刷新后继续查看。", "graph_changed");
|
|
100
107
|
if (start && snapshot !== version)
|
|
101
108
|
throw changed();
|
|
@@ -134,6 +141,12 @@ export async function gitGraph(root, limit, offset, snapshot, after, knownSnapsh
|
|
|
134
141
|
const format = "--format=%H%x00%h%x00%P%x00%s%x00%an%x00%aI";
|
|
135
142
|
const { stdout } = await git(repo, ["-c", "log.showSignature=false", "log", "--all", "--topo-order", "--no-notes", "--no-decorate",
|
|
136
143
|
"--no-patch", "--encoding=UTF-8", "-z", `--skip=${start - overlap}`, `-${size + 1 + overlap}`, format, ...detached, "--"], { timeout: 12_000 });
|
|
144
|
+
// Git refs may change between separate commands; never cache a mixed snapshot.
|
|
145
|
+
if ((await graphSnapshot(repo)).version !== version) {
|
|
146
|
+
if (!start && retries > 0)
|
|
147
|
+
return readGitGraph(root, limit, offset, snapshot, after, knownSnapshot, retries - 1);
|
|
148
|
+
throw changed();
|
|
149
|
+
}
|
|
137
150
|
const parts = stdout.split("\0");
|
|
138
151
|
const commits = [];
|
|
139
152
|
for (let index = 0; index + 5 < parts.length; index += 6) {
|
package/package.json
CHANGED