tosijs-ui 1.16.15 → 1.16.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.16.16
4
+
5
+ For tjs-lang's book (GitHub #216 item 3 and #210 item 5), plus one change to `llms.txt`.
6
+ Both tjs-lang items are feature-detected, so nothing changes until your tjs-lang has them.
7
+
8
+ - **A console line shows its own value, and the JavaScript it became.** A dialect's
9
+ transform may now return `prelude` and `body` beside `code`: its runtime setup, and what
10
+ the source itself became. When it does (tjs-lang 0.14.0-rc.5 and later), a line typed at
11
+ an example's console is evaluated for its own value, so a declaration shows `undefined`
12
+ where it used to show the setup's last assignment, and a line that needs both the setup
13
+ and `await` shows what it resolved to. The input also gains a small **JS** button that
14
+ shows the JavaScript for that line. A transform that returns only `code` behaves as
15
+ before, with no button.
16
+ - **`tjs` and `ts` examples may be written as modules.** `export` is removed from `tjs` and
17
+ `ts` examples before they run, by tjs-lang's own parser (`stripExports`, from
18
+ 0.14.0-rc.4), and the build's example check does the same. An example runs as a function
19
+ body, where `export` is a syntax error, so with an older tjs-lang it fails as it always
20
+ has. `js` examples are unchanged.
21
+ - **The tjs-lang peer range admits the 0.14 release candidates** (`^0.13.1 || ^0.14.0-rc.5`).
22
+ It read `^0.14.0`, which excludes every prerelease, so `npm install` refused the one
23
+ tjs-lang that has these features. Run here with 0.14.0-rc.5 installed: the browser lane
24
+ on Chromium, and the new tests of both features on all three browsers.
25
+ - **`registerDialect` documents what a transform should return.** `testRunner` has been
26
+ honoured since 1.16.8 but was not in the type or the docs: a dialect that returns only
27
+ `code` has its inline tests run from their raw text, with JavaScript's semantics. The
28
+ `transform` type now names `testRunner`, `prelude` and `body`.
29
+ - **An example re-run while it was still loading could leave its page never finishing its
30
+ tests.** A run replaced by a newer one (tests turned on, or an edit, while the first run
31
+ was still awaiting a fetch) went on to run its test block against a preview no longer in
32
+ the page. A test that waits for something to render then waited for ever and the example
33
+ stayed marked as running, so the page was reported as not finished after 45 seconds. A
34
+ replaced run now stops before its tests, and one replaced while its tests are running
35
+ no longer writes its results over the newer run's. Seen on the data-table page off
36
+ localhost.
37
+ - **`llms.txt` no longer carries a paragraph about the dev server.** A site with
38
+ `haltijaDev` set used to tell readers of its `llms.txt` to run `bun start` and drive the
39
+ page with the `hj` CLI. That file is for whoever consumes the library, and those readers
40
+ have no repo to run. If you relied on it to brief an agent working in your project, put
41
+ the same note in your `CLAUDE.md` or `AGENTS.md`.
42
+
43
+ The tjs-lang this package pins for sites that load it from a CDN is still 0.13.13, which has
44
+ neither feature. A site that serves its own tjs-lang (the installed peer, copied
45
+ same-origin by the build) gets both as soon as that is 0.14.0-rc.5.
46
+
47
+ `LlmsTxtMeta.haltijaDev` is still accepted and now ignored (deprecated). `dist/iife.js`
48
+ grows by about 0.4 kB gzip.
49
+
3
50
  ## 1.16.15
4
51
 
5
52
  For projects that build their own docs bundle, from tosijs's upgrade to 1.16.13 (board
@@ -22,7 +22,7 @@ executed, so they're skipped.
22
22
  Build-time only (bun). Never import from browser code.
23
23
  */
24
24
  import { collectCodeTokens } from '../code-fences.js';
25
- import { rewriteImports, AsyncFunction, loadTransform, transformAvailable, UnsupportedImportError, } from '../../live-example/code-transform.js';
25
+ import { rewriteImports, AsyncFunction, loadTransform, transformAvailable, UnsupportedImportError, withoutExports, } from '../../live-example/code-transform.js';
26
26
  import { isLiveFence } from '../example-policy.js';
