cursedbelt 6.28.0 → 6.30.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/dist/react/canvas-hud/HudControls.d.ts +2 -0
- package/dist/react/canvas-hud/HudControls.d.ts.map +1 -1
- package/dist/react/canvas-hud/HudControls.js +3 -1
- package/dist/react/canvas-hud/HudControls.js.map +1 -1
- package/dist/react/components/ColorSwatches.d.ts.map +1 -1
- package/dist/react/components/ColorSwatches.js +1 -1
- package/dist/react/components/ColorSwatches.js.map +1 -1
- package/dist/react/components/DataTable/serverWindowWatch.d.ts +5 -4
- package/dist/react/components/DataTable/serverWindowWatch.d.ts.map +1 -1
- package/dist/react/components/DataTable/serverWindowWatch.js +7 -9
- package/dist/react/components/DataTable/serverWindowWatch.js.map +1 -1
- package/dist/react/components/ScrollArea.d.ts +9 -1
- package/dist/react/components/ScrollArea.d.ts.map +1 -1
- package/dist/react/components/ScrollArea.js +9 -3
- package/dist/react/components/ScrollArea.js.map +1 -1
- package/dist/react/components/TagsEditor.d.ts +12 -2
- package/dist/react/components/TagsEditor.d.ts.map +1 -1
- package/dist/react/components/TagsEditor.js +23 -8
- package/dist/react/components/TagsEditor.js.map +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/lib/keepAsking.d.ts +30 -0
- package/dist/react/lib/keepAsking.d.ts.map +1 -0
- package/dist/react/lib/keepAsking.js +57 -0
- package/dist/react/lib/keepAsking.js.map +1 -0
- package/dist/react/lib/tagList.d.ts +15 -0
- package/dist/react/lib/tagList.d.ts.map +1 -1
- package/dist/react/lib/tagList.js +29 -0
- package/dist/react/lib/tagList.js.map +1 -1
- package/dist/react/map-frame/MapFrame.d.ts +11 -1
- package/dist/react/map-frame/MapFrame.d.ts.map +1 -1
- package/dist/react/map-frame/MapFrame.js +25 -2
- package/dist/react/map-frame/MapFrame.js.map +1 -1
- package/dist/react/map-frame/geo.d.ts +27 -0
- package/dist/react/map-frame/geo.d.ts.map +1 -1
- package/dist/react/map-frame/geo.js +38 -0
- package/dist/react/map-frame/geo.js.map +1 -1
- package/dist/react/map-frame/index.d.ts +4 -4
- package/dist/react/map-frame/index.d.ts.map +1 -1
- package/dist/react/map-frame/index.js +2 -2
- package/dist/react/map-frame/index.js.map +1 -1
- package/dist/react/media/DenseGalleryShell.d.ts +7 -1
- package/dist/react/media/DenseGalleryShell.d.ts.map +1 -1
- package/dist/react/media/DenseGalleryShell.js +2 -2
- package/dist/react/media/DenseGalleryShell.js.map +1 -1
- package/dist/react/media-gallery/GalleryTable.d.ts +12 -1
- package/dist/react/media-gallery/GalleryTable.d.ts.map +1 -1
- package/dist/react/media-gallery/GalleryTable.js +37 -6
- package/dist/react/media-gallery/GalleryTable.js.map +1 -1
- package/dist/react/media-gallery/MediaGallery.d.ts +39 -3
- package/dist/react/media-gallery/MediaGallery.d.ts.map +1 -1
- package/dist/react/media-gallery/MediaGallery.js +122 -12
- package/dist/react/media-gallery/MediaGallery.js.map +1 -1
- package/dist/react/media-gallery/index.d.ts +1 -1
- package/dist/react/media-gallery/index.d.ts.map +1 -1
- package/dist/react/media-gallery/index.js.map +1 -1
- package/dist/react/media-gallery/mediaGallery.css +16 -0
- package/dist/react/usePrefixList.d.ts +82 -0
- package/dist/react/usePrefixList.d.ts.map +1 -0
- package/dist/react/usePrefixList.js +139 -0
- package/dist/react/usePrefixList.js.map +1 -0
- package/dist/styles-areas/core.css +8 -4
- package/dist/styles-utilities.css +18 -0
- package/dist/testing/shell.d.ts +1 -0
- package/dist/testing/shell.d.ts.map +1 -1
- package/dist/testing/shell.js +2 -0
- package/dist/testing/shell.js.map +1 -1
- package/package.json +9 -3
- package/scripts/build.spec.ts +39 -0
- package/scripts/build.ts +131 -0
- package/scripts/styleAreas.ts +2 -0
- package/src/buildIsStaged.spec.ts +57 -47
- package/src/react/canvas-hud/HudControls.spec.tsx +13 -1
- package/src/react/canvas-hud/HudControls.tsx +3 -1
- package/src/react/components/ColorSwatches.tsx +5 -1
- package/src/react/components/DataTable/serverWindowWatch.ts +8 -9
- package/src/react/components/ScrollArea.spec.tsx +25 -0
- package/src/react/components/ScrollArea.tsx +18 -1
- package/src/react/components/TagsEditor.spec.tsx +66 -0
- package/src/react/components/TagsEditor.tsx +31 -7
- package/src/react/index.ts +6 -0
- package/src/react/lib/keepAsking.spec.ts +89 -0
- package/src/react/lib/keepAsking.ts +63 -0
- package/src/react/lib/tagList.spec.ts +23 -1
- package/src/react/lib/tagList.ts +33 -0
- package/src/react/map-frame/MapFrame.tsx +33 -0
- package/src/react/map-frame/MapFrame.wheel.spec.tsx +69 -0
- package/src/react/map-frame/geo.spec.ts +32 -0
- package/src/react/map-frame/geo.ts +54 -0
- package/src/react/map-frame/index.ts +5 -2
- package/src/react/media/DenseGalleryShell.tsx +8 -0
- package/src/react/media-gallery/GalleryTable.tsx +54 -6
- package/src/react/media-gallery/MediaGallery.spec.tsx +61 -0
- package/src/react/media-gallery/MediaGallery.tsx +170 -12
- package/src/react/media-gallery/index.ts +1 -0
- package/src/react/media-gallery/mediaGallery.css +16 -0
- package/src/react/usePrefixList.spec.tsx +156 -0
- package/src/react/usePrefixList.ts +229 -0
- package/src/styles-areas/core.css +8 -4
- package/src/styles-utilities.css +18 -0
- package/src/stylesAreas.spec.ts +2 -1
- package/src/stylesStaticMatches.spec.ts +2 -3
- package/src/stylesUtilitiesMatches.spec.ts +2 -3
- package/src/testing/shell.ts +2 -0
- package/src/verifyGraph.spec.ts +22 -6
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { useQueries, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* How many pages the prefix asks for: enough to hold `need` items, at least one, never past the set's last page once
|
|
5
|
+
* its size is known.
|
|
6
|
+
*/
|
|
7
|
+
export function prefixPageCount(need, pageSize, total) {
|
|
8
|
+
const wanted = Math.max(1, Math.ceil(Math.max(0, need) / pageSize));
|
|
9
|
+
if (total === undefined)
|
|
10
|
+
return wanted;
|
|
11
|
+
return Math.max(1, Math.min(wanted, Math.ceil(total / pageSize)));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Which pages may fetch now: every page before the first one missing, and `inFlight` from it on — so a reach to item
|
|
15
|
+
* 4,000 fills the prefix four requests at a time rather than opening twenty at once.
|
|
16
|
+
*/
|
|
17
|
+
export function prefixEnabledThrough(loaded, inFlight) {
|
|
18
|
+
const missing = loaded.indexOf(false);
|
|
19
|
+
return missing < 0 ? loaded.length : missing + Math.max(1, inFlight);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The loaded pages from page 0, flattened, up to the first one not loaded — and the set's size.
|
|
23
|
+
*
|
|
24
|
+
* 🔴 The size is read off the LAST joined page as "how many come after it": `page.total - (offset + page.items.length)`.
|
|
25
|
+
* An optimistic delete takes a row out of one page and that page's `total` down by one, so each page's own `total`
|
|
26
|
+
* stops agreeing with the others; what lies past a page is the one number such an edit leaves alone, and the rows the
|
|
27
|
+
* edit removed are already out of `items.length`.
|
|
28
|
+
*/
|
|
29
|
+
export function joinPrefix(pages, pageSize, idOf) {
|
|
30
|
+
const items = [];
|
|
31
|
+
const seen = idOf ? new Set() : null;
|
|
32
|
+
let after;
|
|
33
|
+
for (let p = 0; p < pages.length; p++) {
|
|
34
|
+
const page = pages[p];
|
|
35
|
+
if (!page)
|
|
36
|
+
break;
|
|
37
|
+
for (const item of page.items) {
|
|
38
|
+
if (seen) {
|
|
39
|
+
const id = idOf?.(item);
|
|
40
|
+
if (seen.has(id))
|
|
41
|
+
continue;
|
|
42
|
+
seen.add(id);
|
|
43
|
+
}
|
|
44
|
+
items.push(item);
|
|
45
|
+
}
|
|
46
|
+
after = Math.max(0, page.total - (p * pageSize + page.items.length));
|
|
47
|
+
}
|
|
48
|
+
return { items, total: after === undefined ? undefined : items.length + after };
|
|
49
|
+
}
|
|
50
|
+
/** Where each listing's prefix reached when it was left — a return draws that much from the cache in its first frame. */
|
|
51
|
+
const remembered = new Map();
|
|
52
|
+
const REMEMBERED_MAX = 50;
|
|
53
|
+
function remember(key, need) {
|
|
54
|
+
remembered.delete(key);
|
|
55
|
+
remembered.set(key, need);
|
|
56
|
+
if (remembered.size > REMEMBERED_MAX)
|
|
57
|
+
remembered.delete(remembered.keys().next().value);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* An offset-paged list as a prefix that grows to wherever the reader reaches. Point it at `fetchRange(offset, limit)`
|
|
61
|
+
* and a `queryKey` that encodes the filters; render `items`, and hand `serverWindow` to `MediaGallery`.
|
|
62
|
+
*
|
|
63
|
+
* Requires `@tanstack/react-query` wrapped in a `QueryClientProvider`.
|
|
64
|
+
*/
|
|
65
|
+
export function usePrefixList({ queryKey, pageKey, fetchRange, pageSize = 200, inFlight = 4, idOf, enabled = true, staleTime, gcTime, }) {
|
|
66
|
+
const keyHash = JSON.stringify(queryKey);
|
|
67
|
+
const [state, setState] = useState(() => ({ key: keyHash, need: remembered.get(keyHash) ?? pageSize }));
|
|
68
|
+
// A new listing starts where it was last left, or at one page — in THIS render, so no frame asks for the old reach.
|
|
69
|
+
const need = state.key === keyHash ? state.need : (remembered.get(keyHash) ?? pageSize);
|
|
70
|
+
if (state.key !== keyHash)
|
|
71
|
+
setState({ key: keyHash, need });
|
|
72
|
+
const fetchRef = useRef(fetchRange);
|
|
73
|
+
fetchRef.current = fetchRange;
|
|
74
|
+
const keyOf = (offset, limit) => (pageKey ? pageKey(offset, limit) : [...queryKey, 'prefix', limit, offset]);
|
|
75
|
+
// The set's size, as last known for THIS listing: what caps the pages asked for.
|
|
76
|
+
const knownTotal = useRef(null);
|
|
77
|
+
const capTotal = knownTotal.current?.key === keyHash ? knownTotal.current.total : undefined;
|
|
78
|
+
const count = prefixPageCount(need, pageSize, capTotal);
|
|
79
|
+
// Which pages are in hand, read off the cache itself — a page cached from an earlier visit counts at once, so a
|
|
80
|
+
// return to a long prefix opens the next requests in the same render instead of waiting for one to land.
|
|
81
|
+
const client = useQueryClient();
|
|
82
|
+
const through = prefixEnabledThrough(Array.from({ length: count }, (_, p) => client.getQueryState(keyOf(p * pageSize, pageSize))?.data !== undefined), inFlight);
|
|
83
|
+
const results = useQueries({
|
|
84
|
+
queries: Array.from({ length: count }, (_, p) => ({
|
|
85
|
+
queryKey: keyOf(p * pageSize, pageSize),
|
|
86
|
+
queryFn: () => fetchRef.current(p * pageSize, pageSize),
|
|
87
|
+
enabled: enabled && p < through,
|
|
88
|
+
staleTime,
|
|
89
|
+
gcTime,
|
|
90
|
+
})),
|
|
91
|
+
});
|
|
92
|
+
const pages = results.map((r) => r.data);
|
|
93
|
+
// Kept while every page is the same object — TanStack keeps a page's data stable while it is unchanged — so `items`
|
|
94
|
+
// is the same array until a page changes, and safe as a consumer's memo dependency.
|
|
95
|
+
const joinedRef = useRef(null);
|
|
96
|
+
const kept = joinedRef.current;
|
|
97
|
+
const same = kept !== null && kept.pages.length === pages.length && kept.pages.every((page, i) => page === pages[i]);
|
|
98
|
+
const joined = same && kept ? kept.joined : joinPrefix(pages, pageSize, idOf);
|
|
99
|
+
if (!same)
|
|
100
|
+
joinedRef.current = { pages, joined };
|
|
101
|
+
const total = joined.total;
|
|
102
|
+
if (total !== undefined)
|
|
103
|
+
knownTotal.current = { key: keyHash, total: Math.max(total, ...pages.map((page) => page?.total ?? 0)) };
|
|
104
|
+
const live = useRef({ keyHash, need, results, total, loaded: joined.items.length });
|
|
105
|
+
live.current = { keyHash, need, results, total, loaded: joined.items.length };
|
|
106
|
+
const needThrough = useCallback((end) => {
|
|
107
|
+
const now = live.current;
|
|
108
|
+
const capped = now.total === undefined ? end : Math.min(end, now.total);
|
|
109
|
+
if (capped <= now.need) {
|
|
110
|
+
// Asked again for what is already wanted: a page that failed is fetched again; one in flight answers it.
|
|
111
|
+
if (capped > now.loaded)
|
|
112
|
+
for (const r of now.results)
|
|
113
|
+
if (r.isError && !r.isFetching)
|
|
114
|
+
void r.refetch();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
remember(now.keyHash, capped);
|
|
118
|
+
setState({ key: now.keyHash, need: capped });
|
|
119
|
+
}, []);
|
|
120
|
+
const serverWindow = useMemo(() => ({ total: total ?? 0, onNeedThrough: needThrough }), [total, needThrough]);
|
|
121
|
+
const firstError = results.find((r) => r.isError);
|
|
122
|
+
return {
|
|
123
|
+
items: joined.items,
|
|
124
|
+
total,
|
|
125
|
+
isLoading: total === undefined && results.some((r) => r.isLoading),
|
|
126
|
+
isFetching: results.some((r) => r.isFetching),
|
|
127
|
+
isLoadingError: results.some((r) => r.isLoadingError),
|
|
128
|
+
isRefetchError: results.some((r) => r.isRefetchError),
|
|
129
|
+
error: firstError?.error ?? null,
|
|
130
|
+
needThrough,
|
|
131
|
+
serverWindow,
|
|
132
|
+
refetch: () => {
|
|
133
|
+
for (const r of live.current.results)
|
|
134
|
+
if (r.data !== undefined || r.isError)
|
|
135
|
+
void r.refetch();
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=usePrefixList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrefixList.js","sourceRoot":"","sources":["../../src/react/usePrefixList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAyE/D;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,QAAgB,EAAE,KAAyB;IACvF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,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app that imports every area gets exactly
|
|
16
16
|
* what `cursedbelt/styles-utilities.css` emits — proved rule by rule in
|
|
17
17
|
* src/stylesAreas.spec.ts, which is also what fails when this file is stale.
|
|
18
|
-
*
|
|
18
|
+
* 1033 candidate(s).
|
|
19
19
|
*
|
|
20
20
|
* Written by scripts/generateAreaStyles.ts (`bun run styles:areas`), which
|
|
21
21
|
* `bun run build` runs. The map of what is in which area, and why the areas are
|
|
@@ -153,9 +153,12 @@
|
|
|
153
153
|
@source inline("lead leading leading-4 leading-5 leading-none leading-relaxed leading-snug leading-tight left");
|
|
154
154
|
@source inline("left-0 left-1/2 left-2 left-3 lg lg:px-8 line line-clamp-2 lo low lower lowercase m m-0 max");
|
|
155
155
|
@source inline("max-h max-h-64 max-h-[80vh] max-h-[calc(var(--radix-popper-available-height,100dvh)-1rem)]");
|
|
156
|
-
@source inline("max-h-[var(--
|
|
157
|
-
@source inline("max-h-[
|
|
158
|
-
@source inline("max-
|
|
156
|
+
@source inline("max-h-[min(var(--region-h-lg),var(--region-h-phone))]");
|
|
157
|
+
@source inline("max-h-[min(var(--region-h-md),var(--region-h-phone))]");
|
|
158
|
+
@source inline("max-h-[min(var(--region-h-sm),var(--region-h-phone))] max-h-[var(--guide-popover-max-h)]");
|
|
159
|
+
@source inline("max-h-[var(--radix-select-content-available-height)] max-h-[var(--sheet-h-lg)]");
|
|
160
|
+
@source inline("max-h-[var(--sheet-h-md)] max-h-[var(--sheet-h-sm)] max-sm:border-b-0 max-sm:border-x-0");
|
|
161
|
+
@source inline("max-sm:bottom-0 max-sm:data-[state=closed]:slide-out-to-bottom");
|
|
159
162
|
@source inline("max-sm:data-[state=open]:slide-in-from-bottom max-sm:h-dvh max-sm:hidden max-sm:inset-x-0");
|
|
160
163
|
@source inline("max-sm:max-h-[var(--sheet-h-phone)] max-sm:max-h-dvh max-sm:max-w-none max-sm:pt-6");
|
|
161
164
|
@source inline("max-sm:rounded-b-none max-sm:rounded-none max-sm:rounded-t-2xl max-sm:sr-only max-sm:touch-none");
|
|
@@ -193,6 +196,7 @@
|
|
|
193
196
|
@source inline("sm:-translate-x-1/2 sm:-translate-y-1/2 sm:basis-auto sm:block sm:flex-nowrap");
|
|
194
197
|
@source inline("sm:h-[var(--region-h-lg)] sm:h-[var(--region-h-md)] sm:h-[var(--region-h-sm)] sm:hidden");
|
|
195
198
|
@source inline("sm:left-1/2 sm:max-h-[calc(100dvh-2rem)] sm:max-h-[min(90dvh,calc(100dvh-2rem))]");
|
|
199
|
+
@source inline("sm:max-h-[var(--region-h-lg)] sm:max-h-[var(--region-h-md)] sm:max-h-[var(--region-h-sm)]");
|
|
196
200
|
@source inline("sm:max-w-[calc(100vw-2rem)] sm:max-w-[var(--modal-w-lg)] sm:max-w-[var(--modal-w-md)]");
|
|
197
201
|
@source inline("sm:max-w-[var(--modal-w-sm)] sm:order-2 sm:order-4 sm:p-4 sm:p-5 sm:p-8 sm:pointer-fine:text-sm");
|
|
198
202
|
@source inline("sm:px-6 sm:rounded-xl sm:text-sm sm:top-1/2 sm:w-[calc(100vw-2rem)] space space-y-1 space-y-3");
|
|
@@ -875,6 +875,15 @@
|
|
|
875
875
|
.max-h-\[inherit\] {
|
|
876
876
|
max-height: inherit;
|
|
877
877
|
}
|
|
878
|
+
.max-h-\[min\(var\(--region-h-lg\)\,var\(--region-h-phone\)\)\] {
|
|
879
|
+
max-height: min(var(--region-h-lg), var(--region-h-phone));
|
|
880
|
+
}
|
|
881
|
+
.max-h-\[min\(var\(--region-h-md\)\,var\(--region-h-phone\)\)\] {
|
|
882
|
+
max-height: min(var(--region-h-md), var(--region-h-phone));
|
|
883
|
+
}
|
|
884
|
+
.max-h-\[min\(var\(--region-h-sm\)\,var\(--region-h-phone\)\)\] {
|
|
885
|
+
max-height: min(var(--region-h-sm), var(--region-h-phone));
|
|
886
|
+
}
|
|
878
887
|
.max-h-\[var\(--guide-popover-max-h\)\] {
|
|
879
888
|
max-height: var(--guide-popover-max-h);
|
|
880
889
|
}
|
|
@@ -5028,6 +5037,15 @@
|
|
|
5028
5037
|
.sm\:max-h-\[min\(90dvh\,calc\(100dvh-2rem\)\)\] {
|
|
5029
5038
|
max-height: min(90dvh, calc(100dvh - 2rem));
|
|
5030
5039
|
}
|
|
5040
|
+
.sm\:max-h-\[var\(--region-h-lg\)\] {
|
|
5041
|
+
max-height: var(--region-h-lg);
|
|
5042
|
+
}
|
|
5043
|
+
.sm\:max-h-\[var\(--region-h-md\)\] {
|
|
5044
|
+
max-height: var(--region-h-md);
|
|
5045
|
+
}
|
|
5046
|
+
.sm\:max-h-\[var\(--region-h-sm\)\] {
|
|
5047
|
+
max-height: var(--region-h-sm);
|
|
5048
|
+
}
|
|
5031
5049
|
.sm\:min-h-0 {
|
|
5032
5050
|
min-height: 0px;
|
|
5033
5051
|
}
|
package/dist/testing/shell.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export declare const BELT: {
|
|
|
92
92
|
readonly tableScroll: "[data-cb-table-scroll]";
|
|
93
93
|
readonly fastScroller: "[data-cb-fast-scroller]";
|
|
94
94
|
readonly fastScrollBubble: "[data-cb-fast-scroll-bubble]";
|
|
95
|
+
readonly gridPlaceholder: "[data-cb-grid-placeholder]";
|
|
95
96
|
readonly tableList: "[data-cb-table-list]";
|
|
96
97
|
readonly tableListHeader: "[data-cb-table-list-header]";
|
|
97
98
|
readonly tableSelectAll: "[data-cb-table-select-all]";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/testing/shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/testing/shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFP,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,IAAI,CAAC;AAEzC,4FAA4F;AAC5F,eAAO,MAAM,WAAW;;;;;IAKvB,0GAA0G;;;;IAI1G,4EAA4E;;;;CAInE,CAAC;AAEX,gHAAgH;AAChH,wBAAgB,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAE9D;AAED,sGAAsG;AACtG,MAAM,WAAW,OAAO,CAAC,CAAC;IACzB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC;CAC7B;AAED,kEAAkE;AAClE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC,uBAAuB;;IAEvB,uDAAuD;;IAEvD,wDAAwD;;IAExD,2DAA2D;gBAC/C,MAAM;IAClB,mDAAmD;;IAEnD,+BAA+B;;IAE/B,gDAAgD;;IAEhD,gDAAgD;;IAEhD,gFAAgF;4BACxD,kBAAkB;IAC1C,+EAA+E;;IAE/E,6BAA6B;;IAE7B,4EAA4E;;;;IAI5E,oCAAoC;;IAEpC,wGAAwG;;;;;IAKxG,4BAA4B;;EAG7B"}
|
package/dist/testing/shell.js
CHANGED
|
@@ -99,6 +99,8 @@ export const BELT = {
|
|
|
99
99
|
// The fast scroller a finger drags through a long list (`FastScroller`); `data-shown` while it is up.
|
|
100
100
|
fastScroller: '[data-cb-fast-scroller]',
|
|
101
101
|
fastScrollBubble: '[data-cb-fast-scroll-bubble]',
|
|
102
|
+
// A card a server window has not loaded yet (`VirtualCardGrid` under `serverWindow`) — none once the window reaches it.
|
|
103
|
+
gridPlaceholder: '[data-cb-grid-placeholder]',
|
|
102
104
|
tableList: '[data-cb-table-list]',
|
|
103
105
|
tableListHeader: '[data-cb-table-list-header]',
|
|
104
106
|
tableSelectAll: '[data-cb-table-select-all]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/testing/shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IACnB,+CAA+C;IAC/C,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE,qBAAqB;IAC/B,aAAa,EAAE,0BAA0B;IACzC,KAAK,EAAE,iBAAiB;IACxB,YAAY,EAAE,yBAAyB;IACvC,WAAW,EAAE,wBAAwB;IACrC,GAAG,EAAE,eAAe;IACpB,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,sBAAsB;IACjC,YAAY,EAAE,yBAAyB;IACvC,SAAS,EAAE,sBAAsB;IACjC,aAAa,EAAE,0BAA0B;IACzC,SAAS,EAAE,sBAAsB;IACjC,kBAAkB,EAAE,+BAA+B;IACnD,QAAQ,EAAE,oBAAoB;IAC9B,aAAa,EAAE,0BAA0B;IACzC,cAAc,EAAE,2BAA2B;IAC3C,aAAa,EAAE,0BAA0B;IACzC,MAAM,EAAE,kBAAkB;IAC1B,OAAO,EAAE,oBAAoB;IAC7B,UAAU,EAAE,uBAAuB;IACnC,UAAU,EAAE,uBAAuB;IACnC,aAAa,EAAE,0BAA0B;IACzC,oBAAoB,EAAE,kCAAkC;IACxD,mBAAmB,EAAE,iCAAiC;IACtD,YAAY;IACZ,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,sBAAsB;IACjC,WAAW,EAAE,wBAAwB;IACrC,aAAa,EAAE,0BAA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AAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QACnC,4BAA4B;QAC5B,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;KACzC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursedbelt",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.30.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "The React design system of the cursedbelt split — components, styles, theme. cursedbelt-core below it; server tier in cursedbelt-server.",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"demo:build": "vite build --config demo/vite.config.ts",
|
|
90
90
|
"demo:serve": "bun run demo:build && bun run demo:serve:built",
|
|
91
91
|
"demo:serve:built": "bun run scripts/demoServer.ts",
|
|
92
|
-
"build": "
|
|
92
|
+
"build": "bun run scripts/build.ts",
|
|
93
93
|
"e2e": "playwright test --config e2e/playwright.config.ts",
|
|
94
94
|
"safari": "bun scripts/safari.ts",
|
|
95
95
|
"test:browser:smoke": "playwright test --config e2e/playwright.config.ts smoke.spec.ts --project=chromium",
|
|
@@ -519,6 +519,12 @@
|
|
|
519
519
|
"source": "./src/react/back/index.ts",
|
|
520
520
|
"import": "./dist/react/back/index.js"
|
|
521
521
|
},
|
|
522
|
+
"./react/keep-asking": {
|
|
523
|
+
"types": "./dist/react/lib/keepAsking.d.ts",
|
|
524
|
+
"bun": "./src/react/lib/keepAsking.ts",
|
|
525
|
+
"source": "./src/react/lib/keepAsking.ts",
|
|
526
|
+
"import": "./dist/react/lib/keepAsking.js"
|
|
527
|
+
},
|
|
522
528
|
"./react/intersection-observer": {
|
|
523
529
|
"types": "./dist/react/hooks/useIntersectionObserver.d.ts",
|
|
524
530
|
"bun": "./src/react/hooks/useIntersectionObserver.ts",
|
|
@@ -984,7 +990,7 @@
|
|
|
984
990
|
"@types/react-dom": "^19.2.3",
|
|
985
991
|
"@vidstack/react": "1.15.6",
|
|
986
992
|
"@vitejs/plugin-react": "^5.2.0",
|
|
987
|
-
"cursedbelt-server": "^4.
|
|
993
|
+
"cursedbelt-server": "^4.78.0",
|
|
988
994
|
"cursedops": "^0.36.1",
|
|
989
995
|
"diff": "^9.0.0",
|
|
990
996
|
"emoji-mart": "^5.6.0",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { afterAll, describe, expect, test } from 'bun:test';
|
|
2
|
+
import { existsSync, mkdtempSync, readdirSync, rmSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
|
|
6
|
+
const BUILD = join(import.meta.dir, 'build.ts');
|
|
7
|
+
const FILES = 15;
|
|
8
|
+
|
|
9
|
+
/** A stand-in for the real steps with the same shape: it writes into `dist.next` a file at a time. */
|
|
10
|
+
const SLOW_STEP = {
|
|
11
|
+
cmd: ['sh', '-c', `set -e; mkdir -p dist.next; for i in $(seq 1 ${FILES}); do echo $i > dist.next/f$i; sleep 0.02; done`],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const dirs: string[] = [];
|
|
15
|
+
afterAll(() => {
|
|
16
|
+
for (const dir of dirs) rmSync(dir, { recursive: true, force: true });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
async function buildIn(cwd: string): Promise<number> {
|
|
20
|
+
const code = `import { build } from ${JSON.stringify(BUILD)};
|
|
21
|
+
process.exit(await build(${JSON.stringify(cwd)}, [${JSON.stringify(SLOW_STEP)}]));`;
|
|
22
|
+
const child = Bun.spawn(['bun', '-e', code], { cwd, stdio: ['ignore', 'ignore', 'pipe'] });
|
|
23
|
+
return await child.exited;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('build', () => {
|
|
27
|
+
// Forge task 5806: the suite job, a publish and lib-preview build in one checkout, and the second
|
|
28
|
+
// build's `rm -rf dist.next dist.prev` ran while the first was still writing into them.
|
|
29
|
+
test('three builds started at once all exit 0 and leave one complete dist', async () => {
|
|
30
|
+
const cwd = mkdtempSync(join(tmpdir(), 'belt-build-'));
|
|
31
|
+
dirs.push(cwd);
|
|
32
|
+
const codes = await Promise.all([buildIn(cwd), buildIn(cwd), buildIn(cwd)]);
|
|
33
|
+
expect(codes).toEqual([0, 0, 0]);
|
|
34
|
+
expect(readdirSync(join(cwd, 'dist')).length).toBe(FILES);
|
|
35
|
+
expect(existsSync(join(cwd, 'dist.next'))).toBe(false);
|
|
36
|
+
expect(existsSync(join(cwd, 'dist.prev'))).toBe(false);
|
|
37
|
+
expect(existsSync(join(cwd, '.build.lock'))).toBe(false);
|
|
38
|
+
}, 30_000);
|
|
39
|
+
});
|
package/scripts/build.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `bun run build` — cursedbelt's `dist`, compiled into a staging directory (`dist.next`) and
|
|
3
|
+
* swapped in whole, so a consumer reading `dist` never sees half a build.
|
|
4
|
+
*
|
|
5
|
+
* ## Builds in one checkout take turns (forge task 5806)
|
|
6
|
+
*
|
|
7
|
+
* The staging names are fixed, and the suite job, the publish job and `tools/lib-preview.ts` all build
|
|
8
|
+
* in the same checkout. Two at once read `rm: dist.prev: Directory not empty` (2026-11-23 ~10:40Z):
|
|
9
|
+
* build B's first `rm` ran while build A was writing into `dist.next`. Per-build staging names would
|
|
10
|
+
* not cure it — two swaps still race on `dist` itself, and every build rewrites the generated
|
|
11
|
+
* stylesheets under `src/` — so a second build WAITS for the first: `.build.lock`, a directory
|
|
12
|
+
* (`mkdir` is atomic) holding its owner's pid. A lock whose owner is dead, or one older than
|
|
13
|
+
* {@link STALE_MS} with no owner written, is taken over.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
|
|
18
|
+
export interface BuildStep {
|
|
19
|
+
readonly cmd: readonly string[];
|
|
20
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const STAGE = 'dist.next';
|
|
24
|
+
|
|
25
|
+
/** The real build's steps, in order. Each writes into `dist.next` (or the generated sources). */
|
|
26
|
+
export const BUILD_STEPS: readonly BuildStep[] = [
|
|
27
|
+
{ cmd: ['bun', 'run', 'scripts/generateStaticStyles.ts'] },
|
|
28
|
+
{ cmd: ['bun', 'run', 'scripts/generateUtilityStyles.ts'] },
|
|
29
|
+
{ cmd: ['bun', 'run', 'scripts/generateAreaStyles.ts'] },
|
|
30
|
+
{ cmd: ['tsc', '--project', 'tsconfig.build.json', '--outDir', STAGE] },
|
|
31
|
+
{ cmd: ['tsc', '--project', 'tsconfig.scripts.build.json', '--outDir', `${STAGE}/scripts`] },
|
|
32
|
+
{ cmd: ['bun', 'run', 'scripts/copyDistAssets.ts'], env: { CURSEDBELT_DIST_DIR: STAGE } },
|
|
33
|
+
{ cmd: ['bun', 'run', 'scripts/checkDistExports.ts'], env: { CURSEDBELT_DIST_DIR: STAGE } },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
async function run(cwd: string, step: BuildStep): Promise<number> {
|
|
37
|
+
const child = Bun.spawn([...step.cmd], {
|
|
38
|
+
cwd,
|
|
39
|
+
env: { ...process.env, ...step.env },
|
|
40
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
41
|
+
});
|
|
42
|
+
return await child.exited;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const LOCK = '.build.lock';
|
|
46
|
+
/** A lock with no owner file this old is a build that died between `mkdir` and writing its pid. */
|
|
47
|
+
const STALE_MS = 10 * 60_000;
|
|
48
|
+
/** Longer than any build has taken; past it the wait fails loudly instead of hanging a job. */
|
|
49
|
+
const WAIT_MS = 20 * 60_000;
|
|
50
|
+
|
|
51
|
+
function ownerAlive(lock: string): boolean {
|
|
52
|
+
let pid: number;
|
|
53
|
+
try {
|
|
54
|
+
pid = Number(readFileSync(join(lock, 'owner'), 'utf8'));
|
|
55
|
+
} catch {
|
|
56
|
+
try {
|
|
57
|
+
return Date.now() - statSync(lock).mtimeMs < STALE_MS;
|
|
58
|
+
} catch {
|
|
59
|
+
return false; // released while we looked
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
process.kill(pid, 0);
|
|
64
|
+
return true;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
return (error as NodeJS.ErrnoException).code === 'EPERM';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Takes `<cwd>/.build.lock`, waiting while a live build holds it. Resolves to its release. */
|
|
71
|
+
export async function takeBuildLock(cwd: string): Promise<() => void> {
|
|
72
|
+
const lock = join(cwd, LOCK);
|
|
73
|
+
const until = Date.now() + WAIT_MS;
|
|
74
|
+
let said = false;
|
|
75
|
+
for (;;) {
|
|
76
|
+
try {
|
|
77
|
+
mkdirSync(lock);
|
|
78
|
+
writeFileSync(join(lock, 'owner'), String(process.pid));
|
|
79
|
+
return () => rmSync(lock, { recursive: true, force: true });
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error;
|
|
82
|
+
}
|
|
83
|
+
if (!ownerAlive(lock)) {
|
|
84
|
+
// Renamed aside first: of two waiters that both found it dead, one rename wins.
|
|
85
|
+
const aside = `${lock}.stale.${process.pid}`;
|
|
86
|
+
try {
|
|
87
|
+
renameSync(lock, aside);
|
|
88
|
+
rmSync(aside, { recursive: true, force: true });
|
|
89
|
+
} catch {}
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (Date.now() > until) throw new Error(`build: ${lock} is still held after ${WAIT_MS / 60_000} min`);
|
|
93
|
+
if (!said) console.error(`⏳ build: another build holds ${lock} — waiting for it`);
|
|
94
|
+
said = true;
|
|
95
|
+
await Bun.sleep(200);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Runs `steps` into `<cwd>/dist.next`, then swaps it in for `<cwd>/dist` — under the build lock.
|
|
101
|
+
* Resolves to the exit code.
|
|
102
|
+
*/
|
|
103
|
+
export async function build(cwd: string, steps: readonly BuildStep[] = BUILD_STEPS): Promise<number> {
|
|
104
|
+
const release = await takeBuildLock(cwd);
|
|
105
|
+
try {
|
|
106
|
+
return await buildUnlocked(cwd, steps);
|
|
107
|
+
} finally {
|
|
108
|
+
release();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function buildUnlocked(cwd: string, steps: readonly BuildStep[]): Promise<number> {
|
|
113
|
+
const next = join(cwd, STAGE);
|
|
114
|
+
const prev = join(cwd, 'dist.prev');
|
|
115
|
+
const dist = join(cwd, 'dist');
|
|
116
|
+
rmSync(next, { recursive: true, force: true });
|
|
117
|
+
rmSync(prev, { recursive: true, force: true });
|
|
118
|
+
for (const step of steps) {
|
|
119
|
+
const code = await run(cwd, step);
|
|
120
|
+
if (code !== 0) {
|
|
121
|
+
console.error(`✗ build: \`${step.cmd.join(' ')}\` exited ${code}`);
|
|
122
|
+
return code;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (existsSync(dist)) renameSync(dist, prev);
|
|
126
|
+
renameSync(next, dist);
|
|
127
|
+
rmSync(prev, { recursive: true, force: true });
|
|
128
|
+
return 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (import.meta.main) process.exit(await build(process.cwd()));
|
package/scripts/styleAreas.ts
CHANGED
|
@@ -127,6 +127,8 @@ export const AREAS: readonly Area[] = [
|
|
|
127
127
|
'usePagedList.ts',
|
|
128
128
|
// Draws nothing either: the window `VirtualCardGrid` and `DataTable` take as `serverWindow` (forge task 5691).
|
|
129
129
|
'useWindowedList.ts',
|
|
130
|
+
// Draws nothing: the prefix `MediaGallery` takes as `serverWindow` (forge task 5701).
|
|
131
|
+
'usePrefixList.ts',
|
|
130
132
|
'lazy',
|
|
131
133
|
'confirm.tsx',
|
|
132
134
|
'prompt.tsx',
|
|
@@ -19,67 +19,77 @@
|
|
|
19
19
|
* no dist is a `mv` rather than a compile, and a build that fails on somebody's WIP
|
|
20
20
|
* leaves the previous `dist` untouched — which is the property that was missing.
|
|
21
21
|
*
|
|
22
|
-
* ──
|
|
23
|
-
* The
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
22
|
+
* ── What is checked, and how ──────────────────────────────────────────────────
|
|
23
|
+
* The build is `scripts/build.ts` (forge task 5806), so the property is checked as
|
|
24
|
+
* BEHAVIOR: `build()` run over stand-in steps in a temp directory — a failing step
|
|
25
|
+
* must leave the previous `dist` whole, and a passing one must swap the staged tree
|
|
26
|
+
* in. The real step list, `BUILD_STEPS`, is read for what the stand-ins cannot show:
|
|
27
|
+
* every compiler and the asset copy aim at the staging directory.
|
|
28
28
|
*/
|
|
29
29
|
import { describe, expect, test } from 'bun:test'
|
|
30
|
-
import { readFileSync } from 'node:fs'
|
|
30
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
31
|
+
import { tmpdir } from 'node:os'
|
|
32
|
+
import { join } from 'node:path'
|
|
33
|
+
import { BUILD_STEPS, build, type BuildStep } from '../scripts/build.js'
|
|
31
34
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const STAGE = 'dist.next'
|
|
36
|
+
|
|
37
|
+
/** A temp checkout holding a previous `dist` with one file in it. */
|
|
38
|
+
function checkout(): string {
|
|
39
|
+
const cwd = mkdtempSync(join(tmpdir(), 'cb-staged-'))
|
|
40
|
+
mkdirSync(join(cwd, 'dist'))
|
|
41
|
+
writeFileSync(join(cwd, 'dist', 'old.js'), 'old')
|
|
42
|
+
return cwd
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const writes = (file: string): BuildStep => ({
|
|
46
|
+
cmd: ['sh', '-c', `mkdir -p ${STAGE} && echo new > ${STAGE}/${file}`],
|
|
47
|
+
})
|
|
35
48
|
|
|
36
49
|
describe('the build is staged, not destructive-then-verify', () => {
|
|
37
|
-
|
|
50
|
+
test('a step that fails leaves the previous dist whole — nothing removes it before the compilers have run', async () => {
|
|
51
|
+
const cwd = checkout()
|
|
52
|
+
try {
|
|
53
|
+
const code = await build(cwd, [writes('half.js'), { cmd: ['sh', '-c', 'exit 3'] }])
|
|
54
|
+
expect(code).toBe(3)
|
|
55
|
+
expect(readFileSync(join(cwd, 'dist', 'old.js'), 'utf8')).toBe('old') // reads-other-dist: the temp checkout's
|
|
56
|
+
expect(existsSync(join(cwd, 'dist', 'half.js'))).toBe(false) // reads-other-dist: the temp checkout's
|
|
57
|
+
} finally {
|
|
58
|
+
rmSync(cwd, { recursive: true, force: true })
|
|
59
|
+
}
|
|
60
|
+
})
|
|
38
61
|
|
|
39
|
-
test('
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"in the reader's own diff. Stage into dist.next and swap.",
|
|
52
|
-
).toBe(false)
|
|
53
|
-
expect(firstRm === -1 || firstRm > firstTsc || build.startsWith('rm -rf dist.next')).toBe(
|
|
54
|
-
true,
|
|
55
|
-
)
|
|
62
|
+
test('the swap happens, and only after every step', async () => {
|
|
63
|
+
const cwd = checkout()
|
|
64
|
+
try {
|
|
65
|
+
expect(await build(cwd, [writes('a.js'), writes('b.js')])).toBe(0)
|
|
66
|
+
expect(existsSync(join(cwd, 'dist', 'a.js'))).toBe(true) // reads-other-dist: the temp checkout's
|
|
67
|
+
expect(existsSync(join(cwd, 'dist', 'b.js'))).toBe(true) // reads-other-dist: the temp checkout's
|
|
68
|
+
expect(existsSync(join(cwd, 'dist', 'old.js'))).toBe(false) // reads-other-dist: the temp checkout's
|
|
69
|
+
expect(existsSync(join(cwd, STAGE))).toBe(false)
|
|
70
|
+
expect(existsSync(join(cwd, 'dist.prev'))).toBe(false) // reads-other-dist: the temp checkout's
|
|
71
|
+
} finally {
|
|
72
|
+
rmSync(cwd, { recursive: true, force: true })
|
|
73
|
+
}
|
|
56
74
|
})
|
|
57
75
|
|
|
58
76
|
test('the compilers emit into the staging directory', () => {
|
|
59
77
|
// Every tsc project carries `"outDir": "dist"` in its tsconfig; the CLI override is
|
|
60
|
-
// what redirects them. If one loses `--outDir dist.next
|
|
61
|
-
// live tree and the staging is half-inert.
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const overrides = build.match(/--outDir dist\.next/g) ?? []
|
|
70
|
-
expect(tscRuns.length, 'the build must run at least one tsc project').toBeGreaterThan(0)
|
|
71
|
-
expect(overrides.length, 'every tsc project must emit into dist.next').toBe(tscRuns.length)
|
|
78
|
+
// what redirects them. If one loses `--outDir dist.next…` it writes straight into
|
|
79
|
+
// the live tree and the staging is half-inert. Counted against the tsc steps, never
|
|
80
|
+
// hard-coded (the split of 2026-09-15 took one project to cursedbelt-server).
|
|
81
|
+
const tsc = BUILD_STEPS.filter((step) => step.cmd[0] === 'tsc')
|
|
82
|
+
expect(tsc.length, 'the build must run at least one tsc project').toBeGreaterThan(0)
|
|
83
|
+
for (const step of tsc) {
|
|
84
|
+
const outDir = step.cmd[step.cmd.indexOf('--outDir') + 1] ?? ''
|
|
85
|
+
expect(outDir === STAGE || outDir.startsWith(`${STAGE}/`), `${step.cmd.join(' ')} must emit into ${STAGE}`).toBe(true)
|
|
86
|
+
}
|
|
72
87
|
})
|
|
73
88
|
|
|
74
89
|
test('the assets are copied into the staging directory too', () => {
|
|
75
90
|
// `copyDistAssets` defaults to `dist`, so without this the css and the verify
|
|
76
91
|
// fixtures land in the OLD tree and the swap throws them away.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
test('the swap happens, and only after everything else', () => {
|
|
81
|
-
const swap = build.indexOf('mv dist.next dist')
|
|
82
|
-
expect(swap, 'the staged build is never promoted').toBeGreaterThan(-1)
|
|
83
|
-
expect(swap).toBeGreaterThan(build.indexOf('copyDistAssets'))
|
|
92
|
+
const copy = BUILD_STEPS.find((step) => step.cmd.join(' ').includes('copyDistAssets'))
|
|
93
|
+
expect(copy?.env?.CURSEDBELT_DIST_DIR).toBe(STAGE)
|
|
84
94
|
})
|
|
85
95
|
})
|