@ksp-gonogo/uplink-tools 1.0.0-rc.45 → 1.0.0

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.
Files changed (38) hide show
  1. package/README.md +78 -159
  2. package/dist/{chunk-N7NLFVCK.js → chunk-BHA6GXF5.js} +2 -2
  3. package/dist/{chunk-N7NLFVCK.js.map → chunk-BHA6GXF5.js.map} +1 -1
  4. package/dist/{chunk-24KVRREH.js → chunk-DSA2DIHM.js} +5171 -1550
  5. package/dist/chunk-DSA2DIHM.js.map +1 -0
  6. package/dist/{chunk-DQATZYFD.js → chunk-EBBMJNMG.js} +1 -1
  7. package/dist/chunk-EBBMJNMG.js.map +1 -0
  8. package/dist/{chunk-4WWFAILC.js → chunk-IXUPEUNQ.js} +139 -55
  9. package/dist/chunk-IXUPEUNQ.js.map +1 -0
  10. package/dist/{chunk-N6KXVEMO.js → chunk-RIB2IDDC.js} +141 -48
  11. package/dist/chunk-RIB2IDDC.js.map +1 -0
  12. package/dist/{chunk-I2U7BD63.js → chunk-VDIP7LC6.js} +1 -1
  13. package/dist/chunk-VDIP7LC6.js.map +1 -0
  14. package/dist/{cli-KPHWD6JH.js → cli-FAY33Q5H.js} +10 -5
  15. package/dist/{cli-KPHWD6JH.js.map → cli-FAY33Q5H.js.map} +1 -1
  16. package/dist/cli.js +3 -3
  17. package/dist/index.d.ts +49 -7
  18. package/dist/index.js +6 -6
  19. package/dist/index.js.map +1 -1
  20. package/dist/{minsize-6NUK65Q3.js → minsize-KU6NBZ4V.js} +6 -4
  21. package/dist/minsize-KU6NBZ4V.js.map +1 -0
  22. package/dist/page-check.js +70 -9
  23. package/dist/page-check.js.map +1 -1
  24. package/dist/render-probe.d.ts +3 -3
  25. package/dist/render-probe.js +2 -2
  26. package/dist/render-probe.js.map +1 -1
  27. package/dist/{story-AC6BHGQH.js → story-OTUTTZGI.js} +3 -3
  28. package/dist/widgets.js +24120 -14881
  29. package/dist/widgets.js.map +1 -1
  30. package/dist/widgets.json +798 -404
  31. package/package.json +4 -4
  32. package/dist/chunk-24KVRREH.js.map +0 -1
  33. package/dist/chunk-4WWFAILC.js.map +0 -1
  34. package/dist/chunk-DQATZYFD.js.map +0 -1
  35. package/dist/chunk-I2U7BD63.js.map +0 -1
  36. package/dist/chunk-N6KXVEMO.js.map +0 -1
  37. package/dist/minsize-6NUK65Q3.js.map +0 -1
  38. /package/dist/{story-AC6BHGQH.js.map → story-OTUTTZGI.js.map} +0 -0
package/README.md CHANGED
@@ -1,143 +1,82 @@
1
1
  # @ksp-gonogo/uplink-tools
2
2
 
3
- The Uplink author's toolchain: it scaffolds an Uplink, bundles its client,
4
- renders its scenes in a real browser, generates its page, and supplies the app's
5
- own widgets as the host widgets an augment is drawn inside.
3
+ The command line and test harness for writing an Uplink, the extension that connects a KSP mod to the Gonogo app. It scaffolds an Uplink, bundles its client, draws its widgets in a real browser, writes its generated page and releases it. It also supplies the app's own widgets, so a widget that extends one can be drawn inside it.
6
4
 
7
- It is a **devDependency**. Nothing here ships in an Uplink's bundle.
5
+ It is a devDependency. Nothing in it ships in an Uplink's bundle.
8
6
 