27
27
  // The default live-example context (matches the IIFE globals the pages provide).
28
28
  // A project that sets a custom `context` on its <tosi-doc-system> can pass its
@@ -130,7 +130,9 @@ export async function checkExamples(docs, opts = {}) {
130
130
  // We only need to validate that the source builds, not reproduce tjs
131
131
  // lowering exactly.
132
132
  tsTranspiler ??= new Bun.Transpiler({ loader: 'ts' });
133
- js = tsTranspiler.transformSync(rewritten);
133
+ // The page removes `export` from a `ts` example when its tjs-lang can; so does
134
+ // this, or a module-style example the page runs would fail the build.
135
+ js = await withoutExports(tsTranspiler.transformSync(rewritten));
134
136
  }
135
137
  else if (dialect === 'tjs') {
136
138
  const transform = await loadTransform('tjs');
@@ -30,14 +30,9 @@ export interface LlmsTxtMeta {
30
30
  /** optional framing line(s) under the description */
31
31
  tagline?: string;
32
32
  /**
33
- * Mirrors `SiteConfig.haltijaDev`. When set, `llms.txt` tells an agent it can DRIVE the
34
- * running page rather than reason about it from source — which is the single most useful
35
- * thing an agent can know about a project it is working on, and was previously discoverable
36
- * only by reading the doc-site-system page in full.
37
- *
38
- * `'tunnel'` also carries that meaning — it is `true` plus a remote path — so the note is
39
- * written on truthiness, not on `=== true`. Getting that wrong would silently drop the note
40
- * for exactly the projects that enabled the MORE capable mode.
33
+ * @deprecated Ignored since 1.16.16. It used to add a paragraph about driving the dev
34
+ * server with the `hj` CLI; `llms.txt` is for whoever consumes the library, so that note
35
+ * belongs in the project's own agent instructions. Kept so existing callers still compile.
41
36
  */
42
37
  haltijaDev?: boolean | 'tunnel';
43
38
  /**
@@ -147,22 +147,6 @@ export function generateLlmsTxt(outputPath, meta = {}, corpus) {
147
147
  '',
148
148
  ]
149
149
  : [];
150
- /*
151
- Only advertise browser control when the project has actually opted in. Telling an agent to
152
- drive a page that has no dev channel sends it after a capability that will not answer, and
153
- a wrong affordance costs more than a missing one.
154
- */
155
- const haltijaNote = meta.haltijaDev
156
- ? [
157
- 'Running this project locally (`bun start`), the dev server injects a',
158
- 'localhost-gated dev channel, so an agent can DRIVE the live page with the `hj`',
159
- 'CLI — `hj navigate`, `hj eval`, `hj tree` — instead of inferring behaviour from',
160
- 'source. Injected at serve time only, never in the built output. Note that no',
161
- 'requestAnimationFrame runs under `hj eval`, and tosijs renders are rAF-driven, so',
162
- 'use it to inspect STATE; a painted-output check needs a real test lane.',
163
- '',
164
- ]
165
- : [];
166
150
  // Only for a corpus-driven index: the legacy scan links to dist/ files, not pages.
167
151
  const example = corpus ? markdownExample(corpus, meta) : undefined;
168
152
  const markdownNote = corpus && meta.markdownPages !== false
@@ -199,7 +183,6 @@ export function generateLlmsTxt(outputPath, meta = {}, corpus) {
199
183
  '',
200
184
  ...markdownNote,
201
185
  ...liveExampleNote,
202
- ...haltijaNote,
203
186
  '## Pages',
204
187
  '',
205
188
  ];
@@ -1224,7 +1224,6 @@ export async function buildSite(config, opts = {}) {
1224
1224
  baseUrl: config.baseUrl,
1225
1225
  basePath: config.basePath,
1226
1226
  projectLinks: config.projectLinks,
1227
- haltijaDev: config.haltijaDev,
1228
1227
  markdownPages: config.markdownPages,
1229
1228
  liveExamples: config.liveExamples,
1230
1229
  }, corpus);