oxc-parser 0.55.0 → 0.56.1

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/index.d.ts CHANGED
@@ -201,6 +201,9 @@ export declare function parseSync(filename: string, sourceText: string, options?
201
201
  */
202
202
  export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): void
203
203
 
204
+ /** Returns `true` if raw transfer is supported on this platform. */
205
+ export declare function rawTransferSupported(): boolean
206
+
204
207
  export declare const enum Severity {
205
208
  Error = 'Error',
206
209
  Warning = 'Warning',
package/index.js CHANGED
@@ -68,6 +68,10 @@ module.exports.parseSync = function parseSync(filename, sourceText, options) {
68
68
  let buffer, encoder;
69
69
 
70
70
  function parseSyncRaw(filename, sourceText, options) {
71
+ if (!rawTransferSupported()) {
72
+ throw new Error('`experimentalRawTransfer` option is not supported on 32-bit or big-endian systems');
73
+ }
74
+
71
75
  // Delete `experimentalRawTransfer` option
72
76
  let experimentalRawTransfer;
73
77
  ({ experimentalRawTransfer, ...options } = options);
@@ -138,3 +142,14 @@ function createBuffer() {
138
142
  const offset = bindings.getBufferOffset(new Uint8Array(arrayBuffer));
139
143
  return new Uint8Array(arrayBuffer, offset, TWO_GIB);
140
144
  }
145
+
146
+ let rawTransferIsSupported = null;
147
+
148
+ // Returns `true` if `experimentalRawTransfer` is option is supported.
149
+ // Raw transfer is only available on 64-bit little-endian systems.
150
+ function rawTransferSupported() {
151
+ if (rawTransferIsSupported === null) rawTransferIsSupported = bindings.rawTransferSupported();
152
+ return rawTransferIsSupported;
153
+ }
154
+
155
+ module.exports.rawTransferSupported = rawTransferSupported;
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "oxc-parser",
3
- "version": "0.55.0",
3
+ "version": "0.56.1",
4
+ "main": "index.js",
5
+ "browser": "browser.js",
4
6
  "description": "Oxc Parser Node API",
5
7
  "keywords": [
6
- "Parser"
8
+ "oxc",
9
+ "parser"
7
10
  ],
8
11
  "author": "Boshen and oxc contributors",
9
12
  "license": "MIT",
@@ -17,23 +20,44 @@
17
20
  "funding": {
18
21
  "url": "https://github.com/sponsors/Boshen"
19
22
  },
20
- "main": "index.js",
21
23
  "files": [
22
24
  "index.d.ts",
23
25
  "index.js",
24
- "bindings.js"
26
+ "browser.js",
27
+ "bindings.js",
28
+ "deserialize-js.js",
29
+ "deserialize-ts.js"
25
30
  ],
31
+ "publishConfig": {
32
+ "registry": "https://registry.npmjs.org/",
33
+ "access": "public"
34
+ },
26
35
  "dependencies": {
27
- "@oxc-project/types": "^0.55.0"
36
+ "@oxc-project/types": "^0.56.1"
37
+ },
38
+ "engines": {
39
+ "node": ">=14.0.0"
28
40
  },
29
- "optionalDependencies": {
30
- "@oxc-parser/binding-win32-x64-msvc": "0.55.0",
31
- "@oxc-parser/binding-win32-arm64-msvc": "0.55.0",
32
- "@oxc-parser/binding-linux-x64-gnu": "0.55.0",
33
- "@oxc-parser/binding-linux-arm64-gnu": "0.55.0",
34
- "@oxc-parser/binding-linux-x64-musl": "0.55.0",
35
- "@oxc-parser/binding-linux-arm64-musl": "0.55.0",
36
- "@oxc-parser/binding-darwin-x64": "0.55.0",
37
- "@oxc-parser/binding-darwin-arm64": "0.55.0"
41
+ "napi": {
42
+ "binaryName": "parser",
43
+ "packageName": "@oxc-parser/binding",
44
+ "targets": [
45
+ "x86_64-pc-windows-msvc",
46
+ "aarch64-pc-windows-msvc",
47
+ "x86_64-unknown-linux-gnu",
48
+ "x86_64-unknown-linux-musl",
49
+ "aarch64-unknown-linux-gnu",
50
+ "aarch64-unknown-linux-musl",
51
+ "armv7-unknown-linux-gnueabihf",
52
+ "x86_64-apple-darwin",
53
+ "aarch64-apple-darwin",
54
+ "wasm32-wasip1"
55
+ ],
56
+ "wasm": {
57
+ "browser": {
58
+ "fs": false
59
+ }
60
+ },
61
+ "dtsHeaderFile": "header.js"
38
62
  }
39
63
  }