@simonklee/opentui-tex 0.2.0 → 0.3.1

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.
@@ -14,6 +14,7 @@ export interface TexRenderableOptions extends BoxOptions {
14
14
  imageOptions?: Omit<ImageRenderableOptions, "source" | "width" | "height">;
15
15
  onError?: (error: unknown) => void;
16
16
  streaming?: boolean;
17
+ strict?: boolean;
17
18
  }
18
19
  export interface TexDimensions {
19
20
  columns: number;
@@ -28,11 +29,12 @@ export declare class TexRenderable extends BoxRenderable {
28
29
  ready: Promise<void>;
29
30
  private readonly backend;
30
31
  private readonly fallback;
32
+ private readonly strict;
31
33
  private readonly widthMax;
32
34
  private readonly heightMax;
33
35
  private autoWidth;
34
36
  private autoHeight;
35
- private trackExplicitDimensions;
37
+ private requestedAlignSelf;
36
38
  private currentDimensions;
37
39
  private readonly imageOptions?;
38
40
  private readonly onError?;
@@ -52,6 +54,8 @@ export declare class TexRenderable extends BoxRenderable {
52
54
  set width(value: number | "auto" | `${number}%`);
53
55
  get height(): number;
54
56
  set height(value: number | "auto" | `${number}%`);
57
+ set alignSelf(value: TexRenderableOptions["alignSelf"] | null);
58
+ onLifecyclePass: () => void;
55
59
  get streaming(): boolean;
56
60
  set streaming(value: boolean);
57
61
  setColors(foreground: string, background: string): void;
package/docs/native.md CHANGED
@@ -30,3 +30,17 @@ The native context is process-owned. `destroy()` releases renderer-instance
30
30
  queues and caches. Node 26.4 can retain its experimental FFI handle during
31
31
  shutdown, so short-lived Node programs may need to call `process.exit()` after
32
32
  application cleanup. Re-test this restriction when upgrading Node's FFI.
33
+
34
+ ## Input limits
35
+
36
+ Native rendering rejects invalid UTF-8, embedded NULs, unsupported glyphs, and
37
+ formulas that exceed parser budgets. Expansion permits at most 64 KiB per
38
+ string, 1,024 replacements, and 64 nested parser frames. Nested parsers also
39
+ share a work budget for scanning and string copies. These failures return
40
+ errors instead of terminating the application. Set `fallback: "unicode"`
41
+ to keep the semantic preview when native rendering fails.
42
+
43
+ Rendering runs synchronously on the main thread. An `AbortSignal` can cancel
44
+ queued work, but cannot interrupt an active native call. Parser budgets are not
45
+ a security sandbox; use a separate process if you need hard time or memory
46
+ limits for untrusted input.
package/docs/releasing.md CHANGED
@@ -16,11 +16,12 @@ Publish all ten packages locally with an interactive npm login and two-factor
16
16
  authentication first. Do not create an `NPM_TOKEN` secret.
17
17
 
18
18
  1. Commit and push the release changes to `main`.
19
- 2. Create and push the matching `v0.2.0` tag. Do not publish the GitHub release yet.
20
- 3. Run `Release` manually with `tag` set to `v0.2.0` and `dry-run` enabled.
21
- 4. After the run succeeds, download its `npm-packages` artifact into a clean
19
+ 2. Run `Release` manually on `main` with `dry-run` enabled and `tag` empty.
20
+ 3. After the run succeeds, download its `npm-packages` artifact into a clean
22
21
  `release/` directory. Keep only the ten tarballs from that run.
23
- 5. From the repository root at the tagged commit, run:
22
+ 4. At the commit tested by that run, create the matching local `v0.2.0` tag.
23
+ Do not push it until trusted publishing is configured: tag pushes publish.
24
+ 5. From the repository root at that commit, run:
24
25
 
25
26
  ```sh
26
27
  npm login
@@ -64,6 +65,8 @@ tags named `v*`. You can also require approval before publication. Only the
64
65
  publish job uses this environment and receives `id-token: write`; build and
65
66
  dry-run jobs need neither. No npm token secret is needed.
66
67
 
68
+ Complete this setup before pushing a release tag or using `bun run release`.
69
+
67
70
  Later releases use OIDC authentication and receive npm provenance automatically
68
71
  from this public repository. After a successful trusted release, select
69
72
  **Require two-factor authentication and disallow tokens** in each package's
@@ -100,17 +103,40 @@ Version 0.2.0 is the first single-install release. It replaces the separate
100
103
  native JavaScript package from the 0.1.0 GitHub release. Keep the existing 0.1.0
101
104
  tags and tarballs unchanged.
102
105
 
103
- For later versions, update the root version and all native dependency versions
104
- together:
106
+ For later versions, commit the changes you want to release on `main`, then run:
107
+
108
+ ```sh
109
+ bun run release
110
+ ```
111
+
112
+ The default bump is `patch`. You can select `minor` or `major`, or preview the
113
+ release without changing files, commits, or tags:
105
114
 
106
115
  ```sh
107
- npm version 0.2.1 --no-git-tag-version
116
+ bun run release minor
117
+ bun run release major
118
+ bun run release --dry-run
108
119
  ```
109
120
 
110
- The `version` script also updates `bun.lock`. Commit the version change and the
111
- release code, then create and push the matching `v<version>` tag. Publish a
112
- GitHub release for that tag to run the workflow. The tag must match
113
- `package.json` exactly.
121
+ The command requires Git push access, an authenticated GitHub CLI
122
+ (`gh auth login`), and the trusted publishing setup above. It requires clean `package.json`
123
+ and `bun.lock` files and no unfinished merge, rebase, cherry-pick, or revert.
124
+ It rejects a branch behind or diverged from the remote, existing version tags,
125
+ and multiple `origin` push URLs. Only stable `major.minor.patch` versions are
126
+ supported. A dry run performs these checks and fetches remote history, but does
127
+ not build, commit, push, or publish.
128
+
129
+ The command updates the root version, all eight native dependency versions, and
130
+ `bun.lock` through the existing `version` script. It commits only `package.json`
131
+ and `bun.lock`, creates an annotated `v<version>` tag, and atomically pushes
132
+ `main` and that tag. Unrelated staged, unstaged, and untracked changes stay
133
+ untouched and are not included in the release commit.
134
+
135
+ The tag push starts `release.yml`, which builds, tests, and publishes the npm
136
+ packages. The command waits for the publish job to succeed, downloads its ten
137
+ tarballs, and creates the GitHub release with those files and generated notes.
138
+ Creating the GitHub release does not trigger a second build. Later releases need
139
+ no local npm login or token.
114
140
 
115
141
  You can also run `Release` manually. Leave `dry-run` enabled to validate a branch
116
142
  or tag without publishing. To publish manually, supply the existing release tag
@@ -124,6 +150,20 @@ Publication is not atomic. If publication stops partway through, rerun the faile
124
150
  publish job to reuse the tarballs from the successful build job. The publisher
125
151
  checks npm before skipping an already-published version.
126
152
 
153
+ If the push fails, the local release commit and tag remain intact. Resolve the
154
+ Git error and push that commit and tag instead of starting another version bump.
155
+ If npm publication succeeds but downloading the artifacts or creating the GitHub
156
+ release fails, use the successful run and existing tag to finish manually:
157
+
158
+ ```sh
159
+ gh run download <run-id> --name npm-packages --dir <empty-directory>
160
+ gh release create v<version> <empty-directory>/*.tgz \
161
+ --verify-tag --generate-notes --title v<version>
162
+ ```
163
+
164
+ Replace the placeholders with the run ID, version, and a new empty directory.
165
+ Do not rerun `bun run release` to retry a partial release.
166
+
127
167
  Do not use plain `npm publish` from the repository root for a release: that
128
168
  would omit the native packages. The coordinated command is
129
169
  `RELEASE_TAG=v<version> bun run publish:packages`, after
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonklee/opentui-tex",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "TeX renderable with Unicode and native image backends for OpenTUI",
5
5
  "license": "MIT",
6
6
  "packageManager": "bun@1.3.14",
@@ -52,11 +52,12 @@
52
52
  "dev": "bun demo/app.ts",
53
53
  "start": "bun demo/app.ts",
54
54
  "start:node": "bun run build:demo:node && node --permission --allow-fs-read=.. --allow-child-process --allow-worker --allow-ffi --experimental-ffi dist/app.node.js",
55
- "test": "bun test src/document.test.ts src/tex-renderable.test.ts src/unicode-tex-backend.test.ts",
55
+ "test": "bun test src/document.test.ts src/tex-renderable.test.ts src/unicode-tex-backend.test.ts src/math-parser.test.ts src/math-layout.test.ts scripts/release.test.ts",
56
56
  "test:native": "bun run build:native && bun run test:native:zig && bun test src/native",
57
57
  "test:native:zig": "bash scripts/bootstrap-native && zig build test",
58
58
  "test:release": "bun scripts/test-release.ts",
59
59
  "test:all": "bun run test && bun run test:native",
60
+ "release": "bun scripts/release.ts",
60
61
  "release:check": "bun run typecheck && bun run test:all && bun run build:release && bun run test:release && bun scripts/publish-packages.ts --dry-run",
61
62
  "publish:packages": "bun scripts/publish-packages.ts",
62
63
  "typecheck": "tsc --noEmit",
@@ -71,8 +72,12 @@
71
72
  "@opentui/solid": "0.0.0-20260812-1d34234c"
72
73
  },
73
74
  "peerDependenciesMeta": {
74
- "@opentui/react": { "optional": true },
75
- "@opentui/solid": { "optional": true }
75
+ "@opentui/react": {
76
+ "optional": true
77
+ },
78
+ "@opentui/solid": {
79
+ "optional": true
80
+ }
76
81
  },
77
82
  "devDependencies": {
78
83
  "@opentui/core": "0.0.0-20260812-1d34234c",
@@ -83,14 +88,14 @@
83
88
  "typescript": "^5"
84
89
  },
85
90
  "optionalDependencies": {
86
- "@simonklee/opentui-tex-native-darwin-arm64": "0.2.0",
87
- "@simonklee/opentui-tex-native-darwin-x64": "0.2.0",
88
- "@simonklee/opentui-tex-native-linux-arm64": "0.2.0",
89
- "@simonklee/opentui-tex-native-linux-arm64-musl": "0.2.0",
90
- "@simonklee/opentui-tex-native-linux-x64": "0.2.0",
91
- "@simonklee/opentui-tex-native-linux-x64-musl": "0.2.0",
92
- "@simonklee/opentui-tex-native-win32-arm64": "0.2.0",
93
- "@simonklee/opentui-tex-native-win32-x64": "0.2.0"
91
+ "@simonklee/opentui-tex-native-darwin-arm64": "0.3.1",
92
+ "@simonklee/opentui-tex-native-darwin-x64": "0.3.1",
93
+ "@simonklee/opentui-tex-native-linux-arm64": "0.3.1",
94
+ "@simonklee/opentui-tex-native-linux-arm64-musl": "0.3.1",
95
+ "@simonklee/opentui-tex-native-linux-x64": "0.3.1",
96
+ "@simonklee/opentui-tex-native-linux-x64-musl": "0.3.1",
97
+ "@simonklee/opentui-tex-native-win32-arm64": "0.3.1",
98
+ "@simonklee/opentui-tex-native-win32-x64": "0.3.1"
94
99
  },
95
100
  "publishConfig": {
96
101
  "access": "public",