@gi-tcg/gts-transpiler 0.4.2 → 0.4.3

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.
package/dist/index.js CHANGED
@@ -203,7 +203,7 @@ function gtsPlugin(options = {}) {
203
203
  dummy.isDummy = true;
204
204
  return this.finishNode(dummy, "Identifier");
205
205
  }
206
- return this.parseExprAtom();
206
+ return this.parseExprSubscripts(void 0, false);
207
207
  }
208
208
  gts_parseShortcutFunction() {
209
209
  const node = this.startNode();
@@ -1563,7 +1563,7 @@ const gtsToTypingsWalker = {
1563
1563
  };
1564
1564
  state.literalFromIdentifier.add(lit);
1565
1565
  return lit;
1566
- } else return { ...visit(attr) };
1566
+ } else return visit(attr);
1567
1567
  });
1568
1568
  const returnValue = {
1569
1569
  type: "Identifier",
@@ -1976,7 +1976,8 @@ const DEFAULT_GTS_CONFIG = {
1976
1976
  "anemo",
1977
1977
  "geo",
1978
1978
  "dendro",
1979
- "omni"
1979
+ "omni",
1980
+ "$"
1980
1981
  ],
1981
1982
  queryBindings: ["my", "opp"]
1982
1983
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gi-tcg/gts-transpiler",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/piovium/gts.git"
package/src/config.ts CHANGED
@@ -42,6 +42,7 @@ const DEFAULT_GTS_CONFIG: Required<GtsConfig> = {
42
42
  "geo",
43
43
  "dendro",
44
44
  "omni",
45
+ "$",
45
46
  ],
46
47
  queryBindings: ["my", "opp"],
47
48
  };
@@ -1,4 +1,4 @@
1
- import { tokTypes, type Parser as ParserClass } from "acorn";
1
+ import { tokTypes, type Parser as ParserClass, type Node } from "acorn";
2
2
  import type { Parse, AST } from "../types.ts";
3
3
  import { specialIdentifiers } from "../keywords.ts";
4
4
  import { DUMMY_PLACEHOLDER } from "./loose_plugin.ts";
@@ -46,7 +46,8 @@ AttributeExpression:
46
46
  # foo bar { baz = 1 };
47
47
  # foo bar, { baz: 1 }; // If allowed, hard to distinguish
48
48
  # foo bar, ({ baz: 1 }); // OK
49
- [lookahead != "{"] PrimaryExpression
49
+ [lookahead != "{"] CallExpression OptionalChain?
50
+ [lookahead != "{"] MemberExpression OptionalChain?
50
51
 
51
52
  DirectShortcutFunction:
52
53
  [lookahead = one of ":", ReservedWord]
@@ -260,7 +261,7 @@ export function gtsPlugin(options: GtsPluginOption = {}) {
260
261
  dummy.isDummy = true;
261
262
  return this.finishNode(dummy, "Identifier");
262
263
  }
263
- return this.parseExprAtom();
264
+ return this.parseExprSubscripts(void 0, false);
264
265
  }
265
266
 
266
267
  gts_parseShortcutFunction() {
@@ -389,7 +389,7 @@ export const gtsToTypingsWalker: Visitors<Node, TypingTranspileState> = {
389
389
  state.literalFromIdentifier.add(lit);
390
390
  return lit;
391
391
  } else {
392
- return { ...(visit(attr) as Expression) };
392
+ return visit(attr) as Expression;
393
393
  }
394
394
  },
395
395
  );