@ohm-js/wasm 0.6.3 → 0.6.5

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,20 +1,20 @@
1
1
  import type { CstNode, MatchResult } from './miniohm.ts';
2
- export type AstNodeTemplate = {
3
- [property: string]: number | string | boolean | object | null | ((this: AstBuilder, children: CstNode[]) => any);
2
+ export type AstNodeTemplate<T> = {
3
+ [property: string]: number | string | boolean | object | null | ((this: AstBuilder, children: CstNode[]) => T);
4
4
  };
5
- export type AstMapping = Record<string, AstNodeTemplate | number | ((this: AstBuilder, ...children: CstNode[]) => any)>;
6
- export declare class AstBuilder {
5
+ export type AstMapping<T> = Record<string, AstNodeTemplate<T> | number | ((this: AstBuilder, ...children: CstNode[]) => T)>;
6
+ export declare class AstBuilder<T = any> {
7
7
  currNode?: CstNode;
8
8
  private _mapping;
9
9
  private _depth;
10
10
  private _debug;
11
- constructor(mapping: AstMapping, opts?: {
11
+ constructor(mapping: AstMapping<T>, opts?: {
12
12
  debug?: boolean;
13
13
  });
14
14
  private _debugLog;
15
15
  _visitTerminal(node: CstNode): string;
16
16
  _visitNonterminal(node: CstNode): unknown;
17
- _visitIter(node: CstNode): unknown;
18
- toAst(nodeOrResult: MatchResult | CstNode): unknown;
17
+ _visitIter(node: CstNode): T[] | T | null;
18
+ toAst(nodeOrResult: MatchResult | CstNode): T;
19
19
  }
20
20
  //# sourceMappingURL=AstBuilder.d.ts.map
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@ohm-js/wasm",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "Compile Ohm.js grammars to WebAsssembly",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  ".": {
8
- "import": "./dist/index.js",
8
+ "default": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts"
10
10
  },
11
11
  "./compat": {
12
- "import": "./dist/src/compat.js",
12
+ "default": "./dist/src/compat.js",
13
13
  "types": "./dist/src/compat.d.ts"
14
14
  },
15
15
  "./compiler": {
16
- "import": "./dist/src/Compiler.js",
16
+ "default": "./dist/src/Compiler.js",
17
17
  "types": "./dist/src/Compiler.d.ts"
18
18
  }
19
19
  },