9
- ## The command line
7
+ **The [Uplink developer docs](https://ksp-gonogo.github.io/uplink-dev-docs/) are the guide to using it**, and the [command-line reference](https://ksp-gonogo.github.io/uplink-dev-docs/reference/tools/command-line) lists every command and flag. This page holds what the docs link here for, and what only the package page can say.
10
8
 
11
- One command, `uplink-tools`, and nothing to install before the first run. Until the first release, `latest` is a placeholder, so run the release candidate with `@rc`.
9
+ ## Run it
12
10
 
11
+ Nothing needs installing first. Until the first release, `latest` is a placeholder, so run the release candidate with `@rc`. In an empty directory named for the Uplink:
13
12
 
14
13
  ```sh
15
- npx @ksp-gonogo/uplink-tools@rc new myuplink --repo acme/myuplink # in an empty directory
14
+ npx @ksp-gonogo/uplink-tools@rc new
16
15
  npx @ksp-gonogo/uplink-tools@rc --help
17
16
  ```
18
17
 
19
- `new` asks what it was not told: the id, a display name, the author, the
20
- repository it will be published from, whether it has Topics of its own, whether
21
- to write a CI workflow, and where KSP is. Every question is also a flag
22
- (`uplink-tools new --help` lists them), and `--yes` takes the default for the
23
- rest. With no terminal it never asks: it stops, writes nothing and names each
24
- missing flag, so a script or an agent can fix its call in one go.
18
+ `new` needs Node and the .NET SDK, and leaves an Uplink whose tests pass. It asks what it was not told, and every question is also a flag, so a script passes them instead. [Your first Uplink](https://ksp-gonogo.github.io/uplink-dev-docs/guide/first-uplink) covers the answers and the files it writes.
25
19
 
26
- `new` writes the Uplink and then runs its generators, so the directory it leaves
27
- builds and tests: `npm test` in `client/`, and `dotnet test mod-tests`. It needs
28
- Node and the .NET SDK, and no clone of anything. The C# half reaches Gonogo
29
- through one NuGet package, `KspGonogo.Sitrep.Contract`, at the same version as
30
- this package.
20
+ The package is published at the one Gonogo release version, with `@ksp-gonogo/sitrep-sdk`, `@ksp-gonogo/ui-kit` and the NuGet package `KspGonogo.Sitrep.Contract`. They pin each other exactly, so install them at one version, and move them together. `new` writes every pin. [Building against a release candidate](https://ksp-gonogo.github.io/uplink-dev-docs/guide/release-candidate) covers adding them by hand.
31
21
 
32
- Once it is in an Uplink's devDependencies the same commands answer to
33
- `uplink-tools` in a `package.json` script, which is what a workflow calls:
22
+ Once the package is in an Uplink's devDependencies, the same commands answer to `uplink-tools` in a `package.json` script. Every command takes `--help` and refuses a flag it does not read.
34
23
 
35
- | command | what it does |
36
- |---|---|
37
- | `new <id>` | scaffold an Uplink: contract slice, plugin, tests, one widget and its fixture, then generate its client types, install the client and write its page. In a repo with an `uplinks/` folder it goes to `uplinks/<id>/`; anywhere else the current directory becomes the Uplink |
38
- | `codegen` | generate `client/src/__generated__/` from the C# contract slice; `codegen --check` fails on drift |
39
- | `check` | read the client with TypeScript (an optional peer, installed in every scaffold) and report what is unresolved or stale, with the command that heals each finding. Exits 0 clean, 1 when findings remain, 2 when it could not run; `--fix` writes the files it owns and is refused when `CI` is set; `--json`, `--only` and `--skip` take its groups. A read it cannot name takes a `// gonogo:reads <topic or family>` comment above the call. A frame whose built-in augment does all the reading keeps its `channels` and `fields` with a `// gonogo:augment-reads <augment id> <channel>...` comment above its `registerComponent`; `check` requires every channel named to appear in that augment's own `channels` |
40
- | `bundle` | build the client bundle the app loads, and the `gonogo-uplink.json` beside it; `--watch` rebuilds on every change and `--serve <port>` also serves it from this computer |
41
- | `bake` | write what the plugin tells the app about its client into C#: where the bundle lives, who wrote it, and the hash the mod vouches for |
42
- | `package` | lay the built plugin out as `GameData/<name>/` and zip it with that as the zip's one root, which is what a hand install and CKAN both expect; it refuses a netkan whose install stanza names a path the zip does not hold |
43
- | `release` | `bundle`, `bake`, compile the plugin, check the DLL carries what was baked, and `package`, in that order. It refuses when the Uplink's version is not the same in `client/package.json`, in `defineUplinkClient` and in the version folder of `client.url` |
44
- | `page` | write `README.md`, `gonogo-uplink.json`, `docs/widgets.json` and `docs/spec.json` from what the client registers, with no browser |
45
- | `render` | render every scene to `renders/` |
46
- | `story <id>` | render one Storybook story to a PNG, or to a GIF when the story is tagged `playback`; see below |
47
- | `docs` | write `README.md`, `gonogo-uplink.json`, `docs/widgets.json`, `docs/spec.json` and `docs/assets/`; `docs --check` fails on drift |
48
-
49
- ### Seeing a build in the app
50
-
51
- With a checkout of the gonogo app, run `uplink-tools bundle --watch` in the
52
- Uplink's `client/` and, from the app checkout, `pnpm dev --uplink <path>`, where
53
- `<path>` is the directory holding `uplink.json`. Repeat the flag for several
54
- Uplinks. The dev app loads each one's build output with no mod report, hash or
55
- consent prompt, still checks its contract and the bytes it fetched, lists it in
56
- Settings under Local builds, and reloads the page on every rebuild. An Uplink
57
- without an `uplink.json` is refused. Without a checkout, `bundle --serve <port>`
58
- with `bake --dev-path` serves a client to an app that is already running.
59
-
60
- ### Rendering a Storybook story
61
-
62
- `story` draws one story of any built Storybook, or a running one, and needs
63
- nothing of the Uplink around it:
24
+ ## The commands
64
25
 
65
- ```
66
- uplink-tools story widgets-landing-status-descent-playback--crash-landing
67
- uplink-tools story --list landing # the ids that contain "landing"
68
- uplink-tools story <id> --png # the first settled frame of a playback story
69
- uplink-tools story <id> --chrome # the whole story frame, controls and captions included
70
- uplink-tools story <id> --seconds 8 --fps 15 --size 900x700 --out clip.gif
71
- ```
72
-
73
- It reads the build from `./storybook-static` (`--storybook <dir|url>` points
74
- elsewhere) and writes `renders/<id>.png`. The picture is the widget alone, cropped to the element
75
- the story marks `data-story-widget` (every marked element, when a story has
76
- several); `--chrome` draws the whole story frame instead, and a story with no
77
- marker is drawn whole. A story whose meta carries the tag
78
- `playback` renders as a GIF instead: it clicks the story's Replay or Play
79
- button, the one marked `data-story-start` or else named Replay or Play, once the
80
- story has rendered even when it is outside the crop (`--start <name>` names another), records
81
- for `--seconds` (default 6) at `--fps` (default 10), and is saved as
82
- `renders/<id>.gif`. A story that starts on its own needs no button. A GIF
83
- carries no sound, and Chromium is launched muted, so a Play control can be
84
- pressed without noise. In the gonogo repository `pnpm render-story <id>`
85
- does the same and builds the Storybook first when there is no build.
86
-
87
- The order inside `release` is the point of it. The app loads an installed
88
- Uplink's client only when the plugin says where the bundle lives and vouches for
89
- its hash, so the bundle has to be built and hashed before the plugin is
90
- compiled. A plugin baked without its bundle builds, tests green, and shows no
91
- widget.
92
-
93
- ### Working on the client without rebuilding the plugin
94
-
95
- A hash goes stale the moment the client changes, so a development loop uses a
96
- plugin that vouches for none. The app loads its client anyway on two conditions,
97
- both required: the plugin declares a dev path, and that path is on the computer
98
- the app is open on (`localhost`, `127.0.0.1` or `[::1]`). It says in words, on
99
- the Uplink's status page and on every widget the Uplink draws, that an unvouched
100
- development client is running.
26
+ | Command | What it does |
27
+ |---|---|
28
+ | `new` | scaffold an Uplink and generate, install and write its page; `--no-client` writes the plugin alone, for an Uplink that wraps another mod and has nothing to draw, and with `--topics own` it also writes `types/`, a package of just the generated types of its Topics, for other Uplinks' clients to read them by |
29
+ | `add <kind> <name>` | add a widget, augment, contribution, processor, setting or unit to the client from the templates `new` writes, and import it from `client/src/index.ts`; it never overwrites a file |
30
+ | `codegen` | write `client/src/__generated__/` (`types/src/__generated__/` when there is no client) from the C# contract slice; `--check` fails on drift |
31
+ | `check` | read the client with TypeScript and report what is stale or unresolved, with the command that heals each finding |
32
+ | `bundle` | build the client bundle the app loads, and its `gonogo-uplink.json`; `--watch` rebuilds on every change and `--serve <port>` also serves it |
33
+ | `bake` | write what the plugin tells the app about its client into C#: where the bundle lives, who wrote it and its hash |
34
+ | `package` | lay the built plugin out as `GameData/<name>/` and zip it |
35
+ | `release` | `bundle`, `bake`, compile the plugin, check the DLL carries what was baked, and `package`; `release prepare` stamps the version and proves a release builds in a scratch folder; an Uplink with no client runs only the release step |
36
+ | `version` | stamp the release version in every place an Uplink writes it; an Uplink with no client has no version to stamp but its types package's `package.json`, and its plugin takes the version from `GONOGO_UPLINK_VERSION` |
37
+ | `publish` | copy the released client to where `client.url` is served from, and say the links |
38
+ | `deps` | read every dependency the Uplink pins against each channel it is published on; `deps bump` moves the pins that are behind and `deps pin-ckan` writes the CKAN spelling of the pin |
39
+ | `page` | write the generated page from what the client registers, with no browser |
40
+ | `render` | draw every fixture to `renders/` |
41
+ | `docs` | write the page and draw its pictures; `docs --check` fails on drift |
42
+ | `story <id>` | draw one Storybook story to a PNG, or to a GIF when the story is tagged `playback` |
43
+
44
+ [Releasing and installing](https://ksp-gonogo.github.io/uplink-dev-docs/guide/release) covers the release order, and [See your Uplink in the app](https://ksp-gonogo.github.io/uplink-dev-docs/guide/dev-loop) covers `bundle --watch` and `--serve`.
45
+
46
+ ### Declaring the channels a mod publishes on
47
+
48
+ `deps` reads the `mod` block of `uplink.json`. `channels` lists every place the wrapped mod publishes, CKAN first where it is listed, and a dependency is read on each of them, so one that lags shows as lagging:
101
49
 
102
- ```sh
103
- cd client
104
- npx uplink-tools bundle --serve 5173 # leave running: rebuilds and serves on every change
105
- npx uplink-tools bake --dev-path http://localhost:5173/<id>.client.js
106
- dotnet build ../mod -c Release # once, then copy the DLLs into GameData/<name>/Plugins
50
+ ```json
51
+ "mod": {
52
+ "name": "Kerbcast",
53
+ "tier": "ckan",
54
+ "ckan": "Kerbcast",
55
+ "builtAgainst": "1.11.0",
56
+ "channels": [{ "ckan": "Kerbcast" }, { "github": "ksp-gonogo/kerbcast" }, { "spacedock": 4366 }],
57
+ "packages": ["@ksp-gonogo/kerbcast", "@ksp-gonogo/kerbcast-react"]
58
+ }
107
59
  ```
108
60
 
109
- Reload the app after a change to the client. The plugin is compiled again only
110
- when the C# changes. A dev path anywhere else is refused with the reason, and so
111
- is a station, which takes its bundles from the main screen. `release` does not
112
- zip a plugin baked with a dev path unless it is told `--allow-dev-package`.
113
-
114
- Every command takes `--help`, and refuses a flag it does not read.
61
+ | Kind | Newest means |
62
+ |---|---|
63
+ | `{ "ckan": "<identifier>" }` | the highest `stable` CKAN-meta entry, by CKAN's own ordering |
64
+ | `{ "github": "owner/repo", "tag"?, "asset"? }` | the release GitHub marks latest, never a prerelease; `tag` is a regular expression whose `version` group reads the version from the tag, and `asset` picks the archive a bump downloads |
65
+ | `{ "githubTags": "owner/repo", "pattern": "^(?<order>\\d{10})-" }` | the highest `order` among the matching tags, for a mod that releases by tag |
66
+ | `{ "spacedock": 1685 }` | the first version SpaceDock lists |
67
+ | `{ "npm": "<package>", "distTag"?: "latest" }` | that dist-tag, never the highest version |
115
68
 
116
- ## What is in it
69
+ `packages` are npm packages that move with the mod, pinned exactly in `client/package.json`. A `ckanDepends` entry may carry `channels` too. `ckanVersion` is the pinned release as CKAN lists it, which is what a CKAN relationship's `min_version` carries. An Uplink on the `ckan` tier should list the CKAN channel, and a pin that names a prerelease is an error in `check` on `main` and a refusal in `release`.
117
70
 
118
- | entry | what it is |
119
- |---|---|
120
- | `@ksp-gonogo/uplink-tools` | the harness API and the `uplink-tools` command's `run`. Node: esbuild, Playwright, the filesystem |
121
- | `@ksp-gonogo/uplink-tools/render-probe` | the browser half, which mounts a widget in the page the harness builds |
122
- | `@ksp-gonogo/uplink-tools/page-check` | the assertion an Uplink's own suite runs to keep its committed page honest. Deliberately free of Playwright, so an author with no browser can still run it |
123
- | `@ksp-gonogo/uplink-tools/widgets` | the app's own widgets, registered, so a scene can name one as its `_scene.hostWidget` |
71
+ `deps` exits 0 when nothing is behind, 10 when something is and 2 when a channel could not be read. `--json` prints `uplink-deps/1`. `deps bump` runs the Uplink's checks against the new pins and writes an `uplink-bump/1` result (`--result <file>`) with the verdict `green`, `red` or `unverified`, and touches no git.
124
72
 
125
- You will not usually import the first of these: the command line runs it.
73
+ ### Annotating a read `check` cannot name
126
74
 
127
- `uplink-tools docs` writes `README.md` at the Uplink's root, beside
128
- `uplink.json`, where a visitor to the Uplink's folder reads it, with an Install
129
- section (CKAN, then the release zip) and a link to the Uplink's releases. It
130
- writes `gonogo-uplink.json` and `docs/widgets.json` in the client, the record of each widget you register. The README's widget
131
- sections are rendered from those records. `docs/spec.json` is the spec sheet: the
132
- whole Uplink as data (Topics with delivery and delay, commands, widgets, the
133
- slots it fills, models, error codes and the contract it was built against), for
134
- a developer or a tool reading someone else's Uplink. `docs --check` and
135
- `expectUplinkPageCurrent` fail when any of the four no longer matches your
136
- registrations. Commit all four.
75
+ A read of a Topic chosen at runtime takes a `// gonogo:reads <topic or family>` comment above the call. A frame whose built-in augment does all the reading keeps its `channels` and `fields` with a `// gonogo:augment-reads <augment id> <channel>...` comment above its `registerComponent`, and `check` requires every channel named to appear in that augment's own `channels`.
137
76
 
138
77
  ## What a fixture puts on the stream
139
78
 
140
- A fixture's `_stream` block is the wire its scene is fed from:
79
+ A fixture's `_stream` block is the wire its scene is drawn from. [Testing](https://ksp-gonogo.github.io/uplink-dev-docs/guide/testing#fixtures) covers fixtures; this is the detail of each field.
141
80
 
142
81
  ```json
143
82
  {
@@ -153,34 +92,20 @@ A fixture's `_stream` block is the wire its scene is fed from:
153
92
  }
154
93
  ```
155
94
 
156
- | field | what it does |
95
+ | Field | What it does |
157
96
  |---|---|
158
- | `emits` | replayed once the scene has subscribed, in the order written, or in the order sent under `delaySeconds`. An entry's `validAt` is the instant it was sent; with none it was sent at `pinnedUt` |
159
- | `pinnedUt` | the operator's view time, which the scene is drawn at when it has no `delaySeconds`. Defaults to `1000000` |
97
+ | `emits` | replayed once the scene has subscribed, in the order written, or in the order sent under `delaySeconds`. An entry's `validAt` is the game time it was sent; with none it was sent at `pinnedUt` |
98
+ | `pinnedUt` | the game time of the operator's view, which the scene is drawn at when it has no `delaySeconds`. Defaults to `1000000` |
160
99
  | `stopsArriving` | drop the link once every emit has landed, so the picture is of figures that are held |
161
100
  | `delaySeconds` | a one-way light time between the craft and the screen, in seconds |
162
101
 
163
- **`delaySeconds`** stages what an operator sees across a light time. Each
164
- reading sent at `validAt` is delivered `delaySeconds` later, the view time is
165
- the newest `validAt` delivered (an emit naming none counts as `pinnedUt`), and
166
- the craft's present runs one light time ahead of it.
167
- Every reading is reckoned to that present exactly as it is in the app, so a
168
- scene can show a modelled figure beside the observed one, drawn with the kit's
169
- modelled mark. Without it, or at `0`, the view time and the craft's present are
170
- one instant and nothing is carried across. A reckoner that fits a trend needs
171
- more than one reading, so give those emits a history of `validAt`s. If your
172
- widget reads the light time off `comms.delay`, emit that too: the delay stages
173
- the clock, not the topic.
102
+ With `delaySeconds`, each reading sent at `validAt` is delivered that many seconds later. The view time is the newest `validAt` delivered, with an emit naming none counting as `pinnedUt`, and the craft's present runs one light time ahead of it. Every reading is reckoned to that present as the app does, so a scene can show a modelled figure beside the observed one, drawn with the kit's modelled mark. Without it, or at `0`, the view time and the craft's present are one instant and nothing is carried across.
174
103
 
175
- Under a delay an `advanceUt` step moves the craft's present and leaves the view
176
- time where it is until something newer is delivered, so a negative `advanceUt`
177
- is refused.
104
+ A reckoner that fits a trend needs more than one reading, so give those emits a history of `validAt`s. A widget that reads the light time off `comms.delay` needs that emitted too: the delay stages the clock, not the Topic. Under a delay an `advanceUt` step moves the craft's present and leaves the view time where it is until something newer is delivered, so a negative `advanceUt` is refused.
178
105
 
179
- ## Using the host widgets
106
+ ## Drawing a widget that extends an app widget
180
107
 
181
- An Uplink's docs page shows its widgets, and some of them are an AUGMENT or a
182
- CONTRIBUTION into a widget that ships with the app. To draw one honestly you
183
- need the widget around it:
108
+ An augment or contribution is drawn inside a widget that ships with the app, so its picture needs that widget around it. Name the host widgets in the client's `package.json`:
184
109
 
185
110
  ```json
186
111
  {
@@ -193,37 +118,31 @@ need the widget around it:
193
118
  }
194
119
  ```
195
120
 
196
- A fixture can then name the widget it extends:
121
+ A fixture then names the widget it extends:
197
122
 
198
123
  ```json
199
124
  { "_scene": { "hostWidget": "administration-building" } }
200
125
  ```
201
126
 
202
- There is nothing to `import` from `/widgets`. It exports no symbols: importing it
203
- runs the app widgets' own registrations, which is all the harness needs to
204
- resolve a scene's `hostWidget`.
127
+ `/widgets` exports no symbols: importing it registers the app's own widgets, which is all the harness needs to resolve a scene's `hostWidget`. It is for the generated page only. Name it in `devDependencies` and in `gonogo.renderWith`, never in `dependencies`, and never import it from the client. For a component of it in real use, ask for that component in `@ksp-gonogo/ui-kit`.
205
128
 
206
- **`/widgets` is for the docs page only.** Name it in `devDependencies` and in
207
- `gonogo.renderWith`, and nowhere else: never put `@ksp-gonogo/uplink-tools` in
208
- `dependencies`, and never import `/widgets` from your client. If you want one
209
- of its components for real use, ask for that component in `@ksp-gonogo/ui-kit`.
129
+ The harness draws a scene that names no host in a stand-in widget, whose `Panel` draws the widget's `<id>.badges` slot, so a badge contribution needs no host. Every other slot, such as `administration-building.screens`, `space-center-status.facilities` and `astronaut-complex.readouts`, is drawn by the host widget's own body, and a stand-in draws nothing there, so name the real widget.
210
130
 
211
- ## Why a stand-in is not enough
131
+ ## Entry points
132
+
133
+ | Entry | What it is |
134
+ |---|---|
135
+ | `@ksp-gonogo/uplink-tools` | the harness API and the `uplink-tools` command's `run`. Node only: esbuild, Playwright and the filesystem |
136
+ | `@ksp-gonogo/uplink-tools/render-probe` | the browser half, which mounts a widget in the page the harness builds |
137
+ | `@ksp-gonogo/uplink-tools/page-check` | the assertion an Uplink's own suite runs to keep its committed page current. It needs no Playwright, so an author with no browser can run it |
138
+ | `@ksp-gonogo/uplink-tools/widget-facts` | the fact rows of a widget as the generated page lists them |
139
+ | `@ksp-gonogo/uplink-tools/widgets` | the app's own widgets, registered, so a scene can name one as its `_scene.hostWidget` |
140
+ | `@ksp-gonogo/uplink-tools/widgets.json` | the manifest of those widgets, as data |
212
141
 
213
- The harness already synthesises a stand-in for a scene that names none, and it
214
- covers more than you would expect: an augment mounts in that stand-in's `Panel`,
215
- and `Panel` draws every widget's `<id>.badges` itself, so a badge contribution
216
- lands there exactly as it lands in the real widget.
142
+ An author seldom imports any of these: the command line runs the first, and `page-check` is the one a test names.
217
143
 
218
- Every **other** contribution slot is drawn by the host widget's own body, and a
219
- stand-in's body draws nothing. `administration-building.screens`,
220
- `space-center-status.facilities` and `astronaut-complex.readouts` are each read
221
- by a `useContributions(...)` inside the widget. Standing in for those produces a
222
- blank frame that reports success. A real widget's own body is the only thing that draws
223
- them.
144
+ `@ksp-gonogo/ui-kit` is an optional peer dependency, at the version of this package. The harness draws with the kit and its `/grid` and `/testing` entries, and the app widgets behind `/widgets` are built on it.
224
145
 
225
- ## Its relation to `@ksp-gonogo/ui-kit`
146
+ ## Licence
226
147
 
227
- `@ksp-gonogo/ui-kit` is a peer dependency: install the two at matching
228
- versions. The harness draws with the kit and its `/grid` and `/testing`
229
- entries, and the app widgets behind `/widgets` are built on it.
148
+ MIT
@@ -34,7 +34,7 @@ function buildUplinkSpec(pkg, inventory, wire, widgets) {
34
34
  models: {
35
35
  processors: [...inventory.processors].sort(),
36
36
  forwardModels: [...inventory.reckonedTopics].sort(),
37
- derivedChannels: [...inventory.derivedChannels].sort(),
37
+ publishedTopics: [...inventory.publishedTopics].sort(),
38
38
  inputRuleExemptions: [...inventory.reckonerExemptions].sort(
39
39
  (a, b) => a.topic.localeCompare(b.topic)
40
40
  )
@@ -93,4 +93,4 @@ export {
93
93
  WIDGET_RECORDS_FILE,
94
94
  widgetRecordsJson
95
95
  };
96
- //# sourceMappingURL=chunk-N7NLFVCK.js.map
96
+ //# sourceMappingURL=chunk-BHA6GXF5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/spec.ts","../src/render/widgetRecord.ts"],"sourcesContent":["import { readUplinkDeclaration } from \"@ksp-gonogo/sitrep-sdk/uplink-manifest\";\nimport type {\n InventoryAugment,\n InventoryContribution,\n InventoryErrorCode,\n InventoryReckonerExemption,\n UplinkInventory,\n} from \"../render-probe\";\nimport type { UplinkPackage } from \"./context\";\nimport type { WidgetRecord } from \"./widgetRecord\";\nimport type {\n WireChannel,\n WireCommand,\n WirePayload,\n WireSurface,\n} from \"./wire\";\n\n/**\n * Where `uplink-tools docs` and `uplink-tools page` write an Uplink's spec\n * sheet, relative to its client package. Committed beside the README and\n * checked with it. Useful for showing an Uplink author where the spec sheet is\n * committed. Used by `uplink-tools page` and `uplink-tools docs`, and by the\n * check that the page is current.\n *\n * @category Uplink page\n */\nexport const SPEC_FILE = \"docs/spec.json\";\n\n/**\n * The version of the spec sheet's own shape. A reader that finds a number it\n * does not know should not guess at the fields. Useful for showing an Uplink\n * author which shape of spec sheet a file holds. Used by {@link\n * buildUplinkSpec}.\n *\n * @category Uplink page\n */\nexport const SPEC_VERSION = 1;\n\n/**\n * An Uplink described as data: everything its README lists, for a developer or\n * a tool that reads another author's Uplink. It holds only strings, numbers,\n * booleans, lists and objects, so it can be rendered as text with no markup and\n * no code run.\n *\n * Useful for a developer deciding whether an Uplink's Topics, commands and\n * slots fit what they are building. Written by `uplink-tools page` and\n * `uplink-tools docs`.\n *\n * It does not carry the contract and extension API the client was built\n * against: `gonogo-uplink.json` beside it holds those numbers, and the README\n * prints them in its \"Built against\" row.\n *\n * @category Uplink page\n */\nexport interface UplinkSpec {\n /** The shape version of this file, {@link SPEC_VERSION}. */\n specVersion: number;\n /** Who the Uplink is. */\n uplink: {\n id: string;\n name: string;\n version: string;\n description: string;\n /** The game mod it wraps, when its `uplink.json` names one. */\n wraps: { name: string; builtAgainst?: string; tier?: string } | null;\n };\n /** The Topics it publishes, each with its delivery and delay when the C# declaration could be read. */\n topics: WireChannel[];\n /** Payload shapes reached through a Topic's fields. */\n nestedPayloads: WirePayload[];\n /** Payload shapes no listed Topic routes to. */\n otherPayloads: WirePayload[];\n /** The commands it accepts. */\n commands: WireCommand[];\n /** The argument shapes those commands take. */\n commandArgs: WirePayload[];\n /** The widgets it registers. */\n widgets: WidgetRecord[];\n /** The slots it fills in other widgets. */\n augments: InventoryAugment[];\n /** The values it contributes to named slots. */\n contributions: InventoryContribution[];\n /** The models it runs. */\n models: {\n processors: string[];\n forwardModels: string[];\n derivedChannels: string[];\n inputRuleExemptions: InventoryReckonerExemption[];\n };\n /** The refusal refinements it answers with. */\n errorCodes: InventoryErrorCode[];\n}\n\nfunction byId<Item extends { id: string }>(items: readonly Item[]): Item[] {\n return [...items].sort((a, b) => a.id.localeCompare(b.id));\n}\n\nfunction byName(items: readonly WirePayload[]): WirePayload[] {\n return [...items].sort((a, b) => a.name.localeCompare(b.name));\n}\n\n/**\n * The Uplink's spec sheet, built from the same inventory and wire surface its\n * README is built from. Every list is ordered by id, so the file is the same on\n * every machine. Useful for showing an Uplink author a machine-readable\n * description of their Uplink, beside the README. Used by `uplink-tools page`\n * and `uplink-tools docs`, and by the check that the page is current.\n *\n * @category Uplink page\n */\nexport function buildUplinkSpec(\n pkg: UplinkPackage,\n inventory: UplinkInventory,\n wire: WireSurface,\n widgets: readonly WidgetRecord[],\n): UplinkSpec {\n const mod = readUplinkDeclaration(pkg.dir)?.declared.mod;\n return {\n specVersion: SPEC_VERSION,\n uplink: {\n id: inventory.id,\n name: inventory.name,\n version: inventory.version,\n description: (inventory.description ?? \"\").replace(/\\s+/g, \" \").trim(),\n wraps: mod?.name\n ? {\n name: mod.name,\n ...(mod.builtAgainst ? { builtAgainst: mod.builtAgainst } : {}),\n ...(mod.tier ? { tier: mod.tier } : {}),\n }\n : null,\n },\n topics: byId(wire.channels),\n nestedPayloads: byName(wire.nested),\n otherPayloads: byName(wire.payloads),\n commands: byId(wire.commands),\n commandArgs: byName(wire.argShapes),\n widgets: byId(widgets),\n augments: byId(inventory.augments),\n contributions: byId(inventory.contributions),\n models: {\n processors: [...inventory.processors].sort(),\n forwardModels: [...inventory.reckonedTopics].sort(),\n derivedChannels: [...inventory.derivedChannels].sort(),\n inputRuleExemptions: [...inventory.reckonerExemptions].sort((a, b) =>\n a.topic.localeCompare(b.topic),\n ),\n },\n errorCodes: byId(inventory.errorCodes ?? []),\n };\n}\n\n/**\n * The spec sheet as the file holds it: two-space indented JSON ending in a\n * newline. Useful for showing an Uplink author the spec sheet as it is\n * committed. Used by `uplink-tools page` and `uplink-tools docs`, and by the\n * check that the page is current.\n *\n * @category Uplink page\n */\nexport function uplinkSpecJson(spec: UplinkSpec): string {\n return `${JSON.stringify(spec, null, 2)}\\n`;\n}\n","import type { ComponentDefinition } from \"@ksp-gonogo/sitrep-sdk\";\n\n/**\n * Everything an author declared about a widget in `registerComponent`, as data.\n * Fields the registration leaves out are empty lists, `false` or `null`, never\n * missing. Useful for describing a widget to an operator the same way on the\n * Uplink's README and on a docs site. Built by the render probe's inventory and\n * written by {@link widgetRecordsJson}.\n *\n * @category Inventory\n * @categoryDescription Inventory\n * What an Uplink client registered, read back as data: its widgets, augments\n * and contributions with everything their registrations declare. The renderer\n * and the generated page both read it.\n */\nexport interface WidgetRecord {\n /** The registered widget id. */\n id: string;\n /** The widget's display name. */\n name: string;\n /** What the widget shows, as the registration describes it. */\n description: string;\n /** The free-form tags the widget is filed under. */\n tags: string[];\n /** The Topics the widget needs to render. */\n channels: string[];\n /** The Topics the widget reads when they are present and draws without otherwise. */\n optionalChannels: string[];\n /** The commands the widget's controls can send, as the registration lists them. */\n commands: string[];\n /** The Topic families the widget needs to render, each as a pattern such as `trackingStation.vessel.<vessel>.link`. */\n channelFamilies: string[];\n /** The Topic families the widget reads when present and draws without otherwise. */\n optionalChannelFamilies: string[];\n /** Whether the Topics the widget reads depend on the widget's settings, as a graph's chosen series do. */\n readsFromConfig: boolean;\n /** The flat data keys an older widget declares instead of `channels`. */\n dataRequirements: string[];\n /** The fields of its Topics the widget draws. */\n fields: string[];\n /** The actions an input can be bound to, each with the label an operator reads and, when the registration gives one, what it does. */\n actions: { id: string; label: string; description: string | null }[];\n /** The augment slots the widget renders, as the registration names them. */\n augmentSlots: string[];\n /** The contribution slots the widget reads, as the registration names them. */\n contributionSlots: string[];\n /** The Domains that must be present for the widget to show. */\n requires: string[];\n /** The id of the widget this one replaces, or `null`. */\n replaces: string | null;\n /** Whether a station can push this widget to the main screen. */\n pushable: boolean;\n /** The size a new widget opens at, in grid units, or `null` for the dashboard's default. */\n defaultSize: { w: number; h: number } | null;\n /** The smallest the widget may be resized to, in grid units, or `null` when unset. */\n minSize: { w: number; h: number } | null;\n /** Whether the widget has a tiny form for the smallest tiles. */\n tiny: boolean;\n}\n\n/**\n * The {@link WidgetRecord} of one registered widget. Useful for keeping the\n * README, the widget records file and the render harness in agreement on every\n * field. Used by the render probe when it reads the inventory.\n */\nexport function widgetRecordOf(def: ComponentDefinition): WidgetRecord {\n return {\n id: def.id,\n name: def.name,\n description: def.description,\n tags: [...def.tags],\n channels: [...(def.channels ?? [])],\n optionalChannels: [...(def.optionalChannels ?? [])],\n commands: [...(def.commands ?? [])],\n channelFamilies: [...(def.channelFamilies ?? [])],\n optionalChannelFamilies: [...(def.optionalChannelFamilies ?? [])],\n readsFromConfig: def.channelsFromConfig !== undefined,\n dataRequirements: (def.dataRequirements ?? []).map((r) => String(r)),\n fields: [...(def.fields ?? [])].map((f) => String(f)),\n actions: (def.actions ?? []).map((a) => ({\n id: a.id,\n label: a.label,\n description: a.description ?? null,\n })),\n augmentSlots: [...(def.augmentSlots ?? [])],\n contributionSlots: [...(def.contributionSlots ?? [])],\n requires: (def.requires ?? []).map((r) => String(r)),\n replaces: def.replaces ?? null,\n pushable: def.pushable === true,\n defaultSize: def.defaultSize\n ? { w: def.defaultSize.w, h: def.defaultSize.h }\n : null,\n minSize: def.minSize ? { w: def.minSize.w, h: def.minSize.h } : null,\n tiny: def.tiny !== undefined,\n };\n}\n\n/**\n * Where `uplink-tools docs` writes an Uplink's widget records, relative to its\n * client package. It is committed beside the README and checked with it. Useful\n * for letting a docs site list the Uplink's widgets. Used by the `docs` command\n * and the page check.\n *\n * @category Uplink page\n */\nexport const WIDGET_RECORDS_FILE = \"docs/widgets.json\";\n\n/**\n * Widget records as the JSON file holds them: `{ \"widgets\": [...] }`, ordered\n * by id, two-space indented, ending in a newline. Each entry may carry extra\n * fields after the record's own. Useful for writing the widget records file.\n * Used by the `docs` command and the page check.\n *\n * @category Uplink page\n */\nexport function widgetRecordsJson<Entry extends WidgetRecord>(\n records: readonly Entry[],\n): string {\n const widgets = [...records].sort((a, b) => a.id.localeCompare(b.id));\n return `${JSON.stringify({ widgets }, null, 2)}\\n`;\n}\n"],"mappings":";AAAA,SAAS,6BAA6B;AA0B/B,IAAM,YAAY;AAUlB,IAAM,eAAe;AAyD5B,SAAS,KAAkC,OAAgC;AACzE,SAAO,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;AAC3D;AAEA,SAAS,OAAO,OAA8C;AAC5D,SAAO,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAC/D;AAWO,SAAS,gBACd,KACA,WACA,MACA,SACY;AACZ,QAAM,MAAM,sBAAsB,IAAI,GAAG,GAAG,SAAS;AACrD,SAAO;AAAA,IACL,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,IAAI,UAAU;AAAA,MACd,MAAM,UAAU;AAAA,MAChB,SAAS,UAAU;AAAA,MACnB,cAAc,UAAU,eAAe,IAAI,QAAQ,QAAQ,GAAG,EAAE,KAAK;AAAA,MACrE,OAAO,KAAK,OACR;AAAA,QACE,MAAM,IAAI;AAAA,QACV,GAAI,IAAI,eAAe,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src/render/widgetRecord.ts"],"sourcesContent":["import { readUplinkDeclaration } from \"@ksp-gonogo/sitrep-sdk/uplink-manifest\";\nimport type {\n InventoryAugment,\n InventoryContribution,\n InventoryErrorCode,\n InventoryReckonerExemption,\n UplinkInventory,\n} from \"../render-probe\";\nimport type { UplinkPackage } from \"./context\";\nimport type { WidgetRecord } from \"./widgetRecord\";\nimport type {\n WireChannel,\n WireCommand,\n WirePayload,\n WireSurface,\n} from \"./wire\";\n\n/**\n * Where `uplink-tools docs` and `uplink-tools page` write an Uplink's spec\n * sheet, relative to its client package. Committed beside the README and\n * checked with it. Useful for showing an Uplink author where the spec sheet is\n * committed. Used by `uplink-tools page` and `uplink-tools docs`, and by the\n * check that the page is current.\n *\n * @category Uplink page\n */\nexport const SPEC_FILE = \"docs/spec.json\";\n\n/**\n * The version of the spec sheet's own shape. A reader that finds a number it\n * does not know should not guess at the fields. Useful for showing an Uplink\n * author which shape of spec sheet a file holds. Used by {@link\n * buildUplinkSpec}.\n *\n * @category Uplink page\n */\nexport const SPEC_VERSION = 1;\n\n/**\n * An Uplink described as data: everything its README lists, for a developer or\n * a tool that reads another author's Uplink. It holds only strings, numbers,\n * booleans, lists and objects, so it can be rendered as text with no markup and\n * no code run.\n *\n * Useful for a developer deciding whether an Uplink's Topics, commands and\n * slots fit what they are building. Written by `uplink-tools page` and\n * `uplink-tools docs`.\n *\n * It does not carry the contract and extension API the client was built\n * against: `gonogo-uplink.json` beside it holds those numbers, and the README\n * prints them in its \"Built against\" row.\n *\n * @category Uplink page\n */\nexport interface UplinkSpec {\n /** The shape version of this file, {@link SPEC_VERSION}. */\n specVersion: number;\n /** Who the Uplink is. */\n uplink: {\n id: string;\n name: string;\n version: string;\n description: string;\n /** The game mod it wraps, when its `uplink.json` names one. */\n wraps: { name: string; builtAgainst?: string; tier?: string } | null;\n };\n /** The Topics it publishes, each with its delivery and delay when the C# declaration could be read. */\n topics: WireChannel[];\n /** Payload shapes reached through a Topic's fields. */\n nestedPayloads: WirePayload[];\n /** Payload shapes no listed Topic routes to. */\n otherPayloads: WirePayload[];\n /** The commands it accepts. */\n commands: WireCommand[];\n /** The argument shapes those commands take. */\n commandArgs: WirePayload[];\n /** The widgets it registers. */\n widgets: WidgetRecord[];\n /** The slots it fills in other widgets. */\n augments: InventoryAugment[];\n /** The values it contributes to named slots. */\n contributions: InventoryContribution[];\n /** The models it runs. */\n models: {\n processors: string[];\n forwardModels: string[];\n publishedTopics: string[];\n inputRuleExemptions: InventoryReckonerExemption[];\n };\n /** The refusal refinements it answers with. */\n errorCodes: InventoryErrorCode[];\n}\n\nfunction byId<Item extends { id: string }>(items: readonly Item[]): Item[] {\n return [...items].sort((a, b) => a.id.localeCompare(b.id));\n}\n\nfunction byName(items: readonly WirePayload[]): WirePayload[] {\n return [...items].sort((a, b) => a.name.localeCompare(b.name));\n}\n\n/**\n * The Uplink's spec sheet, built from the same inventory and wire surface its\n * README is built from. Every list is ordered by id, so the file is the same on\n * every machine. Useful for showing an Uplink author a machine-readable\n * description of their Uplink, beside the README. Used by `uplink-tools page`\n * and `uplink-tools docs`, and by the check that the page is current.\n *\n * @category Uplink page\n */\nexport function buildUplinkSpec(\n pkg: UplinkPackage,\n inventory: UplinkInventory,\n wire: WireSurface,\n widgets: readonly WidgetRecord[],\n): UplinkSpec {\n const mod = readUplinkDeclaration(pkg.dir)?.declared.mod;\n return {\n specVersion: SPEC_VERSION,\n uplink: {\n id: inventory.id,\n name: inventory.name,\n version: inventory.version,\n description: (inventory.description ?? \"\").replace(/\\s+/g, \" \").trim(),\n wraps: mod?.name\n ? {\n name: mod.name,\n ...(mod.builtAgainst ? { builtAgainst: mod.builtAgainst } : {}),\n ...(mod.tier ? { tier: mod.tier } : {}),\n }\n : null,\n },\n topics: byId(wire.channels),\n nestedPayloads: byName(wire.nested),\n otherPayloads: byName(wire.payloads),\n commands: byId(wire.commands),\n commandArgs: byName(wire.argShapes),\n widgets: byId(widgets),\n augments: byId(inventory.augments),\n contributions: byId(inventory.contributions),\n models: {\n processors: [...inventory.processors].sort(),\n forwardModels: [...inventory.reckonedTopics].sort(),\n publishedTopics: [...inventory.publishedTopics].sort(),\n inputRuleExemptions: [...inventory.reckonerExemptions].sort((a, b) =>\n a.topic.localeCompare(b.topic),\n ),\n },\n errorCodes: byId(inventory.errorCodes ?? []),\n };\n}\n\n/**\n * The spec sheet as the file holds it: two-space indented JSON ending in a\n * newline. Useful for showing an Uplink author the spec sheet as it is\n * committed. Used by `uplink-tools page` and `uplink-tools docs`, and by the\n * check that the page is current.\n *\n * @category Uplink page\n */\nexport function uplinkSpecJson(spec: UplinkSpec): string {\n return `${JSON.stringify(spec, null, 2)}\\n`;\n}\n","import type { ComponentDefinition } from \"@ksp-gonogo/sitrep-sdk\";\n\n/**\n * Everything an author declared about a widget in `registerComponent`, as data.\n * Fields the registration leaves out are empty lists, `false` or `null`, never\n * missing. Useful for describing a widget to an operator the same way on the\n * Uplink's README and on a docs site. Built by the render probe's inventory and\n * written by {@link widgetRecordsJson}.\n *\n * @category Inventory\n * @categoryDescription Inventory\n * What an Uplink client registered, read back as data: its widgets, augments\n * and contributions with everything their registrations declare. The renderer\n * and the generated page both read it.\n */\nexport interface WidgetRecord {\n /** The registered widget id. */\n id: string;\n /** The widget's display name. */\n name: string;\n /** What the widget shows, as the registration describes it. */\n description: string;\n /** The free-form tags the widget is filed under. */\n tags: string[];\n /** The Topics the widget needs to render. */\n channels: string[];\n /** The Topics the widget reads when they are present and draws without otherwise. */\n optionalChannels: string[];\n /** The commands the widget's controls can send, as the registration lists them. */\n commands: string[];\n /** The Topic families the widget needs to render, each as a pattern such as `trackingStation.vessel.<vessel>.link`. */\n channelFamilies: string[];\n /** The Topic families the widget reads when present and draws without otherwise. */\n optionalChannelFamilies: string[];\n /** Whether the Topics the widget reads depend on the widget's settings, as a graph's chosen series do. */\n readsFromConfig: boolean;\n /** The flat data keys an older widget declares instead of `channels`. */\n dataRequirements: string[];\n /** The fields of its Topics the widget draws. */\n fields: string[];\n /** The actions an input can be bound to, each with the label an operator reads and, when the registration gives one, what it does. */\n actions: { id: string; label: string; description: string | null }[];\n /** The augment slots the widget renders, as the registration names them. */\n augmentSlots: string[];\n /** The contribution slots the widget reads, as the registration names them. */\n contributionSlots: string[];\n /** The Domains that must be present for the widget to show. */\n requires: string[];\n /** The id of the widget this one replaces, or `null`. */\n replaces: string | null;\n /** Whether a station can push this widget to the main screen. */\n pushable: boolean;\n /** The size a new widget opens at, in grid units, or `null` for the dashboard's default. */\n defaultSize: { w: number; h: number } | null;\n /** The smallest the widget may be resized to, in grid units, or `null` when unset. */\n minSize: { w: number; h: number } | null;\n /** Whether the widget has a tiny form for the smallest tiles. */\n tiny: boolean;\n}\n\n/**\n * The {@link WidgetRecord} of one registered widget. Useful for keeping the\n * README, the widget records file and the render harness in agreement on every\n * field. Used by the render probe when it reads the inventory.\n */\nexport function widgetRecordOf(def: ComponentDefinition): WidgetRecord {\n return {\n id: def.id,\n name: def.name,\n description: def.description,\n tags: [...def.tags],\n channels: [...(def.channels ?? [])],\n optionalChannels: [...(def.optionalChannels ?? [])],\n commands: [...(def.commands ?? [])],\n channelFamilies: [...(def.channelFamilies ?? [])],\n optionalChannelFamilies: [...(def.optionalChannelFamilies ?? [])],\n readsFromConfig: def.channelsFromConfig !== undefined,\n dataRequirements: (def.dataRequirements ?? []).map((r) => String(r)),\n fields: [...(def.fields ?? [])].map((f) => String(f)),\n actions: (def.actions ?? []).map((a) => ({\n id: a.id,\n label: a.label,\n description: a.description ?? null,\n })),\n augmentSlots: [...(def.augmentSlots ?? [])],\n contributionSlots: [...(def.contributionSlots ?? [])],\n requires: (def.requires ?? []).map((r) => String(r)),\n replaces: def.replaces ?? null,\n pushable: def.pushable === true,\n defaultSize: def.defaultSize\n ? { w: def.defaultSize.w, h: def.defaultSize.h }\n : null,\n minSize: def.minSize ? { w: def.minSize.w, h: def.minSize.h } : null,\n tiny: def.tiny !== undefined,\n };\n}\n\n/**\n * Where `uplink-tools docs` writes an Uplink's widget records, relative to its\n * client package. It is committed beside the README and checked with it. Useful\n * for letting a docs site list the Uplink's widgets. Used by the `docs` command\n * and the page check.\n *\n * @category Uplink page\n */\nexport const WIDGET_RECORDS_FILE = \"docs/widgets.json\";\n\n/**\n * Widget records as the JSON file holds them: `{ \"widgets\": [...] }`, ordered\n * by id, two-space indented, ending in a newline. Each entry may carry extra\n * fields after the record's own. Useful for writing the widget records file.\n * Used by the `docs` command and the page check.\n *\n * @category Uplink page\n */\nexport function widgetRecordsJson<Entry extends WidgetRecord>(\n records: readonly Entry[],\n): string {\n const widgets = [...records].sort((a, b) => a.id.localeCompare(b.id));\n return `${JSON.stringify({ widgets }, null, 2)}\\n`;\n}\n"],"mappings":";AAAA,SAAS,6BAA6B;AA0B/B,IAAM,YAAY;AAUlB,IAAM,eAAe;AAyD5B,SAAS,KAAkC,OAAgC;AACzE,SAAO,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;AAC3D;AAEA,SAAS,OAAO,OAA8C;AAC5D,SAAO,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAC/D;AAWO,SAAS,gBACd,KACA,WACA,MACA,SACY;AACZ,QAAM,MAAM,sBAAsB,IAAI,GAAG,GAAG,SAAS;AACrD,SAAO;AAAA,IACL,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,IAAI,UAAU;AAAA,MACd,MAAM,UAAU;AAAA,MAChB,SAAS,UAAU;AAAA,MACnB,cAAc,UAAU,eAAe,IAAI,QAAQ,QAAQ,GAAG,EAAE,KAAK;AAAA,MACrE,OAAO,KAAK,OACR;AAAA,QACE,MAAM,IAAI;AAAA,QACV,GAAI,IAAI,eAAe,EAAE,cAAc,IAAI,aAAa,IAAI,CAAC;AAAA,QAC7D,GAAI,IAAI,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;AAAA,MACvC,IACA;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