Quick start — scaffold a new project

npm install -g @configuredthings/rdp.js
mkdir my-parser && cd my-parser
rdp-gen init --name my-parser
npm install
npm run build   # compiles src/MyParser.ts → dist/

rdp-gen init writes a package.json, a tsconfig.json with all required compiler options pre-configured, and a starter src/MyParser.ts containing the private-constructor / static-parse boilerplate — so the project compiles immediately and you can start filling in grammar rules.

Add --observable to extend ObservableRDParser instead, with notifyEnter/notifyExit call sites pre-wired and an optional ParseObserver parameter in static parse().

Setup without scaffolding

Install: npm install @configuredthings/rdp.js

Required tsconfig.json options:

{
  "compilerOptions": {
    "target": "ES2022",
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "moduleResolution": "node16"
  }
}
  • target: ES2022 — required for native # private fields
  • strict: true — generated code is written to strict standards
  • noUncheckedIndexedAccess: true — all array accesses are null-aware
  • moduleResolution: node16 or bundler — required for the package exports map