@ttsc/wasm 0.14.0-dev.20260529.1 → 0.14.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/README.md +6 -6
- package/dist/ttsc.wasm +0 -0
- package/host/fountain.go +290 -290
- package/lib/src/MemFSError.d.ts +3 -3
- package/lib/src/MemFSError.js +3 -3
- package/lib/src/bootTtsc.d.ts +12 -12
- package/lib/src/bootTtsc.js +33 -34
- package/lib/src/bootTtsc.js.map +1 -1
- package/lib/src/createMemFS.js +2 -2
- package/lib/src/createMemFS.js.map +1 -1
- package/lib/src/parseResult.d.ts +2 -3
- package/lib/src/parseResult.js +2 -3
- package/lib/src/parseResult.js.map +1 -1
- package/lib/src/structures/IBootTtscOptions.d.ts +6 -7
- package/lib/src/structures/ITtscApi.d.ts +5 -5
- package/lib/src/structures/ITtscCompileResult.d.ts +2 -2
- package/lib/src/structures/ITtscPositionQuery.d.ts +4 -1
- package/lib/src/structures/ITtscTransformResult.d.ts +2 -2
- package/lib/src/structures/IWasmExecFS.d.ts +3 -3
- package/package.json +2 -2
- package/src/MemFSError.ts +3 -3
- package/src/bootTtsc.ts +31 -33
- package/src/createMemFS.ts +0 -1
- package/src/parseResult.ts +2 -3
- package/src/structures/IBootTtscOptions.ts +6 -7
- package/src/structures/ITtscApi.ts +5 -5
- package/src/structures/ITtscCompileResult.ts +2 -2
- package/src/structures/ITtscPositionQuery.ts +4 -1
- package/src/structures/ITtscTransformResult.ts +2 -2
- package/src/structures/IWasmExecFS.ts +3 -3
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ In-browser ttsc playground scaffolding. Compose ttsc + typescript-go with your o
|
|
|
6
6
|
|
|
7
7
|
## What you get
|
|
8
8
|
|
|
9
|
-
- A base `ttsc.wasm` (under `dist/`) that exposes vanilla `build` / `check` / `transform
|
|
9
|
+
- A base `ttsc.wasm` (under `dist/`) that exposes vanilla `build` / `check` / `transform`, no plugins linked. Useful as a sanity test or a no-plugin baseline.
|
|
10
10
|
- A Go helper package (`host/`) plugin authors import from their own `main_wasm.go` to bind a wasm to `globalThis[yourApiName]`.
|
|
11
11
|
- A JS runtime (`bootTtsc`, `createMemFS`, typed `ITtscApi` surface) that loads any host-built wasm into a Web Worker.
|
|
12
12
|
|
|
@@ -91,7 +91,7 @@ GOOS=js GOARCH=wasm go build -trimpath \
|
|
|
91
91
|
|
|
92
92
|
The `version`, `commit`, and `date` variables in `host/host.go` are all overridable. `globalThis[apiName].version()` reads from them.
|
|
93
93
|
|
|
94
|
-
4. Boot it from JS (a Web Worker is **required
|
|
94
|
+
4. Boot it from JS (a Web Worker is **required**: Go's `syscall/js` blocks the runtime while the wasm is alive; running on the main thread freezes the page). Use a classic Worker or a bundler target that still exposes `importScripts`; `bootTtsc` imports `wasm_exec.js` before starting Go.
|
|
95
95
|
|
|
96
96
|
```ts
|
|
97
97
|
import { bootTtsc } from "@ttsc/wasm";
|
|
@@ -112,7 +112,7 @@ Booting two wasms with the same `apiName` overwrites the previous global binding
|
|
|
112
112
|
|
|
113
113
|
## Fountain API (snapshot, AST, type checker)
|
|
114
114
|
|
|
115
|
-
For embedders that want `embed-typescript`-style raw access to the program
|
|
115
|
+
For embedders that want `embed-typescript`-style raw access to the program, diagnostics, AST nodes, the type checker at a position. The same `globalThis[apiName]` object also exposes fountain verbs. They share the standard `{code, stdout, stderr, result}` envelope; `result` is JSON.
|
|
116
116
|
|
|
117
117
|
```ts
|
|
118
118
|
import { bootTtsc, parseResult } from "@ttsc/wasm";
|
|
@@ -159,7 +159,7 @@ Verbs and payload types:
|
|
|
159
159
|
| `getTypeAtPosition({ handle, path, position })` | `ITtscTypeAtPositionResult` `{ type }` |
|
|
160
160
|
| `getSymbolAtPosition({ handle, path, position })` | `ITtscSymbolAtPositionResult` `{ symbol }` |
|
|
161
161
|
|
|
162
|
-
`position` is a **byte offset** into the source text
|
|
162
|
+
`position` is a **byte offset** into the source text. The same coordinate TypeScript-Go uses internally. JS callers that have a UTF-16 `(line, character)` pair (e.g. From Monaco) must convert it before calling.
|
|
163
163
|
|
|
164
164
|
**Lifecycle:** JS owns the handle. The wasm keeps the program (parsed AST, checker pool lease, every source file) alive until you call `releaseSnapshot`. Leaking handles leaks memory in the wasm linear heap.
|
|
165
165
|
|
|
@@ -174,7 +174,7 @@ type Plugin interface {
|
|
|
174
174
|
}
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
The host installs `globalThis[apiName].plugin({ name, command, ...opts })` that translates the JS options object into a CLI-shaped argv and calls your plugin's `Run`. Your `Run` body can forward to the same function the native sidecar's `main.go` calls
|
|
177
|
+
The host installs `globalThis[apiName].plugin({ name, command, ...opts })` that translates the JS options object into a CLI-shaped argv and calls your plugin's `Run`. Your `Run` body can forward to the same function the native sidecar's `main.go` calls, for example `utility.RunBuild(args)` for plugins backed by `packages/ttsc/utility`.
|
|
178
178
|
|
|
179
179
|
## Published-tarball Go module layout
|
|
180
180
|
|
|
@@ -182,7 +182,7 @@ The published `@ttsc/wasm` tarball ships:
|
|
|
182
182
|
|
|
183
183
|
- A rewritten root `go.mod` whose `replace` directives point at `./shim-vendor/shim/*` (vendored at pack time from `packages/ttsc/shim/`).
|
|
184
184
|
- The full `host/`, `cmd/`, `build/` Go source so consumers can `go build -tags '...'` their own wasm against your host helper.
|
|
185
|
-
- `dist/ttsc.wasm` + `dist/wasm_exec.js
|
|
185
|
+
- `dist/ttsc.wasm` + `dist/wasm_exec.js`: the no-plugin sanity binary and the Go runtime loader.
|
|
186
186
|
|
|
187
187
|
The tarball intentionally drops the `replace github.com/samchon/ttsc/packages/ttsc => ../ttsc` directive that the in-repo `go.mod` carries: consumers of the published module who want to rebuild the wasm must supply their own `replace` (or vendor `packages/ttsc` themselves). The published `dist/ttsc.wasm` is plug-and-play for runtime use; the Go module is for **plugin authors extending the host**, not for vanilla consumers.
|
|
188
188
|
|
package/dist/ttsc.wasm
CHANGED
|
Binary file
|