tosijs-ui 1.16.15 → 1.16.17

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,74 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.16.17
4
+
5
+ - **The pinned tjs-lang is 0.14.0-rc.5; it was 0.13.13.** That is the devDependency this
6
+ package builds and tests with, and `TJS_VERSION`, which sites without their own copy load
7
+ from a CDN. What it turns on for `tjs` and `ts` examples on those sites, all of it
8
+ feature-detected in 1.16.16: examples written as modules run (`export` is removed), a
9
+ console line shows its own value and offers the JavaScript it became, and a built-in
10
+ `tjs` example that declares a function gains a **Docs** tab beside its code, generated
11
+ from its signatures.
12
+ - **What can break, and how to stay where you were.** tjs-lang 0.14 refuses some code that
13
+ 0.13 accepted, with no compatibility switch: `||` in a type (a union is spelled `|`),
14
+ `unsafe var` and `unsafe eval`, and a `wasm` block that cannot compile, among others. Its
15
+ [changelog](https://github.com/tonioloewald/tjs-lang/blob/main/CHANGELOG.md) lists them
16
+ under "what breaks". A `tjs` example using one of those stops compiling on a site that
17
+ loads tjs-lang from the CDN. To keep the old transpiler, install `tjs-lang@0.13.13` in
18
+ your project: the build copies the installed tjs-lang next to your pages and the page
19
+ prefers that copy to the CDN. A site that already installs its own tjs-lang is
20
+ unaffected.
21
+ - The transpiler bundle a page with `tjs` or `ts` examples downloads is larger: 169 kB to
22
+ 195 kB gzip. `dist/iife.js` is unchanged, and pages without such examples load neither.
23
+ - The peer range is unchanged (`^0.13.1 || ^0.14.0-rc.5`).
24
+
25
+ ## 1.16.16
26
+
27
+ For tjs-lang's book (GitHub #216 item 3 and #210 item 5), plus one change to `llms.txt`.
28
+ Both tjs-lang items are feature-detected, so nothing changes until your tjs-lang has them.
29
+
30
+ - **A console line shows its own value, and the JavaScript it became.** A dialect's
31
+ transform may now return `prelude` and `body` beside `code`: its runtime setup, and what
32
+ the source itself became. When it does (tjs-lang 0.14.0-rc.5 and later), a line typed at
33
+ an example's console is evaluated for its own value, so a declaration shows `undefined`
34
+ where it used to show the setup's last assignment, and a line that needs both the setup
35
+ and `await` shows what it resolved to. The input also gains a small **JS** button that
36
+ shows the JavaScript for that line. A transform that returns only `code` behaves as
37
+ before, with no button.
38
+ - **`tjs` and `ts` examples may be written as modules.** `export` is removed from `tjs` and
39
+ `ts` examples before they run, by tjs-lang's own parser (`stripExports`, from
40
+ 0.14.0-rc.4), and the build's example check does the same. An example runs as a function
41
+ body, where `export` is a syntax error, so with an older tjs-lang it fails as it always
42
+ has. `js` examples are unchanged.
43
+ - **The tjs-lang peer range admits the 0.14 release candidates** (`^0.13.1 || ^0.14.0-rc.5`).
44
+ It read `^0.14.0`, which excludes every prerelease, so `npm install` refused the one
45
+ tjs-lang that has these features. Run here with 0.14.0-rc.5 installed: the browser lane
46
+ on Chromium, and the new tests of both features on all three browsers.
47
+ - **`registerDialect` documents what a transform should return.** `testRunner` has been
48
+ honoured since 1.16.8 but was not in the type or the docs: a dialect that returns only
49
+ `code` has its inline tests run from their raw text, with JavaScript's semantics. The
50
+ `transform` type now names `testRunner`, `prelude` and `body`.
51
+ - **An example re-run while it was still loading could leave its page never finishing its
52
+ tests.** A run replaced by a newer one (tests turned on, or an edit, while the first run
53
+ was still awaiting a fetch) went on to run its test block against a preview no longer in
54
+ the page. A test that waits for something to render then waited for ever and the example
55
+ stayed marked as running, so the page was reported as not finished after 45 seconds. A
56
+ replaced run now stops before its tests, and one replaced while its tests are running
57
+ no longer writes its results over the newer run's. Seen on the data-table page off
58
+ localhost.
59
+ - **`llms.txt` no longer carries a paragraph about the dev server.** A site with
60
+ `haltijaDev` set used to tell readers of its `llms.txt` to run `bun start` and drive the
61
+ page with the `hj` CLI. That file is for whoever consumes the library, and those readers
62
+ have no repo to run. If you relied on it to brief an agent working in your project, put
63
+ the same note in your `CLAUDE.md` or `AGENTS.md`.
64
+
65
+ The tjs-lang this package pins for sites that load it from a CDN is still 0.13.13, which has
66
+ neither feature. A site that serves its own tjs-lang (the installed peer, copied
67
+ same-origin by the build) gets both as soon as that is 0.14.0-rc.5.
68
+
69
+ `LlmsTxtMeta.haltijaDev` is still accepted and now ignored (deprecated). `dist/iife.js`
70
+ grows by about 0.4 kB gzip.
71
+
3
72
  ## 1.16.15
4
73
 
5
74
  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);