toilscript 0.1.7 → 0.1.9

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "imports": {
3
- "toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.7/dist/toilscript.js",
4
- "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.7/dist/cli.js",
3
+ "toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.9/dist/toilscript.js",
4
+ "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.9/dist/cli.js",
5
5
  "binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
6
6
  "long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
7
7
  }
@@ -2998,6 +2998,10 @@ declare module "types:toilscript/src/parser" {
2998
2998
  parseFunctionExpression(tn: Tokenizer): FunctionExpression | null;
2999
2999
  private parseFunctionExpressionCommon;
3000
3000
  parseClassOrInterface(tn: Tokenizer, flags: CommonFlags, decorators: DecoratorNode[] | null, startPos: number): ClassDeclaration | null;
3001
+ /** Synthesize and append the binary codec members to a `@data` class. */
3002
+ private injectDataCodec;
3003
+ /** Parse a synthesized member from source text and append it to the class. */
3004
+ private injectClassMember;
3001
3005
  parseClassExpression(tn: Tokenizer): ClassExpression | null;
3002
3006
  parseClassMember(tn: Tokenizer, parent: ClassDeclaration): Node | null;
3003
3007
  parseIndexSignature(tn: Tokenizer, flags: CommonFlags, decorators: DecoratorNode[] | null): IndexSignatureNode | null;
@@ -3491,7 +3495,13 @@ declare module "types:toilscript/src/program" {
3491
3495
  /** Is considered unsafe code. */
3492
3496
  Unsafe = 2048,
3493
3497
  /** Is the toil module entry point (`@main`). */
3494
- Main = 4096
3498
+ Main = 4096,
3499
+ /** Is a `@data` serializable class. */
3500
+ Data = 8192,
3501
+ /** Is a `@remote` client-callable function (RPC endpoint). */
3502
+ Remote = 16384,
3503
+ /** Is a `@service` class that namespaces `@remote` methods. */
3504
+ Service = 32768
3495
3505
  }
3496
3506
  export namespace DecoratorFlags {
3497
3507
  /** Translates a decorator kind to the respective decorator flag. */
@@ -7707,7 +7717,10 @@ declare module "types:toilscript/src/ast" {
7707
7717
  Builtin = 11,
7708
7718
  Lazy = 12,
7709
7719
  Unsafe = 13,
7710
- Main = 14
7720
+ Main = 14,
7721
+ Data = 15,
7722
+ Remote = 16,
7723
+ Service = 17
7711
7724
  }
7712
7725
  export namespace DecoratorKind {
7713
7726
  /** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */
@@ -9567,6 +9580,30 @@ declare module "types:toilscript/src/index-wasm" {
9567
9580
  /** Optimizes a module. */
9568
9581
  export function optimize(module: Module, optimizeLevel: number, shrinkLevel: number, debugInfo?: boolean, zeroFilledMemory?: boolean): void;
9569
9582
  }
9583
+ declare module "types:toilscript/src/rpc" {
9584
+ /**
9585
+ * RPC module emission. Walks the parsed user sources for `@data` types and the
9586
+ * `@remote`/`@service` surface and emits ONE working TypeScript module
9587
+ * (`--rpcModule <path.ts>`), refreshed whenever the server is built:
9588
+ *
9589
+ * - an `export class` per `@data` type, mirroring the ToilScript `@data` class
9590
+ * (`encodeInto`/`encode`/`decodeFrom`/`decode`/`dataId`) over the global
9591
+ * DataWriter/DataReader (no runtime JSON to load), and
9592
+ * - `declare global { const Server: ... }`, the typed client-callable surface, so
9593
+ * the IDE types `Server.x.y()` with zero imports (no separate `.d.ts` needed).
9594
+ *
9595
+ * AS types map to TS (u64 -> bigint, a `@data` class -> its generated interface).
9596
+ * Generated from the AST alone, so it needs nothing beyond a parse. The runtime
9597
+ * `Server` proxy + transport are provided by toiljs.
9598
+ */
9599
+ import { Program } from "types:toilscript/src/program";
9600
+ /**
9601
+ * Builds the `server.ts` working module for `program`, or `null` when nothing is
9602
+ * exposed (no `@data`/`@remote`/`@service`). `runtime` is the import specifier for
9603
+ * the DataWriter/DataReader codec (e.g. `toiljs/io`).
9604
+ */
9605
+ export function buildServerModule(program: Program, runtime: string): string | null;
9606
+ }
9570
9607
  declare module "types:toilscript/src/extra/ast" {
9571
9608
  /**
9572
9609
  * @fileoverview Abstract Syntax Tree extras.
@@ -9671,6 +9708,7 @@ declare module "types:toilscript/src/index-js" {
9671
9708
  export * from "types:toilscript/src/module";
9672
9709
  export * from "types:toilscript/src/parser";
9673
9710
  export * from "types:toilscript/src/program";
9711
+ export * from "types:toilscript/src/rpc";
9674
9712
  export * from "types:toilscript/src/resolver";
9675
9713
  export * from "types:toilscript/src/tokenizer";
9676
9714
  export * from "types:toilscript/src/types";