website-xp-phone 2.2.12 → 2.4.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/.github/workflows/ci.yml +2 -2
- package/README.md +17 -3
- package/build/blogDirsPlugin.ts +100 -0
- package/build/env.ts +4 -1
- package/build/routeSkeletonsPlugin.ts +44 -2
- package/package.json +14 -10
- package/public/blog/archive/eighth-post-lost-in-the-sauce.json +36 -0
- package/public/blog/archive/noise/eleventh-post-discussion-java-gist.md +5 -0
- package/public/blog/archive/noise/fifteenth-post-very-rare-windows-funny.md +8 -0
- package/public/blog/archive/noise/fourth-post-meta-blog.md +3 -0
- package/public/blog/archive/noise/sixteenth-post-meta-fantasy-blog.md +4 -0
- package/public/blog/archive/noise/tenth-post-meta-funny-redacted-and-timetravelled.md +3 -0
- package/public/blog/archive/noise/twelfth-post-mixing-phase-technique-audio-music.md +48 -0
- package/public/blog/archive/noise/welcome-back-ramble-meta.md +6 -0
- package/public/blog/archive/noise/welcome-to-my-blog-meta-blog-welcome-to-my-website.md +7 -0
- package/public/blog/archive/seventh-post-lie-theory-na2000.json +22 -0
- package/public/blog/archive/sophus-lie.json +36 -0
- package/public/blog/hlwm_and_herbstutil.md +11 -0
- package/public/blog/random/hlwm.md +8 -0
- package/public/blog/writing/hot-action-under-a-cold-moon.json +9 -0
- package/public/checksums.txt +91 -66
- package/public/documents/drift-report.json +42 -28
- package/render.yaml +11 -1
- package/scripts/mutable-assets.mjs +13 -22
- package/scripts/refresh-content.mjs +53 -32
- package/scripts/refresh-soundcloud.mjs +221 -136
- package/scripts/write-dist-checksums.mjs +48 -4
- package/src/content/blog.json +16 -363
- package/src/content/blogDirs.ts +196 -0
- package/src/content/configs.json +1 -1
- package/src/content/contacts.json +2 -2
- package/src/content/includes/make-recipes.md +18 -0
- package/src/content/index.ts +156 -57
- package/src/content/music-ext.json +1 -1
- package/src/content/projects/doftiles.json +88 -4
- package/src/content/projects/herbctl.json +58 -0
- package/src/content/projects/herbstutil.json +50 -20
- package/src/content/projects/on-deploy.json +57 -0
- package/src/content/projects/polyframes.json +83 -0
- package/src/content/schema.ts +7 -4
- package/src/content/sections.json +11 -10
- package/src/content/soundcloud.json +95 -47
- package/src/lib/clippy.ts +29 -8
- package/src/lib/embeds.ts +43 -24
- package/src/lib/history.ts +152 -0
- package/src/lib/markdown.tsx +19 -22
- package/src/lib/rehypeYoutubeEmbed.ts +65 -0
- package/src/lib/sanitizeSchema.ts +32 -0
- package/src/lib/scrollTo.ts +45 -0
- package/src/lib/signals.tsx +271 -0
- package/src/main.tsx +20 -4
- package/src/pages/BlogDirPage.tsx +36 -0
- package/src/pages/BlogPostPage.tsx +76 -3
- package/src/pages/ProjectPage.tsx +9 -3
- package/src/pages/WowPage.tsx +8 -3
- package/src/pages/index.ts +2 -0
- package/src/shell/App.tsx +14 -8
- package/src/shell/Clippy.tsx +13 -3
- package/src/shell/MenuBar.tsx +7 -4
- package/src/shell/resolveRoute.ts +41 -2
- package/src/shell/routerSignals.ts +34 -0
- package/src/styles/extras.css +27 -0
- package/src/styles/layout.css +2 -2
- package/src/styles/menu.css +1 -1
- package/src/styles/window.css +19 -9
- package/src/themes/pageSlide/index.ts +120 -42
- package/src/themes/pageSlide/pageSlide.css +20 -9
- package/src/virtual.d.ts +14 -0
- package/src/window/MaximizedWindow.tsx +97 -64
- package/src/window/OkButton.tsx +42 -25
- package/src/window/PageWindows.tsx +7 -0
- package/src/window/TitleBar.tsx +3 -1
- package/src/window/Window.tsx +132 -87
- package/src/window/closeSounds.ts +27 -0
- package/src/window/model.ts +11 -0
- package/src/window/state.tsx +290 -50
- package/src/window/themes.ts +23 -2
- package/test/content.test.js +15 -10
- package/test/deploy-pipeline.test.js +73 -0
- package/test/embeds.test.js +89 -0
- package/test/markdown-tables.test.js +96 -0
- package/test/mutable-assets.test.js +16 -4
- package/test/route-skeletons.test.js +38 -0
- package/test/soundcloud-refresh.test.js +68 -0
- package/test/youtubeEmbed.test.js +157 -0
- package/tsconfig.node.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +7 -1
- package/.opencode/cache/index.akinevz.html +0 -54
- package/public/blog/4th.md +0 -28
- package/public/blog/wsl.1.md +0 -40
- package/src/window/hidden.ts +0 -22
- /package/public/blog/{ → archive/noise/}/321/200/321/203/320/275/320/270/321/201/321/207-/320/263/320/273/320/276/321/201/321/201/320/260/321/200/320/270/320/271.md" +0 -0
- /package/src/content/{characters.json → includes/characters.json} +0 -0
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* the 401s came from stale hard-coded client_ids, not from the endpoint
|
|
30
30
|
* itself. Scraping a fresh one per run sidesteps rotation entirely.
|
|
31
31
|
*/
|
|
32
|
-
import { writeFile } from "node:fs/promises";
|
|
32
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
33
33
|
import { dirname, resolve } from "node:path";
|
|
34
34
|
import { fileURLToPath } from "node:url";
|
|
35
35
|
|
|
@@ -38,12 +38,39 @@ const __dirname = dirname(__filename);
|
|
|
38
38
|
const projectRoot = resolve(__dirname, "..");
|
|
39
39
|
const outputFile = resolve(projectRoot, "src/content/soundcloud.json");
|
|
40
40
|
|
|
41
|
+
/** Read the snapshot currently on disk, if it exists and parses. */
|
|
42
|
+
const readExistingSnapshot = async () => {
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(await readFile(outputFile, "utf8"));
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// A missing or unparseable file is not an error condition for the
|
|
47
|
+
// refresh: there is simply nothing to compare against, so write.
|
|
48
|
+
if (error.code === "ENOENT" || error instanceof SyntaxError) return null;
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Equality of two snapshots ignoring the volatile `generatedAt` stamp:
|
|
55
|
+
* every other byte of shape (source, counts, tracks, profiles) must be
|
|
56
|
+
* identical. Key order is stable because both documents are produced by
|
|
57
|
+
* this same code path, so a stringify comparison is exact.
|
|
58
|
+
*/
|
|
59
|
+
export const snapshotsMatch = (existing, fresh) => {
|
|
60
|
+
if (existing === null || typeof existing !== "object") return false;
|
|
61
|
+
const withoutStamp = ({ generatedAt, ...rest }) => rest;
|
|
62
|
+
return (
|
|
63
|
+
JSON.stringify(withoutStamp(existing)) ===
|
|
64
|
+
JSON.stringify(withoutStamp(fresh))
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
41
68
|
/** SoundCloud usernames whose discographies should be published. */
|
|
42
69
|
const SOUND_CLOUD_OWNERS = ["akinevz", "akinevz2"];
|
|
43
70
|
|
|
44
71
|
/** User-Agent sent for every outbound HTTP request. */
|
|
45
72
|
const USER_AGENT =
|
|
46
|
-
|
|
73
|
+
"Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0";
|
|
47
74
|
|
|
48
75
|
/** Fetch timeout (ms) for every HTTP request. */
|
|
49
76
|
const FETCH_TIMEOUT_MS = 15_000;
|
|
@@ -63,17 +90,17 @@ const getProfileUrl = (owner) => `https://soundcloud.com/${owner}`;
|
|
|
63
90
|
* (callers decide how to interpret it); throws only on network failure.
|
|
64
91
|
*/
|
|
65
92
|
const fetchWithTimeout = async (url, options = {}) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
const controller = new AbortController();
|
|
94
|
+
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
95
|
+
try {
|
|
96
|
+
return await fetch(url, {
|
|
97
|
+
...options,
|
|
98
|
+
headers: { "User-Agent": USER_AGENT, ...options.headers },
|
|
99
|
+
signal: controller.signal,
|
|
100
|
+
});
|
|
101
|
+
} finally {
|
|
102
|
+
clearTimeout(timer);
|
|
103
|
+
}
|
|
77
104
|
};
|
|
78
105
|
|
|
79
106
|
/**
|
|
@@ -82,21 +109,23 @@ const fetchWithTimeout = async (url, options = {}) => {
|
|
|
82
109
|
* JSON. Throws with the HTTP status on definitive failure.
|
|
83
110
|
*/
|
|
84
111
|
const fetchApiJson = async (url, attempt = 1) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
return await response.json();
|
|
93
|
-
} catch (error) {
|
|
94
|
-
if (attempt < API_RETRIES) {
|
|
95
|
-
await new Promise((resolveSleep) => setTimeout(resolveSleep, 1_000 * attempt));
|
|
96
|
-
return fetchApiJson(url, attempt + 1);
|
|
97
|
-
}
|
|
98
|
-
throw error;
|
|
112
|
+
try {
|
|
113
|
+
const response = await fetchWithTimeout(url, {
|
|
114
|
+
headers: { Accept: "application/json" },
|
|
115
|
+
});
|
|
116
|
+
if (!response.ok) {
|
|
117
|
+
throw new Error(`HTTP ${response.status} for ${new URL(url).pathname}`);
|
|
99
118
|
}
|
|
119
|
+
return await response.json();
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (attempt < API_RETRIES) {
|
|
122
|
+
await new Promise((resolveSleep) =>
|
|
123
|
+
setTimeout(resolveSleep, 1_000 * attempt),
|
|
124
|
+
);
|
|
125
|
+
return fetchApiJson(url, attempt + 1);
|
|
126
|
+
}
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
100
129
|
};
|
|
101
130
|
|
|
102
131
|
/**
|
|
@@ -105,46 +134,53 @@ const fetchApiJson = async (url, attempt = 1) => {
|
|
|
105
134
|
* they must never be hard-coded. Throws if no bundle yields one.
|
|
106
135
|
*/
|
|
107
136
|
const resolveClientId = async () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
137
|
+
const profileResponse = await fetchWithTimeout(
|
|
138
|
+
getProfileUrl(SOUND_CLOUD_OWNERS[0]),
|
|
139
|
+
);
|
|
140
|
+
if (!profileResponse.ok) {
|
|
141
|
+
throw new Error(
|
|
142
|
+
`Could not fetch profile HTML: HTTP ${profileResponse.status}`,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
const html = await profileResponse.text();
|
|
113
146
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
147
|
+
const assetUrls = [
|
|
148
|
+
...new Set(
|
|
149
|
+
[
|
|
150
|
+
...html.matchAll(
|
|
151
|
+
/https:\/\/a-v2\.sndcdn\.com\/assets\/[a-zA-Z0-9._-]+\.js/g,
|
|
119
152
|
),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
153
|
+
].map((match) => match[0]),
|
|
154
|
+
),
|
|
155
|
+
];
|
|
156
|
+
if (assetUrls.length === 0) {
|
|
157
|
+
throw new Error("No SoundCloud asset bundles found in profile HTML");
|
|
158
|
+
}
|
|
124
159
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
160
|
+
for (const assetUrl of assetUrls) {
|
|
161
|
+
const assetResponse = await fetchWithTimeout(assetUrl);
|
|
162
|
+
if (!assetResponse.ok) continue;
|
|
163
|
+
const js = await assetResponse.text();
|
|
164
|
+
const match = js.match(/client_id:"([a-zA-Z0-9]{20,40})"/);
|
|
165
|
+
if (match) return match[1];
|
|
166
|
+
}
|
|
132
167
|
|
|
133
|
-
|
|
168
|
+
throw new Error("No client_id found in any SoundCloud asset bundle");
|
|
134
169
|
};
|
|
135
170
|
|
|
136
171
|
/**
|
|
137
|
-
* Resolve an owner handle to its
|
|
172
|
+
* Resolve an owner handle to its public api-v2 user object (id plus
|
|
173
|
+
* profile metadata such as the public track_count).
|
|
138
174
|
*/
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
175
|
+
const resolveUser = async (owner, clientId) => {
|
|
176
|
+
const resolveUrl = new URL("https://api-v2.soundcloud.com/resolve");
|
|
177
|
+
resolveUrl.searchParams.set("url", getProfileUrl(owner));
|
|
178
|
+
resolveUrl.searchParams.set("client_id", clientId);
|
|
179
|
+
const user = await fetchApiJson(resolveUrl.toString());
|
|
180
|
+
if (typeof user?.id !== "number") {
|
|
181
|
+
throw new Error(`Could not resolve user id for ${owner}`);
|
|
182
|
+
}
|
|
183
|
+
return user;
|
|
148
184
|
};
|
|
149
185
|
|
|
150
186
|
/**
|
|
@@ -153,26 +189,27 @@ const resolveUserId = async (owner, clientId) => {
|
|
|
153
189
|
* re-appended on every page or page 2+ returns HTTP 401.
|
|
154
190
|
*/
|
|
155
191
|
const fetchAllTracks = async (owner, userId, clientId) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
while (href) {
|
|
160
|
-
const page = await fetchApiJson(href);
|
|
161
|
-
const collection = Array.isArray(page?.collection) ? page.collection : [];
|
|
162
|
-
for (const track of collection) {
|
|
163
|
-
if (typeof track?.permalink_url !== "string") continue;
|
|
164
|
-
tracks.push(track);
|
|
165
|
-
}
|
|
166
|
-
const nextHref = typeof page?.next_href === "string" ? page.next_href : null;
|
|
167
|
-
href = nextHref
|
|
168
|
-
? `${nextHref}${nextHref.includes("?") ? "&" : "?"}client_id=${clientId}`
|
|
169
|
-
: null;
|
|
170
|
-
}
|
|
192
|
+
const tracks = [];
|
|
193
|
+
let href = `https://api-v2.soundcloud.com/users/${userId}/tracks?client_id=${clientId}&limit=200&representation=full`;
|
|
171
194
|
|
|
172
|
-
|
|
173
|
-
|
|
195
|
+
while (href) {
|
|
196
|
+
const page = await fetchApiJson(href);
|
|
197
|
+
const collection = Array.isArray(page?.collection) ? page.collection : [];
|
|
198
|
+
for (const track of collection) {
|
|
199
|
+
if (typeof track?.permalink_url !== "string") continue;
|
|
200
|
+
tracks.push(track);
|
|
174
201
|
}
|
|
175
|
-
|
|
202
|
+
const nextHref =
|
|
203
|
+
typeof page?.next_href === "string" ? page.next_href : null;
|
|
204
|
+
href = nextHref
|
|
205
|
+
? `${nextHref}${nextHref.includes("?") ? "&" : "?"}client_id=${clientId}`
|
|
206
|
+
: null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (tracks.length === 0) {
|
|
210
|
+
throw new Error(`Discography for ${owner} came back empty`);
|
|
211
|
+
}
|
|
212
|
+
return tracks;
|
|
176
213
|
};
|
|
177
214
|
|
|
178
215
|
/**
|
|
@@ -180,87 +217,135 @@ const fetchAllTracks = async (owner, userId, clientId) => {
|
|
|
180
217
|
* URL slug if the title is missing.
|
|
181
218
|
*/
|
|
182
219
|
const toSnapshotTrack = (owner, track) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
220
|
+
const url = track.permalink_url;
|
|
221
|
+
const path = `/${url.replace(/^https?:\/\/(www\.)?soundcloud\.com\//, "")}`;
|
|
222
|
+
return {
|
|
223
|
+
owner,
|
|
224
|
+
path,
|
|
225
|
+
title:
|
|
226
|
+
typeof track.title === "string" && track.title.length > 0
|
|
227
|
+
? track.title
|
|
228
|
+
: path.split("/").pop(),
|
|
229
|
+
url,
|
|
230
|
+
};
|
|
194
231
|
};
|
|
195
232
|
|
|
196
233
|
/**
|
|
197
234
|
* Fetch the complete discography for one owner. Returns the snapshot-shaped
|
|
198
235
|
* track list in API order (newest first).
|
|
199
236
|
*/
|
|
237
|
+
/**
|
|
238
|
+
* Fetch the complete discography for one owner. Returns the snapshot-shaped
|
|
239
|
+
* track list in API order (newest first).
|
|
240
|
+
*
|
|
241
|
+
* Integrity: the fetched list must match the profile's PUBLIC track_count —
|
|
242
|
+
* the number any anonymous visitor (and this unauthenticated snapshot) can
|
|
243
|
+
* see. A mismatch means the list came back truncated or the API lagged a
|
|
244
|
+
* fresh upload; retry once, then fail loudly rather than write a silently
|
|
245
|
+
* incomplete discography. (Tracks the owner sees but the public does not —
|
|
246
|
+
* still processing or private — never inflate the public count, so they do
|
|
247
|
+
* not trip this check.)
|
|
248
|
+
*/
|
|
200
249
|
const fetchOwnerDiscography = async (owner, clientId) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
250
|
+
const user = await resolveUser(owner, clientId);
|
|
251
|
+
let apiTracks = await fetchAllTracks(owner, user.id, clientId);
|
|
252
|
+
const publicCount =
|
|
253
|
+
typeof user.track_count === "number" ? user.track_count : null;
|
|
254
|
+
if (publicCount !== null && apiTracks.length < publicCount) {
|
|
255
|
+
// Refuse only TRUNCATION: the api returning fewer tracks than the
|
|
256
|
+
// public profile counts means pages were missed. MORE tracks than
|
|
257
|
+
// the profile counts is the fresh-upload case — the discography
|
|
258
|
+
// endpoint lists a just-uploaded track before the profile's
|
|
259
|
+
// counter catches up, and that is the track the refresh is FOR.
|
|
260
|
+
apiTracks = await fetchAllTracks(owner, user.id, clientId);
|
|
261
|
+
if (apiTracks.length < publicCount) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
`Discography for ${owner} returned ${apiTracks.length} track(s) ` +
|
|
264
|
+
`but the public profile counts ${publicCount} — refusing to ` +
|
|
265
|
+
`write a truncated snapshot`,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return apiTracks.map((track) => toSnapshotTrack(owner, track));
|
|
204
270
|
};
|
|
205
271
|
|
|
206
272
|
export const run = async () => {
|
|
207
|
-
|
|
208
|
-
|
|
273
|
+
const clientId = await resolveClientId();
|
|
274
|
+
process.stdout.write(`Resolved SoundCloud client_id: ${clientId}\n`);
|
|
209
275
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
276
|
+
const discographies = new Map();
|
|
277
|
+
for (const owner of SOUND_CLOUD_OWNERS) {
|
|
278
|
+
discographies.set(owner, await fetchOwnerDiscography(owner, clientId));
|
|
279
|
+
}
|
|
214
280
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
// so emitting a `profiles` array ensures every owner gets its own
|
|
223
|
-
// section — not just the first one.
|
|
224
|
-
const profiles = SOUND_CLOUD_OWNERS.map((owner) => {
|
|
225
|
-
const ownerTracks = discographies.get(owner) ?? [];
|
|
226
|
-
return {
|
|
227
|
-
owner,
|
|
228
|
-
source: getProfileUrl(owner),
|
|
229
|
-
profileImageUrl: null,
|
|
230
|
-
trackCount: ownerTracks.length,
|
|
231
|
-
tracks: ownerTracks,
|
|
232
|
-
};
|
|
233
|
-
});
|
|
281
|
+
// Flat track list in per-owner API order (newest first). The music page
|
|
282
|
+
// filters this array by `owner`, so per-owner relative order is what the
|
|
283
|
+
// UI displays.
|
|
284
|
+
const tracks = SOUND_CLOUD_OWNERS.flatMap(
|
|
285
|
+
(owner) => discographies.get(owner) ?? [],
|
|
286
|
+
);
|
|
287
|
+
const trackCount = tracks.length;
|
|
234
288
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
289
|
+
// Per-owner sections. The component groups the discography by `owner`,
|
|
290
|
+
// so emitting a `profiles` array ensures every owner gets its own
|
|
291
|
+
// section — not just the first one.
|
|
292
|
+
const profiles = SOUND_CLOUD_OWNERS.map((owner) => {
|
|
293
|
+
const ownerTracks = discographies.get(owner) ?? [];
|
|
294
|
+
return {
|
|
295
|
+
owner,
|
|
296
|
+
source: getProfileUrl(owner),
|
|
297
|
+
profileImageUrl: null,
|
|
298
|
+
trackCount: ownerTracks.length,
|
|
299
|
+
tracks: ownerTracks,
|
|
242
300
|
};
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
const result = {
|
|
304
|
+
source: getProfileUrl(SOUND_CLOUD_OWNERS[0]),
|
|
305
|
+
generatedAt: new Date().toISOString(),
|
|
306
|
+
asOfUploadingTrackCount: trackCount,
|
|
307
|
+
trackCount,
|
|
308
|
+
tracks,
|
|
309
|
+
profiles,
|
|
310
|
+
};
|
|
243
311
|
|
|
244
|
-
|
|
312
|
+
const existing = await readExistingSnapshot();
|
|
313
|
+
const unchanged = snapshotsMatch(existing, result);
|
|
314
|
+
const profileSummary = profiles
|
|
315
|
+
.map((profile) => ` @${profile.owner}: ${profile.trackCount} track(s)\n`)
|
|
316
|
+
.join("");
|
|
245
317
|
|
|
318
|
+
if (unchanged) {
|
|
319
|
+
// Track data is identical to the snapshot on disk; the refreshed
|
|
320
|
+
// document would differ only in its `generatedAt` stamp. Discard the
|
|
321
|
+
// rewrite so the file (its timestamp, and any diffs downstream of it)
|
|
322
|
+
// stays untouched.
|
|
246
323
|
process.stdout.write(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
.map((profile) => ` @${profile.owner}: ${profile.trackCount} track(s)\n`)
|
|
250
|
-
.join(""),
|
|
324
|
+
`Discography unchanged (${trackCount} track(s)); ${outputFile} left untouched\n` +
|
|
325
|
+
profileSummary,
|
|
251
326
|
);
|
|
252
|
-
|
|
253
327
|
return result;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
await writeFile(outputFile, `${JSON.stringify(result, null, 2)}\n`, "utf8");
|
|
331
|
+
|
|
332
|
+
process.stdout.write(
|
|
333
|
+
`Refreshed ${result.tracks.length} SoundCloud track(s) into ${outputFile}\n` +
|
|
334
|
+
profileSummary,
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
return result;
|
|
254
338
|
};
|
|
255
339
|
|
|
256
340
|
const isDirectExecution =
|
|
257
|
-
|
|
341
|
+
process.argv[1] &&
|
|
342
|
+
fileURLToPath(import.meta.url) === resolve(process.argv[1]);
|
|
258
343
|
|
|
259
344
|
if (isDirectExecution) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
345
|
+
run().catch((error) => {
|
|
346
|
+
process.stderr.write(
|
|
347
|
+
`${error instanceof Error ? error.message : String(error)}\n`,
|
|
348
|
+
);
|
|
349
|
+
process.exit(1);
|
|
350
|
+
});
|
|
266
351
|
}
|
|
@@ -39,6 +39,7 @@ const distRoot = resolve(projectRoot, "dist");
|
|
|
39
39
|
const publicRoot = resolve(projectRoot, "public");
|
|
40
40
|
const distChecksumsPath = resolve(distRoot, "checksums.txt");
|
|
41
41
|
const publicChecksumsPath = resolve(publicRoot, "checksums.txt");
|
|
42
|
+
const generatedManifestPath = resolve(distRoot, ".generated.json");
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* Sidecar written next to `checksums.txt` capturing any STABLE-invariant
|
|
@@ -191,9 +192,48 @@ async function readRemoteChecksums() {
|
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Read the generated-artifact manifest that routeSkeletonsPlugin emits
|
|
197
|
+
* (`dist/.generated.json`): every webapp-generated path it lists is
|
|
198
|
+
* auto-marked mutable, so new routes and project pages never need a
|
|
199
|
+
* hand-maintained mutable entry.
|
|
200
|
+
*
|
|
201
|
+
* Fail-loud policy: an existing but corrupt manifest throws (a build
|
|
202
|
+
* tooling regression must not silently downgrade the gate); a missing
|
|
203
|
+
* manifest only notes it — pages then fall back to the denylist in
|
|
204
|
+
* mutable-assets.mjs and the live-reconcile in the drift gate.
|
|
205
|
+
*/
|
|
206
|
+
async function readGeneratedPaths() {
|
|
207
|
+
let raw;
|
|
208
|
+
try {
|
|
209
|
+
raw = await readFile(generatedManifestPath, "utf8");
|
|
210
|
+
} catch {
|
|
211
|
+
process.stdout.write(
|
|
212
|
+
`Note: no generated-artifact manifest at dist/.generated.json — ` +
|
|
213
|
+
`generated pages are not auto-marked mutable (run vite build first)\n`,
|
|
214
|
+
);
|
|
215
|
+
return new Set();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const parsed = JSON.parse(raw);
|
|
219
|
+
const list =
|
|
220
|
+
parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)
|
|
221
|
+
? parsed.generated
|
|
222
|
+
: null;
|
|
223
|
+
if (!Array.isArray(list) || list.some((p) => typeof p !== "string")) {
|
|
224
|
+
throw new Error(
|
|
225
|
+
`corrupt generated-artifact manifest: ` +
|
|
226
|
+
`${relative(projectRoot, generatedManifestPath)} must be ` +
|
|
227
|
+
`{ "generated": string[] }`,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
return new Set(list);
|
|
231
|
+
}
|
|
232
|
+
|
|
194
233
|
async function run() {
|
|
195
234
|
const files = await walk(distRoot);
|
|
196
235
|
const existing = await readRemoteChecksums();
|
|
236
|
+
const generatedPaths = await readGeneratedPaths();
|
|
197
237
|
const rows = [];
|
|
198
238
|
let index = 0;
|
|
199
239
|
const driftViolations = [];
|
|
@@ -202,8 +242,9 @@ async function run() {
|
|
|
202
242
|
const liveCounterparts = new Map();
|
|
203
243
|
|
|
204
244
|
for (const filePath of files.sort()) {
|
|
205
|
-
// Skip the manifest file itself
|
|
206
|
-
|
|
245
|
+
// Skip the manifest file itself and the generated-artifact manifest so
|
|
246
|
+
// neither appears in its own diff.
|
|
247
|
+
if (filePath === distChecksumsPath || filePath === generatedManifestPath) {
|
|
207
248
|
continue;
|
|
208
249
|
}
|
|
209
250
|
|
|
@@ -216,11 +257,13 @@ async function run() {
|
|
|
216
257
|
: previous === digest
|
|
217
258
|
? "STABLE"
|
|
218
259
|
: "CHANGED";
|
|
219
|
-
const
|
|
260
|
+
const generated = generatedPaths.has(relPath);
|
|
261
|
+
const mutable = generated || isMutablePath(relPath);
|
|
262
|
+
const tag = generated ? " (generated)" : mutable ? " (mutable)" : "";
|
|
220
263
|
index += 1;
|
|
221
264
|
|
|
222
265
|
process.stdout.write(
|
|
223
|
-
`${String(index).padStart(3, "0")}. [${status}] ${relPath}${
|
|
266
|
+
`${String(index).padStart(3, "0")}. [${status}] ${relPath}${tag}\n` +
|
|
224
267
|
` prev: ${previous ?? "(none)"}\n` +
|
|
225
268
|
` next: ${digest}\n`,
|
|
226
269
|
);
|
|
@@ -266,6 +309,7 @@ async function run() {
|
|
|
266
309
|
baselineUrl: REMOTE_CHECKSUMS_URL,
|
|
267
310
|
generatedAt: new Date().toISOString(),
|
|
268
311
|
mutablePaths: [...MUTABLE_PATH_SET],
|
|
312
|
+
generatedPaths: [...generatedPaths].sort(),
|
|
269
313
|
violationCount: driftViolations.length,
|
|
270
314
|
violations: driftViolations,
|
|
271
315
|
rehashOnlyCount: rehashOnly.length,
|