@hyperscript-tools/i18n 2.11.1 → 3.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,126 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.0] - 2026-09-03
11
+
12
+ Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v3.0.0).
13
+
14
+ One major, two themes. `@lokascript/i18n`'s grammar transformer is gone,
15
+ because `@lokascript/semantic` overtook it on every row of the translation
16
+ corpus (#973–#1001). And the engine-migration plan
17
+ (`docs-internal/ENGINE_MIGRATION_PLAN.md`) is complete: its last arc deleted
18
+ the exported dead code it had been carrying and collapsed the browser bundle
19
+ lineup to two names (#1099–#1105).
20
+
21
+ ### ⚠ BREAKING
22
+
23
+ - **`@lokascript/i18n` no longer translates** (#1001). `translate()`, `toLocale()`,
24
+ `toEnglish()`, `GrammarTransformer` and `createTransformer` are deleted; the
25
+ package is per-language vocabulary and grammar profiles. Migrate to
26
+ `import { translate } from '@lokascript/semantic'` (same signature; it throws
27
+ on unparseable input where the transformer returned nonsense). The classic-i18n
28
+ browser bundle, `@hyperscript-tools/i18n` and `@lokascript/types-browser` drop
29
+ the same members (#998, #999); the patterns corpus writer is semantic-only (#1000).
30
+ - **The prebuilt browser bundles are two names** (#1105): `hyperfixi-hx.js`
31
+ (small: hybrid parser, blocks, expressions, htmx v1/v2 attributes) and
32
+ `hyperfixi.js` (everything); `hyperfixi-hx-v4.js` and
33
+ `hyperfixi-multilingual.js` stay as separate products. `hyperfixi-lite.js`,
34
+ `-lite-plus.js`, `-minimal.js`, `-standard.js` and their `./browser/*`
35
+ exports are gone — use `hyperfixi-hx.js`, `hyperfixi.js`, or the Vite
36
+ plugin, which picks the tier itself. `./browser/hybrid-complete` remains as
37
+ the plugin's internal fallback.
38
+ - **Exported dead code deleted from `@hyperfixi/core`** — none had a
39
+ production caller: the six `@deprecated` `features/` families and the
40
+ modular bundle's `features` namespace (#1099); `Lexer`/`Tokens` (#1100 —
41
+ use `tokenize`); the `unified-types` `Validator`, the `types.d.ts` shim and
42
+ `registry/multilingual` (#1101); the `async` command (#1102 — it was
43
+ unreachable from parsed hyperscript; the manifest is 58 commands);
44
+ `ContextProviderRegistry`, the context-provider `Proxy`, the registry's
45
+ `context` slot and the plugin `contextProviders` field (#1104 — set
46
+ request-scoped values as `context.locals`).
47
+
48
+ ### Fixed
49
+
50
+ - **A small bundle fails loudly on a command it lacks and names `hyperfixi.js`**
51
+ (#1103). The hybrid parser had been dropping an unrecognised word silently;
52
+ making it loud also exposed and fixed three silent mis-parses in the hybrid
53
+ bundles: unquoted `fetch /api/data` fetched `/`, `send custom:event` sent
54
+ `custom` to `me`, and `repeat forever` ran zero iterations.
55
+ - **English→foreign rendering is gated** (#931–#972, #953): 3105/3105 corpus
56
+ renders parse on the canonical engine; the bare (handler-less) surface has its
57
+ own gate. `as JSON` stays part of the value (#991); a flattened loop header
58
+ closes (#992).
59
+ - Plugins report their real versions (#926); `analyze_content` is unshadowed in
60
+ the MCP server (#927); four dependency advisories resolved; the `domain-flow`
61
+ → `server-bridge` route contract is pinned (#1000s).
62
+
63
+ ### Changed
64
+
65
+ - `hyperfixi.js` and `hyperfixi-hx-v4.js` carry the 24-language render
66
+ vocabulary (~19 KB gzip each) so `translate` works in the browser (#931).
67
+ - Deprecated `@lokascript/domain-*` references repoint to `@lokascript/domains`.
68
+
69
+ ## [2.11.1] - 2026-08-25
70
+
71
+ Patch release. Fixes the release workflow itself: the build now runs **after**
72
+ the version sync, so a published tarball carries its own version rather than
73
+ the previous one, and `version.ts` is committed (#925). Also lands the
74
+ agent-loop A/B benchmark with an isolated generator (#924).
75
+
76
+ ## [2.11.0] - 2026-08-24
77
+
78
+ Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v2.11.0).
79
+
80
+ ### Changed
81
+
82
+ - **The domain-DSL family moved out** (#909). Twelve packages left this
83
+ monorepo: the ten publishable `@lokascript/domain-*` packages (bdd,
84
+ behaviorspec, config, flow, jsx, learn, llm, sql, todo, voice) plus the
85
+ private `domain-toolkit` and `mcp-multilingual-intent`. They now ship as
86
+ **`@lokascript/domains`**, one subpath export per domain, from the
87
+ [lokascript-domains](https://github.com/codetalcott/lokascript-domains)
88
+ repository.
89
+
90
+ All ten published names are **deprecated on npm**, each naming its
91
+ replacement subpath (`@lokascript/domain-sql` → "import from
92
+ `@lokascript/domains/sql`"). Existing installs keep working — deprecation is
93
+ a warning, not a removal — they simply stop receiving updates. The
94
+ pre-deletion tree is preserved at the `moved/domain-family` tag.
95
+
96
+ _Migration:_ replace nine dependencies with one, and change
97
+ `from '@lokascript/domain-x'` to `from '@lokascript/domains/x'`. The root
98
+ entry absorbed `domain-config` and exports `createDomainRegistry`,
99
+ `registerAllDomains` and `DOMAIN_PRIORITY`.
100
+
101
+ ### Added
102
+
103
+ - **"Show in My Language"** — LSP request plus VSCode command (#921).
104
+ - **Verified-translation badge** in the compilation service (#920).
105
+ - **`scoreFidelity` / `@lokascript/semantic/fidelity`** (#919).
106
+ - **Inert-shape warnings** (#918) and surfaced unconsumed-input warnings (#916)
107
+ in the compilation service.
108
+ - **The agent-loop benchmark** and the silent-failure finding it produced
109
+ (#915), and the MCP server's agent-era roadmap (#914).
110
+ - **Element-collection write-back** for hypermedia tables, with gallery
111
+ examples and four system fixes (#904).
112
+ - **The comprehensive Playwright tier now runs in CI** (#908) alongside
113
+ `quick`. It had never run: 122 specs, hiding four real bugs — a detached
114
+ `startViewTransition`, untracked reads of unset globals, concurrent effects
115
+ clobbering dependency capture, and `put` stringifying DocumentFragments
116
+ (#905).
117
+
118
+ ### Fixed
119
+
120
+ - **The `hyperscript-adapter` review arc** (#895–#902): whole-string
121
+ translation first, taking canonical validity from 2849/3105 to **3105/3105**
122
+ (#899); a host-parser validity gate so an invalid render falls back to the
123
+ author's text (#900); the dead split-statement fallback deleted after
124
+ measuring 0 outputs (#901); and the slim divergence set burned 6 → 1 via
125
+ schema marker data, repairing 39 body-dropping corpus rows (#902).
126
+ - **`qu take.recipient`** — the R1 tail's last `take` row (#910).
127
+ - **The release workflows** no longer reference the moved-out domain family
128
+ (#922).
129
+
10
130
  ## [2.10.0] - 2026-08-01
11
131
 
12
132
  Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v2.10.0).
@@ -3,8 +3,20 @@ import {
3
3
  warnInvalidOnce
4
4
  } from "./chunk-7ZOFDQYR.js";
5
5
 
6
+ // src/translate.ts
7
+ import { translate as semanticTranslate } from "@lokascript/semantic";
8
+ function translate(input, sourceLocale, targetLocale) {
9
+ if (sourceLocale === targetLocale) return input;
10
+ return semanticTranslate(input, sourceLocale, targetLocale);
11
+ }
12
+ function toLocale(input, targetLocale) {
13
+ return translate(input, "en", targetLocale);
14
+ }
15
+ function toEnglish(input, sourceLocale) {
16
+ return translate(input, sourceLocale, "en");
17
+ }
18
+
6
19
  // src/html.ts
7
- import { translate } from "@lokascript/i18n";
8
20
  var ATTR_PATTERNS = [
9
21
  /(_\s*=\s*")([^"]+)(")/g,
10
22
  /(_\s*=\s*')([^']+)(')/g,
@@ -82,6 +94,9 @@ function translateHtmlToManyLangs(html, langs, options = {}) {
82
94
  }
83
95
 
84
96
  export {
97
+ translate,
98
+ toLocale,
99
+ toEnglish,
85
100
  extractHyperscriptAttributes,
86
101
  checkHtmlInput,
87
102
  translateHtml,
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  checkHtmlInput,
4
4
  translateHtml
5
- } from "./chunk-SYQOFAWY.js";
5
+ } from "./chunk-U4NYQZF6.js";
6
6
  import {
7
7
  formatParseCheckReport,
8
8
  loadValidator
@@ -1,6 +1,5 @@
1
- import { LangCode } from './index.js';
2
- export { TranslateHtmlOptions, translateHtml, translateHtmlToManyLangs } from './index.js';
3
- import '@lokascript/i18n';
1
+ import { L as LangCode } from './html-7nAYhd7r.js';
2
+ export { T as TranslateHtmlOptions, t as translateHtml, a as translateHtmlToManyLangs } from './html-7nAYhd7r.js';
4
3
  import './validate.js';
5
4
 
6
5
  /**
package/dist/eleventy.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
+ translate,
2
3
  translateHtml,
3
4
  translateHtmlToManyLangs
4
- } from "./chunk-SYQOFAWY.js";
5
+ } from "./chunk-U4NYQZF6.js";
5
6
  import {
6
7
  formatParseCheckReport,
7
8
  loadValidator,
@@ -9,7 +10,6 @@ import {
9
10
  } from "./chunk-7ZOFDQYR.js";
10
11
 
11
12
  // src/eleventy.ts
12
- import { translate } from "@lokascript/i18n";
13
13
  async function hyperscriptI18nPlugin(eleventyConfig, options = {}) {
14
14
  const defaultFrom = options.defaultFrom ?? "en";
15
15
  const lenient = options.lenient ?? true;
@@ -0,0 +1,55 @@
1
+ import { CanonicalValidate, ParseCheckReport } from './validate.js';
2
+
3
+ /**
4
+ * HTML attribute scanner + translator.
5
+ *
6
+ * Walks an HTML string, finds `_="..."` (and single-quoted / backtick variants)
7
+ * attributes, translates each from a source locale to a target locale, and
8
+ * returns the rewritten HTML. The grammar transformer doesn't know about HTML;
9
+ * this module is the glue.
10
+ *
11
+ * Optionally parse-checks the ENGLISH side against the real `hyperscript.org`
12
+ * engine (see ./validate): the input when `from === 'en'` and the output when
13
+ * `to === 'en'`. The check only runs when a `validate` function is supplied, so
14
+ * existing callers see no behaviour change.
15
+ */
16
+
17
+ type LangCode = string;
18
+ /** What to do with an invalid-English report. */
19
+ type OnInvalid = 'warn' | 'error' | ((report: ParseCheckReport) => void);
20
+ interface TranslateHtmlOptions {
21
+ /** Source locale of the input HTML's `_=` attributes. Defaults to 'en'. */
22
+ from?: LangCode;
23
+ /**
24
+ * If true, swallow per-attribute translation errors and leave the original
25
+ * text in place. Defaults to true so a single bad sample doesn't fail the
26
+ * whole page build.
27
+ */
28
+ lenient?: boolean;
29
+ /**
30
+ * Canonical validator (from `loadValidator()`). When absent, no parse-check
31
+ * runs and behaviour is unchanged.
32
+ */
33
+ validate?: CanonicalValidate;
34
+ /** What to do with an invalid-English report. Default 'warn' (deduped console.warn). */
35
+ onInvalid?: OnInvalid;
36
+ /**
37
+ * Set false when the caller already validated the English input (as
38
+ * `translateHtmlToManyLangs` and the CLI do). Default true.
39
+ */
40
+ checkInput?: boolean;
41
+ }
42
+ /**
43
+ * Every `_=` attribute body in `html` (double/single/backtick quoted), deduped,
44
+ * in document order.
45
+ */
46
+ declare function extractHyperscriptAttributes(html: string): string[];
47
+ /**
48
+ * Validate every English `_=` attribute body of `html`; returns a report for
49
+ * each invalid one (stage 'input').
50
+ */
51
+ declare function checkHtmlInput(html: string, validate: CanonicalValidate, to?: LangCode): ParseCheckReport[];
52
+ declare function translateHtml(html: string, to: LangCode, options?: TranslateHtmlOptions): string;
53
+ declare function translateHtmlToManyLangs(html: string, langs: ReadonlyArray<LangCode>, options?: TranslateHtmlOptions): Map<LangCode, string>;
54
+
55
+ export { type LangCode as L, type OnInvalid as O, type TranslateHtmlOptions as T, translateHtmlToManyLangs as a, checkHtmlInput as c, extractHyperscriptAttributes as e, translateHtml as t };
package/dist/index.d.ts CHANGED
@@ -1,57 +1,21 @@
1
- export { GrammarTransformer, toEnglish, toLocale, translate } from '@lokascript/i18n';
2
- import { CanonicalValidate, ParseCheckReport } from './validate.js';
3
- export { formatParseCheckReport, loadValidator, validateHyperscript } from './validate.js';
1
+ export { L as LangCode, O as OnInvalid, T as TranslateHtmlOptions, c as checkHtmlInput, e as extractHyperscriptAttributes, t as translateHtml, a as translateHtmlToManyLangs } from './html-7nAYhd7r.js';
2
+ export { CanonicalValidate, ParseCheckReport, formatParseCheckReport, loadValidator, validateHyperscript } from './validate.js';
4
3
 
5
4
  /**
6
- * HTML attribute scanner + translator.
5
+ * Translate hyperscript between any two languages.
7
6
  *
8
- * Walks an HTML string, finds `_="..."` (and single-quoted / backtick variants)
9
- * attributes, translates each from a source locale to a target locale, and
10
- * returns the rewritten HTML. The grammar transformer doesn't know about HTML;
11
- * this module is the glue.
7
+ * Identity when source and target match — kept from the i18n signature, and not
8
+ * merely an optimization: a parse/render round trip normalizes incidental syntax
9
+ * (`'Got it!'` comes back as `"Got it!"`), which a same-language call should not
10
+ * do to a caller's source.
12
11
  *
13
- * Optionally parse-checks the ENGLISH side against the real `hyperscript.org`
14
- * engine (see ./validate): the input when `from === 'en'` and the output when
15
- * `to === 'en'`. The check only runs when a `validate` function is supplied, so
16
- * existing callers see no behaviour change.
12
+ * @throws when the input cannot be parsed in `sourceLocale`, or `targetLocale`
13
+ * has no registered renderer.
17
14
  */
15
+ declare function translate(input: string, sourceLocale: string, targetLocale: string): string;
16
+ /** English → `targetLocale`. */
17
+ declare function toLocale(input: string, targetLocale: string): string;
18
+ /** `sourceLocale` → English. */
19
+ declare function toEnglish(input: string, sourceLocale: string): string;
18
20
 
19
- type LangCode = string;
20
- /** What to do with an invalid-English report. */
21
- type OnInvalid = 'warn' | 'error' | ((report: ParseCheckReport) => void);
22
- interface TranslateHtmlOptions {
23
- /** Source locale of the input HTML's `_=` attributes. Defaults to 'en'. */
24
- from?: LangCode;
25
- /**
26
- * If true, swallow per-attribute translation errors and leave the original
27
- * text in place. Defaults to true so a single bad sample doesn't fail the
28
- * whole page build.
29
- */
30
- lenient?: boolean;
31
- /**
32
- * Canonical validator (from `loadValidator()`). When absent, no parse-check
33
- * runs and behaviour is unchanged.
34
- */
35
- validate?: CanonicalValidate;
36
- /** What to do with an invalid-English report. Default 'warn' (deduped console.warn). */
37
- onInvalid?: OnInvalid;
38
- /**
39
- * Set false when the caller already validated the English input (as
40
- * `translateHtmlToManyLangs` and the CLI do). Default true.
41
- */
42
- checkInput?: boolean;
43
- }
44
- /**
45
- * Every `_=` attribute body in `html` (double/single/backtick quoted), deduped,
46
- * in document order.
47
- */
48
- declare function extractHyperscriptAttributes(html: string): string[];
49
- /**
50
- * Validate every English `_=` attribute body of `html`; returns a report for
51
- * each invalid one (stage 'input').
52
- */
53
- declare function checkHtmlInput(html: string, validate: CanonicalValidate, to?: LangCode): ParseCheckReport[];
54
- declare function translateHtml(html: string, to: LangCode, options?: TranslateHtmlOptions): string;
55
- declare function translateHtmlToManyLangs(html: string, langs: ReadonlyArray<LangCode>, options?: TranslateHtmlOptions): Map<LangCode, string>;
56
-
57
- export { CanonicalValidate, type LangCode, type OnInvalid, ParseCheckReport, type TranslateHtmlOptions, checkHtmlInput, extractHyperscriptAttributes, translateHtml, translateHtmlToManyLangs };
21
+ export { toEnglish, toLocale, translate };
package/dist/index.js CHANGED
@@ -1,19 +1,18 @@
1
1
  import {
2
2
  checkHtmlInput,
3
3
  extractHyperscriptAttributes,
4
+ toEnglish,
5
+ toLocale,
6
+ translate,
4
7
  translateHtml,
5
8
  translateHtmlToManyLangs
6
- } from "./chunk-SYQOFAWY.js";
9
+ } from "./chunk-U4NYQZF6.js";
7
10
  import {
8
11
  formatParseCheckReport,
9
12
  loadValidator,
10
13
  validateHyperscript
11
14
  } from "./chunk-7ZOFDQYR.js";
12
-
13
- // src/index.ts
14
- import { translate, toLocale, toEnglish, GrammarTransformer } from "@lokascript/i18n";
15
15
  export {
16
- GrammarTransformer,
17
16
  checkHtmlInput,
18
17
  extractHyperscriptAttributes,
19
18
  formatParseCheckReport,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperscript-tools/i18n",
3
- "version": "2.11.1",
3
+ "version": "3.0.0",
4
4
  "description": "Build-time translation for hyperscript code samples — generate per-language HTML from a canonical English source",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "build": "tsup src/index.ts src/cli.ts src/eleventy.ts src/validate.ts --format esm --dts --clean",
30
30
  "dev": "tsup src/index.ts src/cli.ts src/eleventy.ts src/validate.ts --format esm --dts --watch",
31
31
  "typecheck": "tsc --noEmit",
32
- "pretest": "../../scripts/ensure-fresh.sh ../i18n . && npm run build --silent",
32
+ "pretest": "../../scripts/ensure-fresh.sh ../semantic . && npm run build --silent",
33
33
  "test": "node --test test/*.test.mjs",
34
34
  "test:check": "bash -c 'set -o pipefail; node --test --test-reporter=spec test/*.test.mjs 2>&1 | tail -10'"
35
35
  },
@@ -48,7 +48,7 @@
48
48
  "author": "HyperFixi Contributors",
49
49
  "license": "MIT",
50
50
  "dependencies": {
51
- "@lokascript/i18n": "^2.11.1",
51
+ "@lokascript/semantic": "^3.0.0",
52
52
  "hyperscript.org": "^0.9.93"
53
53
  },
54
54
  "devDependencies": {