tosijs-ui 1.9.3 → 1.9.5
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 +60 -0
- package/dist/doc-system/site/dev-server.d.ts +4 -0
- package/dist/doc-system/site/dev-server.js +64 -13
- package/dist/iife.js +63 -63
- package/dist/iife.js.map +4 -4
- package/dist/localize.js +76 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.5
|
|
4
|
+
|
|
5
|
+
**`localize()` no longer destroys literal `#`** (#55, reported by snowfox).
|
|
6
|
+
|
|
7
|
+
`#` separates a string from a context annotation (`Okay#confirm`) and every `#` was
|
|
8
|
+
stripped, so any literal one was lost: `'C# Tutorial'` became `'C'`, `'Issue #42'` became
|
|
9
|
+
`'Issue '`, and `'#hashtag'` became `''` — an empty string, which renders as a blank label
|
|
10
|
+
rather than an obvious error.
|
|
11
|
+
|
|
12
|
+
An annotation is a **suffix identifier**, so only a `#` that looks like one is treated as
|
|
13
|
+
one — immediately preceded by a non-space, followed by letters/digits/`_`/`-`, at the end
|
|
14
|
+
of the string:
|
|
15
|
+
|
|
16
|
+
| string | read as |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `Okay#confirm` | annotation |
|
|
19
|
+
| `C# Tutorial` | literal — space after |
|
|
20
|
+
| `Issue #42` | literal — space before |
|
|
21
|
+
| `#hashtag` | literal — nothing before |
|
|
22
|
+
| `C#` | literal — no annotation after |
|
|
23
|
+
|
|
24
|
+
No author action and no data migration; every documented annotation form is unchanged.
|
|
25
|
+
Escape with `\#` for a literal that genuinely looks like an annotation (`tag\#42`).
|
|
26
|
+
|
|
27
|
+
**The worse half:** annotations were stripped from the *translated value* too, so a
|
|
28
|
+
translation containing `#` was truncated **even when the source string had none** —
|
|
29
|
+
`'Sharp'` → `'Dièse #1'` came back as `'Dièse '`. A translator writing an ordinary string
|
|
30
|
+
had it silently cut, with nothing in the source to hint why. Translations are no longer
|
|
31
|
+
scanned for annotations at all: an annotation belongs to the lookup key, not to the text
|
|
32
|
+
it resolves to.
|
|
33
|
+
|
|
34
|
+
### Also
|
|
35
|
+
|
|
36
|
+
- **`brace-expansion` pinned to `>=5.0.9`** (GHSA-rgw5-rvv9-x895, HIGH, DoS-only). A
|
|
37
|
+
follow-up advisory against a package already pinned at `>=5.0.8` for the previous one —
|
|
38
|
+
the new advisory covers `<5.0.9`. The audit gate blocked the build on it, which is the
|
|
39
|
+
case a one-time fix misses and a gate does not.
|
|
40
|
+
|
|
41
|
+
## 1.9.4
|
|
42
|
+
|
|
43
|
+
**The dev server now uses your own installed `haltija`** (#48, reported by tosijs-3d).
|
|
44
|
+
|
|
45
|
+
It spawned its own channel via `bunx haltija@^1.6.1` and ignored the project's dependency
|
|
46
|
+
entirely — and because **bunx caches the resolution**, a range that resolves forward never
|
|
47
|
+
*re*-resolves once its cache key exists. So an adopter who bumped `haltija` to `^1.11.2`
|
|
48
|
+
for a fix, restarted, and still didn't have the fix was running a cached 1.11.0: new
|
|
49
|
+
enough to look current, old enough to lack it. `hj where` reports the *spawned* server, so
|
|
50
|
+
the version indicator agreed with them.
|
|
51
|
+
|
|
52
|
+
- Your `node_modules/.bin/haltija` is preferred when present. `HALTIJA_VERSION` still
|
|
53
|
+
overrides everything.
|
|
54
|
+
- The fallback floor moves `^1.6.1` → `^1.11.2`. Its practical job is to make bunx
|
|
55
|
+
re-resolve, not to express a minimum — a stale cache key was half the bug.
|
|
56
|
+
- **Both spawn sites now print which channel they used and where it came from** —
|
|
57
|
+
`1.11.2 (this project's dependency)`, `haltija@^1.11.2 (bunx)`,
|
|
58
|
+
`haltija@beta (HALTIJA_VERSION)`. The failure was never that a wrong version ran; it
|
|
59
|
+
was that nothing said so.
|
|
60
|
+
|
|
61
|
+
If you were working around this with `HALTIJA_VERSION`, you can drop it.
|
|
62
|
+
|
|
3
63
|
## 1.9.3
|
|
4
64
|
|
|
5
65
|
Two adopter-reported fixes, both with the diagnosis largely done by the reporter.
|
|
@@ -3,6 +3,10 @@ import { isLoopbackAddressForAuth as isLoopbackAddress } from './dev-auth.js';
|
|
|
3
3
|
declare global {
|
|
4
4
|
var Bun: any;
|
|
5
5
|
}
|
|
6
|
+
export declare function resolveHaltijaChannel(cwd?: string, env?: Record<string, string | undefined>): {
|
|
7
|
+
argv: string[];
|
|
8
|
+
describe: string;
|
|
9
|
+
};
|
|
6
10
|
/**
|
|
7
11
|
* Resolve the idle-exit timeout to milliseconds (0 = disabled).
|
|
8
12
|
*
|
|
@@ -8,7 +8,7 @@ headless browser through the inline doc tests and exits with their pass/fail.
|
|
|
8
8
|
Build-time only (Bun APIs). Never import this from browser code.
|
|
9
9
|
*/
|
|
10
10
|
import * as path from 'path';
|
|
11
|
-
import { statSync } from 'fs';
|
|
11
|
+
import { statSync, existsSync, readFileSync } from 'fs';
|
|
12
12
|
import { tmpdir } from 'os';
|
|
13
13
|
import { $, spawn } from 'bun';
|
|
14
14
|
import { buildSite } from './orchestrator.js';
|
|
@@ -45,15 +45,62 @@ const DEFAULT_IDLE_HOURS = 8;
|
|
|
45
45
|
* test lane below can trust an exit code instead of racing to a timeout.
|
|
46
46
|
*/
|
|
47
47
|
/*
|
|
48
|
-
|
|
49
|
-
tell "server up" from "there is a tab to drive".
|
|
48
|
+
The FALLBACK channel, used only when the project has no haltija of its own.
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
`^1.11.2` because that is where the agent-facing fixes people upgrade for currently live;
|
|
51
|
+
the floor's practical job is to make bunx re-resolve rather than to express a minimum. The
|
|
52
|
+
floor before this was `^1.6.1`, and an adopter with `haltija@^1.11.2` in their own
|
|
53
|
+
devDependencies still got **1.11.0** — new enough to look current, old enough to lack the
|
|
54
|
+
fix they had just upgraded for (tosijs-ui#48).
|
|
55
|
+
|
|
56
|
+
Two things conspired, and the second is the nasty one:
|
|
57
|
+
|
|
58
|
+
- we spawned our own channel and ignored theirs entirely, and
|
|
59
|
+
- **`bunx` caches the resolution**, so a range that resolves forward does not RE-resolve
|
|
60
|
+
once its cache key is populated. `^1.6.1` froze at whatever satisfied it first.
|
|
61
|
+
|
|
62
|
+
That is the stale-but-satisfying-cache hazard this project filed against haltija (#11) and
|
|
63
|
+
then shipped an instance of. A range is not a pin, and a cached range is not even a range.
|
|
64
|
+
|
|
65
|
+
`resolveHaltijaChannel()` below prefers the project's own installed haltija, so the version
|
|
66
|
+
is something an adopter controls with the tool they already use. `HALTIJA_VERSION` still
|
|
67
|
+
overrides everything.
|
|
68
|
+
*/
|
|
69
|
+
const HALTIJA_PKG = process.env.HALTIJA_VERSION ?? 'haltija@^1.11.2';
|
|
70
|
+
/*
|
|
71
|
+
Which haltija do we actually run, and can we say so out loud?
|
|
72
|
+
|
|
73
|
+
Prefer the one in the project's own node_modules. An adopter who bumps their haltija
|
|
74
|
+
devDependency to get a fix expects that to be the haltija they get; anything else makes
|
|
75
|
+
the upgrade look like it did nothing — with `hj where` agreeing, since it reports the
|
|
76
|
+
SPAWNED server's version and therefore looks authoritative.
|
|
77
|
+
|
|
78
|
+
Returns the argv prefix plus a human description, because an invisible divergence is the
|
|
79
|
+
whole bug: one startup line naming the channel and where it came from turns "the fix
|
|
80
|
+
doesn't work" into "oh, it's running a different one".
|
|
55
81
|
*/
|
|
56
|
-
|
|
82
|
+
export function resolveHaltijaChannel(cwd = process.cwd(), env = process.env) {
|
|
83
|
+
// An explicit override always wins, and is worth saying so.
|
|
84
|
+
if (env.HALTIJA_VERSION) {
|
|
85
|
+
return {
|
|
86
|
+
argv: ['bunx', env.HALTIJA_VERSION],
|
|
87
|
+
describe: `${env.HALTIJA_VERSION} (HALTIJA_VERSION)`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const local = `${cwd}/node_modules/.bin/haltija`;
|
|
91
|
+
if (existsSync(local)) {
|
|
92
|
+
let version = 'unknown version';
|
|
93
|
+
try {
|
|
94
|
+
version =
|
|
95
|
+
JSON.parse(readFileSync(`${cwd}/node_modules/haltija/package.json`, 'utf8')).version ?? version;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
/* installed but unreadable manifest — still prefer it, just unnamed */
|
|
99
|
+
}
|
|
100
|
+
return { argv: [local], describe: `${version} (this project's dependency)` };
|
|
101
|
+
}
|
|
102
|
+
return { argv: ['bunx', HALTIJA_PKG], describe: `${HALTIJA_PKG} (bunx)` };
|
|
103
|
+
}
|
|
57
104
|
/**
|
|
58
105
|
* Resolve the idle-exit timeout to milliseconds (0 = disabled).
|
|
59
106
|
*
|
|
@@ -256,8 +303,11 @@ async function ensureHaltijaChannel(port) {
|
|
|
256
303
|
// HTTPS dev page has no mixed-content), while the `hj` CLI drives over its
|
|
257
304
|
// default HTTP 8700 — one server, both transports, shared state. HTTPS cert
|
|
258
305
|
// is mkcert-trusted. Output quiet so it doesn't drown the dev log.
|
|
259
|
-
|
|
260
|
-
|
|
306
|
+
const channel = resolveHaltijaChannel();
|
|
307
|
+
// Name the channel: an adopter who upgraded their own haltija and got ours instead
|
|
308
|
+
// sees the divergence here rather than concluding the fix does not work (#48).
|
|
309
|
+
console.log(`haltija channel: ${channel.describe}`);
|
|
310
|
+
spawn([...channel.argv, '--server', '--both'], {
|
|
261
311
|
stdout: 'ignore',
|
|
262
312
|
stderr: 'ignore',
|
|
263
313
|
});
|
|
@@ -1326,8 +1376,9 @@ export async function devServer(config, opts = {}) {
|
|
|
1326
1376
|
(tosijs-ui#18, #21.)
|
|
1327
1377
|
*/
|
|
1328
1378
|
const portFile = `${tmpdir()}/tosijs-haltija-${process.pid}.json`;
|
|
1329
|
-
|
|
1330
|
-
|
|
1379
|
+
const channel = resolveHaltijaChannel();
|
|
1380
|
+
console.log(`Starting a private haltija… (${channel.describe})`);
|
|
1381
|
+
const haltija = spawn([...channel.argv, '--private', '--port-file', portFile], {
|
|
1331
1382
|
// stdout/stderr are NOT inherited: `bunx haltija` launches Electron as a
|
|
1332
1383
|
// grandchild, and killing the bunx wrapper does not kill it. An orphan holding
|
|
1333
1384
|
// our inherited stdout keeps the pipe open forever, so the command looks hung
|
|
@@ -1351,7 +1402,7 @@ export async function devServer(config, opts = {}) {
|
|
|
1351
1402
|
}
|
|
1352
1403
|
if (!hjPort) {
|
|
1353
1404
|
console.error(`haltija did not report a private port within 30s (${portFile}).\n` +
|
|
1354
|
-
` Is
|
|
1405
|
+
` Is \`${channel.argv.join(' ')}\` able to run? Try it by hand.`);
|
|
1355
1406
|
await stopHaltija();
|
|
1356
1407
|
shutdown(1);
|
|
1357
1408
|
}
|