GamingTS

Architecture

Monorepo Structure

GTS is a monorepo managed with pnpm (workspaces defined in the root package.json). Each package uses tsdown for building, with the root pnpm build command orchestrating builds in dependency order via pnpm -r build.

gts/
├── packages/
│   ├── transpiler/          # Core: parse .gts → transform → emit JS
│   ├── runtime/             # Runtime library (ViewModel, createDefine, createBinding)
│   ├── language-plugin/     # Volar language plugin (virtual code generation)
│   ├── language-server/     # LSP server (Node.js + browser entry points)
│   ├── unplugin/            # Build plugin (vite, esbuild, rollup, rspack, webpack, bun)
│   ├── tsc/                 # CLI: gtsc (TypeScript compiler with GTS support)
│   ├── typescript-language-service-plugin/  # TS Language Service Plugin (CJS)
│   └── vscode/              # VS Code extension (syntax, LSP client)
├── examples/
│   ├── local/               # Dev testing with .gts files
│   ├── provider/            # Example provider (ViewModel definitions)
│   └── web/                 # Vite + web example
└── package.json             # Root workspace definition

Package Map

Packagenpm NameFormatTargetPurpose
transpiler@gi-tcg/gts-transpilerESMbrowserCore compilation engine
runtime@gi-tcg/gts-runtimeESMbrowserRuntime library for execution
language-plugin@gi-tcg/gts-language-pluginESMbrowserVolar virtual code provider
language-server@gi-tcg/gts-language-serverESMnode+browserFull LSP implementation
unplugin@gi-tcg/unplugin-gtsESMbrowserMulti-bundler build plugin (vite, esbuild, rollup, rspack, webpack, bun)
tsc@gi-tcg/gtscESMnodeCLI compiler wrapper
ts-ls-plugin@gi-tcg/gts-typescript-language-service-pluginCJSnodeTS editor plugin
vscodegts-vscode (private)CJSnodeVS Code extension

Dependency Graph

                        ┌──────────────┐
                        │  transpiler  │
                        └──────┬───────┘
                               │ used by
         ┌───────────┬─────────┴─┬────────┬───────────┐
         │           │           │        │           │
   ┌─────┴─────┐ ┌───┴────┐ ┌────┴───┐ ┌──┴───┐  ┌────┴─────┐
   │  esbuild  │ │unplugin│ │language│ │ tsc  │  │ language │
   │  plugin   │ │        │ │ plugin │ │(gtsc)│  │  server  │
   └───────────┘ └────────┘ └────┬───┘ └───┬──┘  └────┬─────┘
                                 │         │          │
                                 │    uses language-plugin
                                 │         │          │
                                 └─────────┼──────────┘

                              ┌────────────┴──────────────┐
                              │ ts-language-service-plugin│
                              └────────────┬──────────────┘

                              ┌────────────┴──────────────┐
                              │     vscode extension      │
                              └───────────────────────────┘

      ┌──────────┐
      │ runtime  │  (standalone — consumed by user code at runtime)
      └──────────┘

Key relationships:

  • transpiler is the foundational package; all build plugins and language tools depend on it.
  • language-plugin wraps the transpiler's Volar output into a Volar LanguagePlugin — used by the language server, gtsc, and the TS language service plugin.
  • runtime is independent and only consumed by the generated JavaScript at execution time.

Build System

tsdown (Package Bundler)

Each package uses tsdown as its bundler, configured in a per-package tsdown.config.ts. The root pnpm build runs pnpm -r build, which executes each package's build script (typically tsdown) in dependency order.

External Dependencies

Transpiler Dependencies

PackageVersionPurpose
acorn8.16.0JavaScript parser (base)
@sveltejs/acorn-typescriptTypeScript syntax plugin for Acorn
esrap2.2.1AST printer with source map support (used in runtime pipeline)
espolar0.3.0AST printer with native Volar CodeMapping support (used in IDE/Volar pipeline)
zimmerframe1.1.4AST walker/visitor framework
magic-string0.30.21Source map generation
@jridgewell/sourcemap-codecVLQ source map decoding

Language Tooling Dependencies

PackagePurpose
@volar/language-coreVolar virtual code and language plugin interfaces
@volar/language-serverLSP server framework
@volar/typescriptTypeScript integration for Volar
volar-service-typescriptTypeScript language service for Volar
vscode-uriURI handling for VS Code/LSP

Publishing

The scripts/publish.ts script validates consistency across all 8 public packages (version, repository, license) and publishes each to npm with --access public. Current version: 0.2.0.

On this page