Skip to content

Commit

Permalink
adjust sort order to minimize churn
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 22, 2024
1 parent 3580e78 commit 3220728
Show file tree
Hide file tree
Showing 185 changed files with 402 additions and 399 deletions.
7 changes: 5 additions & 2 deletions test/build-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import os from "node:os";
import {extname} from "node:path/posix";
import {join, normalize, relative} from "node:path/posix";
import {PassThrough} from "node:stream";
import {ascending, difference, sort} from "d3-array";
import {ascending, descending, difference, sort} from "d3-array";

Check failure on line 8 in test/build-test.ts

View workflow job for this annotation

GitHub Actions / test (20, ubuntu-latest)

'descending' is defined but never used.

Check failure on line 8 in test/build-test.ts

View workflow job for this annotation

GitHub Actions / test (21, ubuntu-latest)

'descending' is defined but never used.
import type {BuildManifest} from "../src/build.js";
import {FileBuildEffects, build} from "../src/build.js";
import {normalizeConfig, readConfig, setCurrentDate} from "../src/config.js";
Expand Down Expand Up @@ -77,7 +77,10 @@ describe("build", () => {
// renumber the hashes so they are sequential. This way we don’t have to
// update the test snapshots whenever Framework’s client code changes. We
// make an exception for minisearch.json because to test the content.
for (const path of sort(findFiles(join(outputDir, "_observablehq")), extname, (d) => d)) {
for (const path of sort(
findFiles(join(outputDir, "_observablehq")),
(a, b) => ascending(extname(a) === ".css", extname(b) === ".css") || ascending(a, b)
)) {
const match = /^((.+)\.[0-9a-f]{8})\.(\w+)$/.exec(path);
if (!match) throw new Error(`no hash found: ${path}`);
const [, key, name, ext] = match;
Expand Down
8 changes: 4 additions & 4 deletions test/mocks/observableApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ class ObservableApiMock {

expectStandardFiles(options: Omit<ExpectedFileSpec, "path">) {
return this.expectFileUpload({...options, path: "index.html"})
.expectFileUpload({...options, path: "_observablehq/theme-air,near-midnight.00000001.css"})
.expectFileUpload({...options, path: "_observablehq/client.00000002.js"})
.expectFileUpload({...options, path: "_observablehq/runtime.00000003.js"})
.expectFileUpload({...options, path: "_observablehq/stdlib.00000004.js"});
.expectFileUpload({...options, path: "_observablehq/client.00000001.js"})
.expectFileUpload({...options, path: "_observablehq/runtime.00000002.js"})
.expectFileUpload({...options, path: "_observablehq/stdlib.00000003.js"})
.expectFileUpload({...options, path: "_observablehq/theme-air,near-midnight.00000004.css"});
}

/** Register a file that is expected to be uploaded. Also includes that file in
Expand Down
12 changes: 6 additions & 6 deletions test/output/build/404/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<title>Page not found</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

if (location.pathname.endsWith("/")) {
Expand All @@ -24,7 +24,7 @@
</script>
<script type="module">

import "./_observablehq/client.00000002.js";
import "./_observablehq/client.00000001.js";

</script>
</head>
Expand Down
14 changes: 7 additions & 7 deletions test/output/build/archives.posix/tar.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<title>Tar</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import {define} from "./_observablehq/client.00000002.js";
import {registerFile} from "./_observablehq/stdlib.00000004.js";
import {define} from "./_observablehq/client.00000001.js";
import {registerFile} from "./_observablehq/stdlib.00000003.js";

registerFile("./dynamic-tar-gz/file.txt", {"name":"./dynamic-tar-gz/file.txt","mimeType":"text/plain","path":"./_file/dynamic-tar-gz/file.c93138d8.txt","lastModified":/* ts */1706742000000,"size":21});
registerFile("./dynamic-tar/file.txt", {"name":"./dynamic-tar/file.txt","mimeType":"text/plain","path":"./_file/dynamic-tar/file.c93138d8.txt","lastModified":/* ts */1706742000000,"size":21});
Expand Down
14 changes: 7 additions & 7 deletions test/output/build/archives.posix/zip.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<title>Zip</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import {define} from "./_observablehq/client.00000002.js";
import {registerFile} from "./_observablehq/stdlib.00000004.js";
import {define} from "./_observablehq/client.00000001.js";
import {registerFile} from "./_observablehq/stdlib.00000003.js";

registerFile("./dynamic/file.txt", {"name":"./dynamic/file.txt","mimeType":"text/plain","path":"./_file/dynamic/file.c93138d8.txt","lastModified":/* ts */1706742000000,"size":21});
registerFile("./static/file.txt", {"name":"./static/file.txt","mimeType":"text/plain","path":"./_file/static/file.d9014c46.txt","lastModified":/* ts */1706742000000,"size":14});
Expand Down
14 changes: 7 additions & 7 deletions test/output/build/archives.win32/tar.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<title>Tar</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import {define} from "./_observablehq/client.00000002.js";
import {registerFile} from "./_observablehq/stdlib.00000004.js";
import {define} from "./_observablehq/client.00000001.js";
import {registerFile} from "./_observablehq/stdlib.00000003.js";

registerFile("./static-tar/file.txt", {"name":"./static-tar/file.txt","mimeType":"text/plain","path":"./_file/static-tar/file.c93138d8.txt","lastModified":/* ts */1706742000000,"size":21});
registerFile("./static-tgz/file.txt", {"name":"./static-tgz/file.txt","mimeType":"text/plain","path":"./_file/static-tgz/file.c93138d8.txt","lastModified":/* ts */1706742000000,"size":21});
Expand Down
14 changes: 7 additions & 7 deletions test/output/build/archives.win32/zip.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<title>Zip</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import {define} from "./_observablehq/client.00000002.js";
import {registerFile} from "./_observablehq/stdlib.00000004.js";
import {define} from "./_observablehq/client.00000001.js";
import {registerFile} from "./_observablehq/stdlib.00000003.js";

registerFile("./static/file.txt", {"name":"./static/file.txt","mimeType":"text/plain","path":"./_file/static/file.d9014c46.txt","lastModified":/* ts */1706742000000,"size":14});

Expand Down
12 changes: 6 additions & 6 deletions test/output/build/config/closed/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<title>A page…</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="../_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="../_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="../_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="../_observablehq/client.00000002.js">
<link rel="modulepreload" href="../_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="../_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="../_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="../_observablehq/client.00000001.js">
<link rel="modulepreload" href="../_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="../_observablehq/stdlib.00000003.js">
<script type="module">

import "../_observablehq/client.00000002.js";
import "../_observablehq/client.00000001.js";

</script>
</head>
Expand Down
12 changes: 6 additions & 6 deletions test/output/build/config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<title>Index</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import "./_observablehq/client.00000002.js";
import "./_observablehq/client.00000001.js";

</script>
</head>
Expand Down
12 changes: 6 additions & 6 deletions test/output/build/config/one.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<title>One</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import "./_observablehq/client.00000002.js";
import "./_observablehq/client.00000001.js";

</script>
</head>
Expand Down
12 changes: 6 additions & 6 deletions test/output/build/config/sub/two.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<title>Two</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="../_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="../_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="../_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="../_observablehq/client.00000002.js">
<link rel="modulepreload" href="../_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="../_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="../_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="../_observablehq/client.00000001.js">
<link rel="modulepreload" href="../_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="../_observablehq/stdlib.00000003.js">
<script type="module">

import "../_observablehq/client.00000002.js";
import "../_observablehq/client.00000001.js";

</script>
</head>
Expand Down
12 changes: 6 additions & 6 deletions test/output/build/config/toc-override.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<title>H1: Section</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import "./_observablehq/client.00000002.js";
import "./_observablehq/client.00000001.js";

</script>
</head>
Expand Down
12 changes: 6 additions & 6 deletions test/output/build/config/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<title>H1: Section</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&amp;display=swap" crossorigin>
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000001.css">
<link rel="modulepreload" href="./_observablehq/client.00000002.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000003.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000004.js">
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.00000004.css">
<link rel="modulepreload" href="./_observablehq/client.00000001.js">
<link rel="modulepreload" href="./_observablehq/runtime.00000002.js">
<link rel="modulepreload" href="./_observablehq/stdlib.00000003.js">
<script type="module">

import "./_observablehq/client.00000002.js";
import "./_observablehq/client.00000001.js";

</script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/output/build/data-loaders/_import/test.a9a4ef0e.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {FileAttachment} from "../_observablehq/stdlib.00000004.js";
import {FileAttachment} from "../_observablehq/stdlib.00000003.js";

export const test = FileAttachment({"name":"../test.txt","mimeType":"text/plain","path":"../_file/test.f2ca1bb6.txt","lastModified":1704931200000,"size":5}, import.meta.url).text();
Loading

0 comments on commit 3220728

Please sign in to comment.