-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add lastModified to a module’s hash when it references a file attachm…
…ent (#1837) * when a module references a file attachment, include the file's lastModified timestamp in the module's hash. closes #1836 Note that this allows us to remove from the tests the ts rewrite that we used to do on modules, because their payload’s lastModified is now always set to the fake currentDate injected by the tests. Some tests don't want to use the fake date though! (I hope they never run in parallel?) * clear currentDate in after * prettier --------- Co-authored-by: Mike Bostock <[email protected]>
- Loading branch information
Showing
26 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {FileAttachment} from "npm:@observablehq/stdlib"; | ||
|
||
FileAttachment("data.json"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
process.stdout.write(JSON.stringify({a: 1})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# test | ||
|
||
```js | ||
import "/code/analytics.js" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {test} from "./test.a9a4ef0e.js"; |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ild/data-loaders/_import/test.86a60bc6.js → ...ild/data-loaders/_import/test.a9a4ef0e.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import {FileAttachment} from "../_observablehq/stdlib.00000003.js"; | ||
|
||
export const test = FileAttachment({"name":"../test.txt","mimeType":"text/plain","path":"../_file/test.f2ca1bb6.txt","lastModified":/* ts */1706742000000,"size":5}, import.meta.url).text(); | ||
export const test = FileAttachment({"name":"../test.txt","mimeType":"text/plain","path":"../_file/test.f2ca1bb6.txt","lastModified":1704931200000,"size":5}, import.meta.url).text(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import {FileAttachment} from "../_observablehq/stdlib.00000003.js"; | |
import * as Plot from "../_npm/@observablehq/[email protected]/cd372fb8.js"; | ||
|
||
export async function Chart() { | ||
const gistemp = await FileAttachment({"name":"../lib/gistemp.csv","mimeType":"text/csv","path":"../_file/lib/gistemp.1cf298b1.csv","lastModified":/* ts */1706742000000,"size":97}, import.meta.url).csv({typed: true}); | ||
const gistemp = await FileAttachment({"name":"../lib/gistemp.csv","mimeType":"text/csv","path":"../_file/lib/gistemp.1cf298b1.csv","lastModified":1704931200000,"size":97}, import.meta.url).csv({typed: true}); | ||
return Plot.plot({ | ||
y: {grid: true}, | ||
color: {scheme: "burd"}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import "./_observablehq/stdlib.00000003.js"; | ||
import "./_npm/@observablehq/[email protected]/cd372fb8.js"; | ||
import "./_npm/[email protected]/cd372fb8.js"; | ||
export * from "./_import/chart.2ce91e05.js"; | ||
export * from "./_import/chart.4140747c.js"; |
4 changes: 2 additions & 2 deletions
4
...build/fetches/_import/foo/foo.666599bc.js → ...build/fetches/_import/foo/foo.0cc12e18.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...put/build/fetches/_import/top.c85e149a.js → ...put/build/fetches/_import/top.bacf54cc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {FileAttachment} from "../_observablehq/stdlib.00000003.js"; | ||
export {fooCsvData, fooJsonData} from "./foo/foo.666599bc.js"; | ||
export const topJsonData = await FileAttachment({"name":"../top-data.json","mimeType":"application/json","path":"../_file/top-data.67358ed8.json","lastModified":/* ts */1706742000000,"size":10}, import.meta.url).json(); | ||
export const topCsvData = await FileAttachment({"name":"../top-data.csv","mimeType":"text/csv","path":"../_file/top-data.24ef4634.csv","lastModified":/* ts */1706742000000,"size":72}, import.meta.url).text(); | ||
export {fooCsvData, fooJsonData} from "./foo/foo.0cc12e18.js"; | ||
export const topJsonData = await FileAttachment({"name":"../top-data.json","mimeType":"application/json","path":"../_file/top-data.67358ed8.json","lastModified":1704931200000,"size":10}, import.meta.url).json(); | ||
export const topCsvData = await FileAttachment({"name":"../top-data.csv","mimeType":"text/csv","path":"../_file/top-data.24ef4634.csv","lastModified":1704931200000,"size":72}, import.meta.url).text(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"a":1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {FileAttachment} from "../../_observablehq/stdlib.00000003.js"; | ||
|
||
FileAttachment({"name":"../../code/data.json","mimeType":"application/json","path":"../../_file/code/data.015abd7f.json","lastModified":1704931200000,"size":7}, import.meta.url); |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
<meta name="generator" content="Observable Framework v1.0.0-test"> | ||
<title>test</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&display=swap" crossorigin> | ||
<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&display=swap" crossorigin> | ||
<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"> | ||
<link rel="modulepreload" href="./_import/code/analytics.0d826e00.js"> | ||
<script type="module"> | ||
|
||
import {define} from "./_observablehq/client.00000001.js"; | ||
import {registerFile} from "./_observablehq/stdlib.00000003.js"; | ||
|
||
registerFile("./code/data.json", {"name":"./code/data.json","mimeType":"application/json","path":"./_file/code/data.015abd7f.json","lastModified":/* ts */1706742000000,"size":7}); | ||
|
||
define({id: "d2a99c55", body: async () => { | ||
const {} = await import("./_import/code/analytics.0d826e00.js"); | ||
|
||
}}); | ||
|
||
</script> | ||
</head> | ||
<body> | ||
<div id="observablehq-center"> | ||
<aside id="observablehq-toc" data-selector="h1:not(:first-of-type)[id], h2:first-child[id], :not(h1) + h2[id]"> | ||
<nav> | ||
</nav> | ||
</aside> | ||
<main id="observablehq-main" class="observablehq"> | ||
<h1 id="test" tabindex="-1"><a class="observablehq-header-anchor" href="#test">test</a></h1> | ||
<div class="observablehq observablehq--block"><!--:d2a99c55:--></div> | ||
</main> | ||
<footer id="observablehq-footer"> | ||
<div>Built with <a href="https://observablehq.com/" target="_blank" rel="noopener noreferrer">Observable</a> on <a title="2024-01-10T16:00:00">Jan 10, 2024</a>.</div> | ||
</footer> | ||
</div> | ||
</body> | ||
</html> |