@a10k/iridium-dev-server 0.0.1 → 0.0.2
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 +15 -8
- package/package.json +2 -2
package/Readme.md
CHANGED
|
@@ -19,7 +19,7 @@ mkdir my-notebooks && cd my-notebooks
|
|
|
19
19
|
npx @a10k/iridium-dev-server
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Open http://localhost:8080/ to edit the `index` notebook, or http://localhost:8080/my-notebook for any other (it's created on first save). Write a cell, run it with Shift+Enter, save with ⌘S / Ctrl+S.
|
|
22
|
+
Open http://localhost:8080/ to edit the `index` notebook, or http://localhost:8080/my-notebook for any other (it's created on first save). Write a cell, run it with Shift+Enter, save with ⌘S / Ctrl+S. Running or saving writes the notebook file and its compiled module (`<name>.js`).
|
|
23
23
|
|
|
24
24
|
Try these cells, one per cell:
|
|
25
25
|
|
|
@@ -53,21 +53,28 @@ or install it globally to get the `iridium-dev-server` command everywhere:
|
|
|
53
53
|
npm i -g @a10k/iridium-dev-server
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
##
|
|
56
|
+
## Importing other notebooks
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
Every saved notebook is also compiled to `<name>.js` next to it, so one notebook can import cells from another with a path starting `./`, `../` or `/`:
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
import { points } from "./my-data.js"
|
|
60
62
|
```
|
|
61
63
|
|
|
62
|
-
|
|
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.
|
|
63
65
|
|
|
64
66
|
## Notebook list API
|
|
65
67
|
|
|
66
|
-
`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:
|
|
68
|
+
`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:
|
|
67
69
|
|
|
68
70
|
```json
|
|
69
|
-
{
|
|
70
|
-
"
|
|
71
|
+
{
|
|
72
|
+
"q": "my", "sort": "name", "page": 1, "per_page": 25, "pages": 1, "total": 2,
|
|
73
|
+
"items": [
|
|
74
|
+
{ "name": "my-data", "title": "my-data", "url": "/my-data", "modified": "2026-11-21T10:00:00.000Z", "cells": 3, "size": 812 },
|
|
75
|
+
{ "name": "my-notebook", "title": "my-notebook", "url": "/my-notebook", "modified": "2026-11-21T10:05:00.000Z", "cells": 5, "size": 1240 }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
71
78
|
```
|
|
72
79
|
|
|
73
80
|
`DELETE /api/notebooks/<name>` moves a notebook and its attachments folder to the Trash (macOS's, restorable with Put Back; elsewhere a `.trash` folder in the notebooks folder) and removes its compiled module.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a10k/iridium-dev-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
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.
|
|
27
|
+
"@a10k/iridium": "~0.0.2",
|
|
28
28
|
"@koa/bodyparser": "^6.1.0",
|
|
29
29
|
"@koa/cors": "^5.0.0",
|
|
30
30
|
"@koa/router": "^15.7.1",
|