oxc-parser 0.9.0 → 0.13.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.
Files changed (2) hide show
  1. package/README.md +10 -28
  2. package/package.json +9 -9
package/README.md CHANGED
@@ -2,34 +2,11 @@
2
2
 
3
3
  See index.d.ts for `parseSync` and `parseAsync` API.
4
4
 
5
- TypeScript typings for the AST is currently work in progress.
6
-
7
- ## cjs
8
-
9
- ```javascript
10
- const oxc = require("oxc-parser");
11
- const assert = require('assert');
12
-
13
- function test(ret) {
14
- const program = JSON.parse(ret.program);
15
- assert(program.body.length == 1);
16
- assert(ret.errors.length == 0);
17
- }
18
-
19
- test(oxc.parseSync("foo"));
20
-
21
- async function main() {
22
- test(await oxc.parseAsync("foo"));
23
- }
24
-
25
- main()
26
- ```
27
-
28
5
  ## ESM
29
6
 
30
7
  ```javascript
31
- import oxc from 'oxc-parser';
32
- import assert from 'assert';
8
+ import oxc from "oxc-parser";
9
+ import assert from "assert";
33
10
 
34
11
  function test(ret) {
35
12
  const program = JSON.parse(ret.program);
@@ -37,11 +14,16 @@ function test(ret) {
37
14
  assert(ret.errors.length == 0);
38
15
  }
39
16
 
40
- test(oxc.parseSync("foo"));
17
+ const sourceText = "let foo: Foo = 'foo';";
18
+ const options = {
19
+ sourceFilename: "text.tsx", // the extension is used to determine which dialect to parse
20
+ };
21
+
22
+ test(oxc.parseSync(sourceText, options));
41
23
 
42
24
  async function main() {
43
- test(await oxc.parseAsync("foo"));
25
+ test(await oxc.parseAsync(sourceText, options));
44
26
  }
45
27
 
46
- main()
28
+ main();
47
29
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-parser",
3
- "version": "0.9.0",
3
+ "version": "0.13.3",
4
4
  "description": "Oxc Parser Node API",
5
5
  "keywords": [
6
6
  "Parser"
@@ -23,13 +23,13 @@
23
23
  "index.js"
24
24
  ],
25
25
  "optionalDependencies": {
26
- "@oxc-parser/binding-win32-x64-msvc": "0.9.0",
27
- "@oxc-parser/binding-win32-arm64-msvc": "0.9.0",
28
- "@oxc-parser/binding-linux-x64-gnu": "0.9.0",
29
- "@oxc-parser/binding-linux-arm64-gnu": "0.9.0",
30
- "@oxc-parser/binding-linux-x64-musl": "0.9.0",
31
- "@oxc-parser/binding-linux-arm64-musl": "0.9.0",
32
- "@oxc-parser/binding-darwin-x64": "0.9.0",
33
- "@oxc-parser/binding-darwin-arm64": "0.9.0"
26
+ "@oxc-parser/binding-win32-x64-msvc": "0.13.3",
27
+ "@oxc-parser/binding-win32-arm64-msvc": "0.13.3",
28
+ "@oxc-parser/binding-linux-x64-gnu": "0.13.3",
29
+ "@oxc-parser/binding-linux-arm64-gnu": "0.13.3",
30
+ "@oxc-parser/binding-linux-x64-musl": "0.13.3",
31
+ "@oxc-parser/binding-linux-arm64-musl": "0.13.3",
32
+ "@oxc-parser/binding-darwin-x64": "0.13.3",
33
+ "@oxc-parser/binding-darwin-arm64": "0.13.3"
34
34
  }
35
35
  }