@ksp-gonogo/uplink-tools 0.0.0 → 0.2.0-rc.10
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 +137 -1
- package/bin/uplink-tools.mjs +5 -0
- package/dist/chunk-FA65HDVD.js +1217 -0
- package/dist/chunk-FA65HDVD.js.map +1 -0
- package/dist/chunk-MG77526V.js +1606 -0
- package/dist/chunk-MG77526V.js.map +1 -0
- package/dist/chunk-ZXX5ILJ5.js +1287 -0
- package/dist/chunk-ZXX5ILJ5.js.map +1 -0
- package/dist/cli-3OXPFS4W.js +512 -0
- package/dist/cli-3OXPFS4W.js.map +1 -0
- package/dist/cli.d.ts +20 -0
- package/dist/cli.js +7 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1101 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/page-check.d.ts +85 -0
- package/dist/page-check.js +343 -0
- package/dist/page-check.js.map +1 -0
- package/dist/render-probe.d.ts +683 -0
- package/dist/render-probe.js +1746 -0
- package/dist/render-probe.js.map +1 -0
- package/dist/widgets.d.ts +2 -0
- package/dist/widgets.js +29813 -0
- package/dist/widgets.js.map +1 -0
- package/dist/widgets.json +12287 -0
- package/package.json +79 -4
package/README.md
CHANGED
|
@@ -1,3 +1,139 @@
|
|
|
1
1
|
# @ksp-gonogo/uplink-tools
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
6
|
+
|
|
7
|
+
It is a **devDependency**. Nothing here ships in an Uplink's bundle.
|
|
8
|
+
|
|
9
|
+
## The command line
|
|
10
|
+
|
|
11
|
+
One command, `uplink-tools`, and nothing to install before the first run:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx @ksp-gonogo/uplink-tools new myuplink # scaffold, in an empty directory
|
|
15
|
+
npx @ksp-gonogo/uplink-tools --help
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Once it is in an Uplink's devDependencies the same commands answer to
|
|
19
|
+
`uplink-tools` in a `package.json` script, which is what a workflow calls:
|
|
20
|
+
|
|
21
|
+
| command | what it does |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `new <id>` | scaffold the hand-written seed of an Uplink: contract slice, plugin, tests, one widget and its fixture. In a repo with an `uplinks/` folder it goes to `uplinks/<id>/`; anywhere else the current directory becomes the Uplink |
|
|
24
|
+
| `bundle` | build the client bundle the app loads, and the `gonogo-uplink.json` beside it |
|
|
25
|
+
| `bake-hash` | write a bundle's sha256 into a C# const, so the mod can vouch for the client it shipped with |
|
|
26
|
+
| `render` | render every scene to `renders/` |
|
|
27
|
+
| `docs` | write `README.md`, `gonogo-uplink.json`, `docs/widgets.json` and `docs/assets/`; `docs --check` fails on drift |
|
|
28
|
+
|
|
29
|
+
Every command takes `--help`, and refuses a flag it does not read.
|
|
30
|
+
|
|
31
|
+
## What is in it
|
|
32
|
+
|
|
33
|
+
| entry | what it is |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `@ksp-gonogo/uplink-tools` | the harness API and the `uplink-tools` command's `run`. Node: esbuild, Playwright, the filesystem |
|
|
36
|
+
| `@ksp-gonogo/uplink-tools/render-probe` | the browser half, which mounts a widget in the page the harness builds |
|
|
37
|
+
| `@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 |
|
|
38
|
+
| `@ksp-gonogo/uplink-tools/widgets` | the app's own widgets, registered, so a scene can name one as its `_scene.hostWidget` |
|
|
39
|
+
|
|
40
|
+
You will not usually import the first of these: the command line runs it.
|
|
41
|
+
|
|
42
|
+
`uplink-tools docs` writes `README.md`, `gonogo-uplink.json` and
|
|
43
|
+
`docs/widgets.json`, the record of each widget you register. The README's widget
|
|
44
|
+
sections are rendered from those records, and `docs --check` and
|
|
45
|
+
`expectUplinkPageCurrent` fail when any of the three no longer matches your
|
|
46
|
+
registrations. Commit all three.
|
|
47
|
+
|
|
48
|
+
## What a fixture puts on the stream
|
|
49
|
+
|
|
50
|
+
A fixture's `_stream` block is the wire its scene is fed from:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"_scene": { "widget": "reactor" },
|
|
55
|
+
"_stream": {
|
|
56
|
+
"pinnedUt": 1000,
|
|
57
|
+
"delaySeconds": 60,
|
|
58
|
+
"emits": [
|
|
59
|
+
{ "topic": "example.reactor", "payload": {}, "validAt": 940 },
|
|
60
|
+
{ "topic": "example.reactor", "payload": {} }
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| field | what it does |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `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` |
|
|
69
|
+
| `pinnedUt` | the operator's view time, which the scene is drawn at when it has no `delaySeconds`. Defaults to `1000000` |
|
|
70
|
+
| `stopsArriving` | drop the link once every emit has landed, so the picture is of figures that are held |
|
|
71
|
+
| `delaySeconds` | a one-way light time between the craft and the screen, in seconds |
|
|
72
|
+
|
|
73
|
+
**`delaySeconds`** stages what an operator sees across a light time. Each
|
|
74
|
+
reading sent at `validAt` is delivered `delaySeconds` later, the view time is
|
|
75
|
+
the newest `validAt` delivered (an emit naming none counts as `pinnedUt`), and
|
|
76
|
+
the craft's present runs one light time ahead of it.
|
|
77
|
+
Every reading is reckoned to that present exactly as it is in the app, so a
|
|
78
|
+
scene can show a modelled figure beside the observed one, drawn with the kit's
|
|
79
|
+
modelled mark. Without it, or at `0`, the view time and the craft's present are
|
|
80
|
+
one instant and nothing is carried across. A reckoner that fits a trend needs
|
|
81
|
+
more than one reading, so give those emits a history of `validAt`s. If your
|
|
82
|
+
widget reads the light time off `comms.delay`, emit that too: the delay stages
|
|
83
|
+
the clock, not the topic.
|
|
84
|
+
|
|
85
|
+
Under a delay an `advanceUt` step moves the craft's present and leaves the view
|
|
86
|
+
time where it is until something newer is delivered, so a negative `advanceUt`
|
|
87
|
+
is refused.
|
|
88
|
+
|
|
89
|
+
## Using the host widgets
|
|
90
|
+
|
|
91
|
+
An Uplink's docs page shows its widgets, and some of them are an AUGMENT or a
|
|
92
|
+
CONTRIBUTION into a widget that ships with the app. To draw one honestly you
|
|
93
|
+
need the widget around it:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@ksp-gonogo/uplink-tools": "^0.1.0"
|
|
99
|
+
},
|
|
100
|
+
"gonogo": {
|
|
101
|
+
"renderWith": ["@ksp-gonogo/uplink-tools/widgets"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
A fixture can then name the widget it extends:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{ "_scene": { "hostWidget": "strategies" } }
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
There is nothing to `import` from `/widgets`. It exports no symbols: importing it
|
|
113
|
+
runs the app widgets' own registrations, which is all the harness needs to
|
|
114
|
+
resolve a scene's `hostWidget`.
|
|
115
|
+
|
|
116
|
+
**`/widgets` is for the docs page only.** Name it in `devDependencies` and in
|
|
117
|
+
`gonogo.renderWith`, and nowhere else: never put `@ksp-gonogo/uplink-tools` in
|
|
118
|
+
`dependencies`, and never import `/widgets` from your client. If you want one
|
|
119
|
+
of its components for real use, ask for that component in `@ksp-gonogo/ui-kit`.
|
|
120
|
+
|
|
121
|
+
## Why a stand-in is not enough
|
|
122
|
+
|
|
123
|
+
The harness already synthesises a stand-in for a scene that names none, and it
|
|
124
|
+
covers more than you would expect: an augment mounts in that stand-in's `Panel`,
|
|
125
|
+
and `Panel` draws every widget's `<id>.badges` itself, so a badge contribution
|
|
126
|
+
lands there exactly as it lands in the real widget.
|
|
127
|
+
|
|
128
|
+
Every **other** contribution slot is drawn by the host widget's own body, and a
|
|
129
|
+
stand-in's body draws nothing. `strategies.screens`,
|
|
130
|
+
`space-center-status.facilities` and `astronaut-complex.readouts` are each read
|
|
131
|
+
by a `useContributions(...)` inside the widget. Standing in for those produces a
|
|
132
|
+
blank frame that reports success. A real widget's own body is the only thing that draws
|
|
133
|
+
them.
|
|
134
|
+
|
|
135
|
+
## Its relation to `@ksp-gonogo/ui-kit`
|
|
136
|
+
|
|
137
|
+
`@ksp-gonogo/ui-kit` is a peer dependency: install the two at matching
|
|
138
|
+
versions. The harness draws with the kit and its `/grid` and `/testing`
|
|
139
|
+
entries, and the app widgets behind `/widgets` are built on it.
|