@oxc-parser/binding-wasm32-wasi 0.68.0 → 0.69.0

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.
@@ -12688,23 +12688,26 @@ function wrap(result) {
12688
12688
  }
12689
12689
  };
12690
12690
  }
12691
- function jsonParseAst(program) {
12692
- return JSON.parse(program, transform);
12691
+ function jsonParseAst(programJson) {
12692
+ const { node: program, fixes } = JSON.parse(programJson);
12693
+ for (const fixPath of fixes) {
12694
+ applyFix(program, fixPath);
12695
+ }
12696
+ return program;
12693
12697
  }
12694
- function transform(key, value) {
12695
- if (value === null && key === "value" && Object.hasOwn(this, "type") && this.type === "Literal") {
12696
- if (Object.hasOwn(this, "bigint")) {
12697
- return BigInt(this.bigint);
12698
- }
12699
- if (Object.hasOwn(this, "regex")) {
12700
- const { regex } = this;
12701
- try {
12702
- return RegExp(regex.pattern, regex.flags);
12703
- } catch (_err) {
12704
- }
12698
+ function applyFix(program, fixPath) {
12699
+ let node = program;
12700
+ for (const key of fixPath) {
12701
+ node = node[key];
12702
+ }
12703
+ if (node.bigint) {
12704
+ node.value = BigInt(node.bigint);
12705
+ } else {
12706
+ try {
12707
+ node.value = RegExp(node.regex.pattern, node.regex.flags);
12708
+ } catch (_err) {
12705
12709
  }
12706
12710
  }
12707
- return value;
12708
12711
  }
12709
12712
 
12710
12713
  // wasm.mjs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-parser/binding-wasm32-wasi",
3
- "version": "0.68.0",
3
+ "version": "0.69.0",
4
4
  "cpu": [
5
5
  "wasm32"
6
6
  ],
Binary file