@a10k/iridium-dev-server 0.0.2 → 0.0.3

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/Readme.md CHANGED
@@ -63,6 +63,8 @@ import { points } from "./my-data.js"
63
63
 
64
64
  Paths resolve against the page (the server root), so `./my-data.js` is the compiled `my-data` notebook. Save the imported notebook first so its module is up to date. Names without a path (`@d3/color-legend`, or a notebook id) still load from observablehq.com, and full URLs are imported as written.
65
65
 
66
+ Other relative URLs in cells and in the `head` option (`fetch("./data.json")`, `<img src="./libs/logo.svg">`, `<link href="./libs/index.css">`) also resolve against the server root, so files in the `static` or `compiled` folders work with `./` paths. `FileAttachment("x")` reads from the notebook's own files folder (`<notebooks>/<name>/`).
67
+
66
68
  ## Notebook list API
67
69
 
68
70
  `GET /api/notebooks?q=&page=1&per_page=25&sort=name|modified` returns the notebooks whose name or title contains `q` (any case), one page at a time. For example, with `my-notebook` and `my-data` saved, `GET /api/notebooks?q=my` returns:
package/lib/viewer.js CHANGED
@@ -6,8 +6,6 @@ export const viewerPage = ({ name, iridiumBase, filesBase, head }) => `<!DOCTYPE
6
6
  <head>
7
7
  <meta charset="utf-8" />
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1" />
9
- <!-- FileAttachment("x") resolves against the base URL: the notebook's files folder. -->
10
- <base href="${filesBase}" />
11
9
  <!-- The tab's connection to the server: macOS-style green dot when connected, grey otherwise. -->
12
10
  <link rel="icon" id="iridium-status" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='%23c8c8c8' stroke='%23a6a6a6'/%3E%3C/svg%3E" />
13
11
  <title>${name.replace(/[<&]/g, '')} · Iridium</title>
@@ -35,6 +33,10 @@ export const viewerPage = ({ name, iridiumBase, filesBase, head }) => `<!DOCTYPE
35
33
  };
36
34
 
37
35
  // This page edits one notebook, named by the URL.
36
+ // FileAttachment("x") is in the notebook's files folder. No <base>, so
37
+ // other relative URLs (fetch, img, head links) resolve against the
38
+ // server root, next to the notebooks.
39
+ Iridium.files_base = ${json(filesBase)};
38
40
  Iridium.get_recent = () => name;
39
41
  Iridium.set_recent = () => {};
40
42
  Iridium.list = () => post('/list', {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a10k/iridium-dev-server",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Local dev server for working with Observable notebooks.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "node": ">=22"
25
25
  },
26
26
  "dependencies": {
27
- "@a10k/iridium": "~0.0.2",
27
+ "@a10k/iridium": "~0.0.3",
28
28
  "@koa/bodyparser": "^6.1.0",
29
29
  "@koa/cors": "^5.0.0",
30
30
  "@koa/router": "^15.7.1",