@observablehq/notebook-kit 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +1 -1
- package/dist/src/databases/duckdb.js +1 -1
- package/dist/src/interpreters/index.js +2 -0
- package/dist/src/lib/interpreters.js +1 -1
- package/dist/src/lib/notebook.d.ts +1 -1
- package/dist/src/lib/serialize.js +4 -0
- package/dist/src/runtime/index.d.ts +1 -1
- package/dist/src/runtime/stdlib/dot.js +1 -1
- package/dist/src/runtime/stdlib/duckdb.js +5 -5
- package/dist/src/runtime/stdlib/fileAttachment.js +4 -4
- package/dist/src/runtime/stdlib/generators/input.d.ts +1 -1
- package/dist/src/runtime/stdlib/generators/observe.d.ts +1 -1
- package/dist/src/runtime/stdlib/generators/observe.js +37 -13
- package/dist/src/runtime/stdlib/generators/queue.d.ts +1 -1
- package/dist/src/runtime/stdlib/generators/queue.js +36 -12
- package/dist/src/runtime/stdlib/generators/width.d.ts +1 -1
- package/dist/src/runtime/stdlib/index.d.ts +1 -1
- package/dist/src/runtime/stdlib/inputs.d.ts +1 -1
- package/dist/src/runtime/stdlib/inputs.js +1 -1
- package/dist/src/runtime/stdlib/leaflet.d.ts +1 -1
- package/dist/src/runtime/stdlib/leaflet.js +2 -2
- package/dist/src/runtime/stdlib/mapboxgl.d.ts +1 -1
- package/dist/src/runtime/stdlib/mapboxgl.js +1 -1
- package/dist/src/runtime/stdlib/mermaid.js +1 -1
- package/dist/src/runtime/stdlib/mutable.d.ts +2 -2
- package/dist/src/runtime/stdlib/recommendedLibraries.js +13 -13
- package/dist/src/runtime/stdlib/sampleDatasets.js +1 -1
- package/dist/src/runtime/stdlib/tex.js +1 -1
- package/dist/src/runtime/stdlib/vega-lite.js +3 -3
- package/package.json +1 -1
- package/dist/src/javascript/assignments.test.d.ts +0 -1
- package/dist/src/javascript/assignments.test.js +0 -46
- package/dist/src/javascript/awaits.test.d.ts +0 -1
- package/dist/src/javascript/awaits.test.js +0 -22
- package/dist/src/javascript/imports/npm.test.d.ts +0 -1
- package/dist/src/javascript/imports/npm.test.js +0 -32
- package/dist/src/javascript/imports/observable.test.d.ts +0 -1
- package/dist/src/javascript/imports/observable.test.js +0 -13
- package/dist/src/javascript/references.test.d.ts +0 -1
- package/dist/src/javascript/references.test.js +0 -38
- package/dist/src/javascript/sourcemap.test.d.ts +0 -1
- package/dist/src/javascript/sourcemap.test.js +0 -88
- package/dist/src/javascript/strings.test.d.ts +0 -1
- package/dist/src/javascript/strings.test.js +0 -31
- package/dist/src/javascript/template.test.d.ts +0 -1
- package/dist/src/javascript/template.test.js +0 -60
- package/dist/src/javascript/transpile.test.d.ts +0 -1
- package/dist/src/javascript/transpile.test.js +0 -52
- package/dist/src/javascript/typescript.test.d.ts +0 -1
- package/dist/src/javascript/typescript.test.js +0 -34
- package/dist/src/lib/hash.test.d.ts +0 -1
- package/dist/src/lib/hash.test.js +0 -28
- package/dist/src/lib/notebook.test.d.ts +0 -1
- package/dist/src/lib/notebook.test.js +0 -36
- package/dist/src/lib/serialize.test.d.ts +0 -1
- package/dist/src/lib/serialize.test.js +0 -132
- package/dist/src/lib/sluggify.test.d.ts +0 -1
- package/dist/src/lib/sluggify.test.js +0 -51
- package/dist/src/runtime/stdlib/assets.test.d.ts +0 -1
- package/dist/src/runtime/stdlib/assets.test.js +0 -78
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { html } from "htl";
|
|
3
|
-
import { assert, test } from "vitest";
|
|
4
|
-
import { collectAssets } from "./assets.js";
|
|
5
|
-
function getAssets(root) {
|
|
6
|
-
const assets = new Set();
|
|
7
|
-
collectAssets(assets, root);
|
|
8
|
-
return assets;
|
|
9
|
-
}
|
|
10
|
-
test("find asset paths in descendants", () => {
|
|
11
|
-
assert.deepStrictEqual(new Set([
|
|
12
|
-
"./a-href.txt",
|
|
13
|
-
"./audio-source-src.wav",
|
|
14
|
-
"./audio-src.wav",
|
|
15
|
-
"./img-src.png",
|
|
16
|
-
"./img-srcset-src.png",
|
|
17
|
-
"./img-srcset.png",
|
|
18
|
-
"./link.css",
|
|
19
|
-
"./picture-source-src.png",
|
|
20
|
-
"./picture-srcset-src.png",
|
|
21
|
-
"./picture-srcset.png",
|
|
22
|
-
"./video-source-src.mp4",
|
|
23
|
-
"./video-src.mp4"
|
|
24
|
-
]), getAssets(html `<div>
|
|
25
|
-
<a href="./a-href.txt" download>download</a>
|
|
26
|
-
<audio><source src="./audio-source-src.wav"></audio>
|
|
27
|
-
<audio src="./audio-src.wav"></audio>
|
|
28
|
-
<img src="./img-src.png">
|
|
29
|
-
<img src="./img-srcset-src.png" srcset="./img-srcset.png 2x">
|
|
30
|
-
<link href="./link.css" rel="stylesheet">
|
|
31
|
-
<picture><source src="./picture-source-src.png"></picture>
|
|
32
|
-
<picture><source src="./picture-srcset-src.png" srcset="./picture-srcset.png 2x"></picture>
|
|
33
|
-
<video><source src="./video-source-src.mp4"></video>
|
|
34
|
-
<video src="./video-src.mp4"></video>
|
|
35
|
-
</div>`));
|
|
36
|
-
});
|
|
37
|
-
test("decodes paths", () => {
|
|
38
|
-
assert.deepStrictEqual(new Set(["./hello world.png"]), getAssets(html `<div><img src="./hello%20world.png"></div>`));
|
|
39
|
-
});
|
|
40
|
-
test("strips query strings and anchor fragments from the path", () => {
|
|
41
|
-
assert.deepStrictEqual(new Set(["./img1.png", "./img2.png", "./img3.png", "./img4.png"]), getAssets(html `<div>
|
|
42
|
-
<img src="./img1.png?foo=bar">
|
|
43
|
-
<img src="./img2.png#baz">
|
|
44
|
-
<img src="./img3.png?foo#bar">
|
|
45
|
-
<img src="./img4.png#foo?bar">
|
|
46
|
-
</div>`));
|
|
47
|
-
});
|
|
48
|
-
test("adds a leading dot slash to relative paths", () => {
|
|
49
|
-
assert.deepStrictEqual(new Set([
|
|
50
|
-
"./file.png",
|
|
51
|
-
"./path/to/file.png",
|
|
52
|
-
"/root.png",
|
|
53
|
-
"./dot-slash.png",
|
|
54
|
-
"../dot-dot-slash.png"
|
|
55
|
-
]), getAssets(html `<div>
|
|
56
|
-
<img src="file.png">
|
|
57
|
-
<img src="path/to/file.png">
|
|
58
|
-
<img src="/root.png">
|
|
59
|
-
<img src="./dot-slash.png">
|
|
60
|
-
<img src="../dot-dot-slash.png">
|
|
61
|
-
</div>`));
|
|
62
|
-
});
|
|
63
|
-
test("ignores protocol links", () => {
|
|
64
|
-
assert.deepStrictEqual(new Set([]), getAssets(html `<div>
|
|
65
|
-
<img src="https://example.com/test.png">
|
|
66
|
-
</div>`));
|
|
67
|
-
});
|
|
68
|
-
test("ignores fragment links", () => {
|
|
69
|
-
assert.deepStrictEqual(new Set([]), getAssets(html `<div>
|
|
70
|
-
<a href="#test" download>download</a>
|
|
71
|
-
</div>`));
|
|
72
|
-
});
|
|
73
|
-
test("ignores rel=external elements", () => {
|
|
74
|
-
assert.deepStrictEqual(new Set(["./internal.txt"]), getAssets(html `<div>
|
|
75
|
-
<a href="external.txt" rel="external" download>download</a>
|
|
76
|
-
<a href="internal.txt" rel="notexternal" download>download</a>
|
|
77
|
-
</div>`));
|
|
78
|
-
});
|