@omercnet/paseo-fresh-worktrees 3.1.1-next.378.1 → 3.1.2-next.450.1
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/index.server.ts +6 -2
- package/package.json +3 -3
- package/server/fresh-worktrees.ts +6 -4
package/index.server.ts
CHANGED
|
@@ -9,19 +9,23 @@ import {
|
|
|
9
9
|
workspaceFreshness,
|
|
10
10
|
} from "./shared/workspace-freshness";
|
|
11
11
|
|
|
12
|
+
// Polls share one never-aborted signal so concurrent ones still dedupe;
|
|
13
|
+
// only a cancellable workspace.create signal runs a separate refresh.
|
|
14
|
+
const pollSignal = new AbortController().signal;
|
|
15
|
+
|
|
12
16
|
export default function contribute(server: PluginServerContext) {
|
|
13
17
|
const refreshRepository = createRepositoryRefreshCoordinator();
|
|
14
18
|
|
|
15
19
|
server.handle(workspaceFreshness, ({ projectRootPath, workspaceDirectory }) =>
|
|
16
20
|
inspectWorkspaceFreshness(projectRootPath, workspaceDirectory, {
|
|
17
|
-
signal:
|
|
21
|
+
signal: pollSignal,
|
|
18
22
|
refreshRepository,
|
|
19
23
|
}),
|
|
20
24
|
);
|
|
21
25
|
|
|
22
26
|
server.handle(refreshSourceBranchContract, ({ projectRootPath }) =>
|
|
23
27
|
refreshSourceBranch(projectRootPath, {
|
|
24
|
-
signal:
|
|
28
|
+
signal: pollSignal,
|
|
25
29
|
refreshRepository,
|
|
26
30
|
}),
|
|
27
31
|
);
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"icon.png",
|
|
35
35
|
"OVERVIEW.md"
|
|
36
36
|
],
|
|
37
|
-
"version": "3.1.
|
|
37
|
+
"version": "3.1.2-next.450.1",
|
|
38
38
|
"type": "module",
|
|
39
39
|
"packageManager": "bun@1.4.4",
|
|
40
40
|
"engines": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@biomejs/biome": "^2.5.10",
|
|
51
|
-
"@getpaseo/client": "0.15.0
|
|
52
|
-
"@getpaseo/plugin": "0.15.0
|
|
51
|
+
"@getpaseo/client": "0.15.0",
|
|
52
|
+
"@getpaseo/plugin": "0.15.0",
|
|
53
53
|
"@types/node": "^24.10.1",
|
|
54
54
|
"@types/react": "^19.2.18",
|
|
55
55
|
"react": "19.1.0",
|
|
@@ -69,12 +69,14 @@ export async function executeGit(
|
|
|
69
69
|
export function createRepositoryRefreshCoordinator(
|
|
70
70
|
runGit: GitRunner = executeGit,
|
|
71
71
|
): RepositoryRefresh {
|
|
72
|
-
const inFlight = new Map<string, Promise<RepositoryRefreshResult
|
|
72
|
+
const inFlight = new WeakMap<AbortSignal, Map<string, Promise<RepositoryRefreshResult>>>();
|
|
73
73
|
const repositoryTails = new Map<string, Promise<void>>();
|
|
74
74
|
|
|
75
75
|
return async (cwd, remote, localBranch, upstream, signal) => {
|
|
76
76
|
const targetKey = `${cwd}\0${remote}\0${localBranch ?? ""}\0${upstream ?? ""}`;
|
|
77
|
-
const
|
|
77
|
+
const signalRefreshes = inFlight.get(signal) ?? new Map();
|
|
78
|
+
inFlight.set(signal, signalRefreshes);
|
|
79
|
+
const existingRefresh = signalRefreshes.get(targetKey);
|
|
78
80
|
if (existingRefresh) return existingRefresh;
|
|
79
81
|
|
|
80
82
|
const previousRefresh = repositoryTails.get(cwd) ?? Promise.resolve();
|
|
@@ -119,13 +121,13 @@ export function createRepositoryRefreshCoordinator(
|
|
|
119
121
|
() => {},
|
|
120
122
|
() => {},
|
|
121
123
|
);
|
|
122
|
-
|
|
124
|
+
signalRefreshes.set(targetKey, refresh);
|
|
123
125
|
repositoryTails.set(cwd, tail);
|
|
124
126
|
|
|
125
127
|
try {
|
|
126
128
|
return await refresh;
|
|
127
129
|
} finally {
|
|
128
|
-
if (
|
|
130
|
+
if (signalRefreshes.get(targetKey) === refresh) signalRefreshes.delete(targetKey);
|
|
129
131
|
if (repositoryTails.get(cwd) === tail) repositoryTails.delete(cwd);
|
|
130
132
|
}
|
|
131
133
|
};
|