toilscript 0.1.6 → 0.1.8

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.
@@ -2938,6 +2938,10 @@ declare module "types:toilscript/src/parser" {
2938
2938
  parseFunctionExpression(tn: Tokenizer): FunctionExpression | null;
2939
2939
  private parseFunctionExpressionCommon;
2940
2940
  parseClassOrInterface(tn: Tokenizer, flags: CommonFlags, decorators: DecoratorNode[] | null, startPos: number): ClassDeclaration | null;
2941
+ /** Synthesize and append the binary codec members to a `@data` class. */
2942
+ private injectDataCodec;
2943
+ /** Parse a synthesized member from source text and append it to the class. */
2944
+ private injectClassMember;
2941
2945
  parseClassExpression(tn: Tokenizer): ClassExpression | null;
2942
2946
  parseClassMember(tn: Tokenizer, parent: ClassDeclaration): Node | null;
2943
2947
  parseIndexSignature(tn: Tokenizer, flags: CommonFlags, decorators: DecoratorNode[] | null): IndexSignatureNode | null;
@@ -3431,7 +3435,13 @@ declare module "types:toilscript/src/program" {
3431
3435
  /** Is considered unsafe code. */
3432
3436
  Unsafe = 2048,
3433
3437
  /** Is the toil module entry point (`@main`). */
3434
- Main = 4096
3438
+ Main = 4096,
3439
+ /** Is a `@data` serializable class. */
3440
+ Data = 8192,
3441
+ /** Is a `@remote` client-callable function (RPC endpoint). */
3442
+ Remote = 16384,
3443
+ /** Is a `@service` class that namespaces `@remote` methods. */
3444
+ Service = 32768
3435
3445
  }
3436
3446
  export namespace DecoratorFlags {
3437
3447
  /** Translates a decorator kind to the respective decorator flag. */
@@ -6288,7 +6298,10 @@ declare module "types:toilscript/src/ast" {
6288
6298
  Builtin = 11,
6289
6299
  Lazy = 12,
6290
6300
  Unsafe = 13,
6291
- Main = 14
6301
+ Main = 14,
6302
+ Data = 15,
6303
+ Remote = 16,
6304
+ Service = 17
6292
6305
  }
6293
6306
  export namespace DecoratorKind {
6294
6307
  /** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */
@@ -9633,6 +9646,30 @@ declare module "types:toilscript/src/index-wasm" {
9633
9646
  /** Optimizes a module. */
9634
9647
  export function optimize(module: Module, optimizeLevel: number, shrinkLevel: number, debugInfo?: boolean, zeroFilledMemory?: boolean): void;
9635
9648
  }
9649
+ declare module "types:toilscript/src/rpc" {
9650
+ /**
9651
+ * RPC module emission. Walks the parsed user sources for `@data` types and the
9652
+ * `@remote`/`@service` surface and emits ONE working TypeScript module
9653
+ * (`--rpcModule <path.ts>`), refreshed whenever the server is built:
9654
+ *
9655
+ * - an `export class` per `@data` type, mirroring the ToilScript `@data` class
9656
+ * (`encodeInto`/`encode`/`decodeFrom`/`decode`/`dataId`) over the global
9657
+ * DataWriter/DataReader (no runtime JSON to load), and
9658
+ * - `declare global { const Server: ... }`, the typed client-callable surface, so
9659
+ * the IDE types `Server.x.y()` with zero imports (no separate `.d.ts` needed).
9660
+ *
9661
+ * AS types map to TS (u64 -> bigint, a `@data` class -> its generated interface).
9662
+ * Generated from the AST alone, so it needs nothing beyond a parse. The runtime
9663
+ * `Server` proxy + transport are provided by toiljs.
9664
+ */
9665
+ import { Program } from "types:toilscript/src/program";
9666
+ /**
9667
+ * Builds the `server.ts` working module for `program`, or `null` when nothing is
9668
+ * exposed (no `@data`/`@remote`/`@service`). `runtime` is the import specifier for
9669
+ * the DataWriter/DataReader codec (e.g. `toiljs/io`).
9670
+ */
9671
+ export function buildServerModule(program: Program, runtime: string): string | null;
9672
+ }
9636
9673
  declare module "types:toilscript/src/extra/ast" {
9637
9674
  /**
9638
9675
  * @fileoverview Abstract Syntax Tree extras.
@@ -9737,6 +9774,7 @@ declare module "types:toilscript/src/index-js" {
9737
9774
  export * from "types:toilscript/src/module";
9738
9775
  export * from "types:toilscript/src/parser";
9739
9776
  export * from "types:toilscript/src/program";
9777
+ export * from "types:toilscript/src/rpc";
9740
9778
  export * from "types:toilscript/src/resolver";
9741
9779
  export * from "types:toilscript/src/tokenizer";
9742
9780
  export * from "types:toilscript/src/types";