@lingxia/rong
v0.2.0
Published
TypeScript type definitions for Rong JavaScript runtime
Readme
@lingxia/rong
TypeScript type definitions for the Rong JavaScript runtime (globals injected by Rust).
Scope
- Provides
.d.ts/TS sources for the runtime surface so editors/TS can typecheck Rong scripts. - Not a runtime polyfill: it does not provide implementations, only types.
Runtime Export Map (high level)
Rong injects a small set of globals:
Rongnamespace: file system + storage- Globals:
process,child_process,path,fetch,timers,assert,atob,btoa
Rong also implements/extends a subset of Web APIs; the type package relies on TypeScript’s DOM libs for base types like URL, ReadableStream, AbortController, etc.
Installation
npm install @lingxia/rongUsage (typechecking only)
Add to your tsconfig.json:
{
"compilerOptions": {
"types": ["@lingxia/rong"]
}
}Notes:
- This enables global typings; you should not
importruntime modules like'child_process'or'http'(those are Rong globals, not Node modules). - Ensure your
tsconfig.jsonlibincludes"DOM"if you want DOM globals (e.g.URL,ReadableStream) to be typed.
Accuracy notes (common gotchas)
- Storage is not
localStorage-compatible. Useawait Rong.storage.open(path)ornew Rong.Storage(path), thenset/get/delete/clear/list/info. - Directory listing is
Rong.readDir(...)(async iterator), notRong.readdir(...). - HTTP is the global
fetch(...)API. There is nohttpnamespace and nodownloadJS API.
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run watch