@ootr/udon-assembly-ts
v0.0.7
Published
TypeScript to Udon Assembly transpiler and UdonSharp stubs
Downloads
628
Readme
udon-assembly-ts
TypeScript to Udon Assembly (.uasm) transpiler and UdonSharp-compatible TypeScript stubs.
Features
- TypeScript -> TAC -> Udon Assembly pipeline
- Optional TAC optimization
- Batch transpilation for directories
- UdonSharp-compatible stubs for VRChat/Unity types
Installation
pnpm add @ootr/udon-assembly-tsLibrary Usage
import { TypeScriptToUdonTranspiler } from "@ootr/udon-assembly-ts";
const transpiler = new TypeScriptToUdonTranspiler();
const result = transpiler.transpile(`
let x: number = 10;
let y: number = 20;
if (x < y) {
let z: number = x + y;
}
`);
console.log(result.uasm);
console.log(result.tac);With Optimization
const result = transpiler.transpile(sourceCode, { optimize: true });CLI Usage
udon-assembly-ts -i src -o output/transpilerOptions:
-i,--input <dir>: Input directory (repeatable)-o,--output <dir>: Output directory (default:output/transpiler)-v,--verbose: Verbose logging--no-optimize: Disable TAC optimization--reflect: Append reflection metadata to data section
Stubs Usage
import { UdonTypeConverters } from "@ootr/udon-assembly-ts/stubs";
import { UdonBehaviour } from "@ootr/udon-assembly-ts/stubs/UdonDecorators";Project Structure
src/
├── transpiler/ # TypeScript parsing, IR, codegen
├── stubs/ # UdonSharp-compatible stubs
└── cli/ # Batch transpiler CLITesting
pnpm testReferences
- https://github.com/vrchat-community/creator-docs
- https://github.com/MerlinVR/UdonSharp
License
This project is licensed under the MIT License. See the LICENSE file for details.
