oxc-parser 0.77.1 → 0.77.2
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.
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
module.exports = deserialize;
|
|
7
7
|
|
|
8
|
-
let uint8, uint32, float64, sourceText, sourceIsAscii,
|
|
8
|
+
let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen;
|
|
9
9
|
|
|
10
10
|
const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
|
|
11
11
|
decodeStr = textDecoder.decode.bind(textDecoder),
|
|
12
12
|
{ fromCodePoint } = String;
|
|
13
13
|
|
|
14
|
-
function deserialize(buffer, sourceTextInput,
|
|
14
|
+
function deserialize(buffer, sourceTextInput, sourceByteLenInput) {
|
|
15
15
|
uint8 = buffer;
|
|
16
16
|
uint32 = buffer.uint32;
|
|
17
17
|
float64 = buffer.float64;
|
|
18
18
|
|
|
19
19
|
sourceText = sourceTextInput;
|
|
20
|
-
|
|
21
|
-
sourceIsAscii = sourceText.length ===
|
|
20
|
+
sourceByteLen = sourceByteLenInput;
|
|
21
|
+
sourceIsAscii = sourceText.length === sourceByteLen;
|
|
22
22
|
|
|
23
23
|
const data = deserializeRawTransferData(uint32[536870906]);
|
|
24
24
|
|
|
@@ -4026,7 +4026,7 @@ function deserializeStr(pos) {
|
|
|
4026
4026
|
if (len === 0) return '';
|
|
4027
4027
|
|
|
4028
4028
|
pos = uint32[pos32];
|
|
4029
|
-
if (sourceIsAscii && pos <
|
|
4029
|
+
if (sourceIsAscii && pos < sourceByteLen) return sourceText.substr(pos, len);
|
|
4030
4030
|
|
|
4031
4031
|
// Longer strings use `TextDecoder`
|
|
4032
4032
|
// TODO: Find best switch-over point
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
module.exports = deserialize;
|
|
7
7
|
|
|
8
|
-
let uint8, uint32, float64, sourceText, sourceIsAscii,
|
|
8
|
+
let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen;
|
|
9
9
|
|
|
10
10
|
const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
|
|
11
11
|
decodeStr = textDecoder.decode.bind(textDecoder),
|
|
12
12
|
{ fromCodePoint } = String;
|
|
13
13
|
|
|
14
|
-
function deserialize(buffer, sourceTextInput,
|
|
14
|
+
function deserialize(buffer, sourceTextInput, sourceByteLenInput) {
|
|
15
15
|
uint8 = buffer;
|
|
16
16
|
uint32 = buffer.uint32;
|
|
17
17
|
float64 = buffer.float64;
|
|
18
18
|
|
|
19
19
|
sourceText = sourceTextInput;
|
|
20
|
-
|
|
21
|
-
sourceIsAscii = sourceText.length ===
|
|
20
|
+
sourceByteLen = sourceByteLenInput;
|
|
21
|
+
sourceIsAscii = sourceText.length === sourceByteLen;
|
|
22
22
|
|
|
23
23
|
const data = deserializeRawTransferData(uint32[536870906]);
|
|
24
24
|
|
|
@@ -4157,7 +4157,7 @@ function deserializeStr(pos) {
|
|
|
4157
4157
|
if (len === 0) return '';
|
|
4158
4158
|
|
|
4159
4159
|
pos = uint32[pos32];
|
|
4160
|
-
if (sourceIsAscii && pos <
|
|
4160
|
+
if (sourceIsAscii && pos < sourceByteLen) return sourceText.substr(pos, len);
|
|
4161
4161
|
|
|
4162
4162
|
// Longer strings use `TextDecoder`
|
|
4163
4163
|
// TODO: Find best switch-over point
|
|
@@ -12480,7 +12480,7 @@ function constructStr(pos, ast) {
|
|
|
12480
12480
|
if (len === 0) return '';
|
|
12481
12481
|
|
|
12482
12482
|
pos = uint32[pos32];
|
|
12483
|
-
if (ast.sourceIsAscii && pos < ast.
|
|
12483
|
+
if (ast.sourceIsAscii && pos < ast.sourceByteLen) return ast.sourceText.substr(pos, len);
|
|
12484
12484
|
|
|
12485
12485
|
// Longer strings use `TextDecoder`
|
|
12486
12486
|
// TODO: Find best switch-over point
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.77.
|
|
3
|
+
"version": "0.77.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"browser": "wasm.mjs",
|
|
6
6
|
"engines": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@oxc-project/types": "^0.77.
|
|
53
|
+
"@oxc-project/types": "^0.77.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@codspeed/vitest-plugin": "^4.0.0",
|
|
@@ -90,21 +90,21 @@
|
|
|
90
90
|
"dtsHeaderFile": "header.js"
|
|
91
91
|
},
|
|
92
92
|
"optionalDependencies": {
|
|
93
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.77.
|
|
94
|
-
"@oxc-parser/binding-win32-arm64-msvc": "0.77.
|
|
95
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.77.
|
|
96
|
-
"@oxc-parser/binding-linux-x64-musl": "0.77.
|
|
97
|
-
"@oxc-parser/binding-freebsd-x64": "0.77.
|
|
98
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.77.
|
|
99
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.77.
|
|
100
|
-
"@oxc-parser/binding-linux-arm-gnueabihf": "0.77.
|
|
101
|
-
"@oxc-parser/binding-linux-arm-musleabihf": "0.77.
|
|
102
|
-
"@oxc-parser/binding-linux-s390x-gnu": "0.77.
|
|
103
|
-
"@oxc-parser/binding-linux-riscv64-gnu": "0.77.
|
|
104
|
-
"@oxc-parser/binding-darwin-x64": "0.77.
|
|
105
|
-
"@oxc-parser/binding-darwin-arm64": "0.77.
|
|
106
|
-
"@oxc-parser/binding-android-arm64": "0.77.
|
|
107
|
-
"@oxc-parser/binding-wasm32-wasi": "0.77.
|
|
93
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.77.2",
|
|
94
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.77.2",
|
|
95
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.77.2",
|
|
96
|
+
"@oxc-parser/binding-linux-x64-musl": "0.77.2",
|
|
97
|
+
"@oxc-parser/binding-freebsd-x64": "0.77.2",
|
|
98
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.77.2",
|
|
99
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.77.2",
|
|
100
|
+
"@oxc-parser/binding-linux-arm-gnueabihf": "0.77.2",
|
|
101
|
+
"@oxc-parser/binding-linux-arm-musleabihf": "0.77.2",
|
|
102
|
+
"@oxc-parser/binding-linux-s390x-gnu": "0.77.2",
|
|
103
|
+
"@oxc-parser/binding-linux-riscv64-gnu": "0.77.2",
|
|
104
|
+
"@oxc-parser/binding-darwin-x64": "0.77.2",
|
|
105
|
+
"@oxc-parser/binding-darwin-arm64": "0.77.2",
|
|
106
|
+
"@oxc-parser/binding-android-arm64": "0.77.2",
|
|
107
|
+
"@oxc-parser/binding-wasm32-wasi": "0.77.2"
|
|
108
108
|
},
|
|
109
109
|
"scripts": {
|
|
110
110
|
"build-dev": "napi build --platform --js bindings.js",
|
package/raw-transfer/lazy.js
CHANGED
|
@@ -93,10 +93,10 @@ const bufferRecycleRegistry = typeof FinalizationRegistry === 'undefined'
|
|
|
93
93
|
* @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`,
|
|
94
94
|
* and `dispose` and `visit` methods
|
|
95
95
|
*/
|
|
96
|
-
function construct(buffer, sourceText,
|
|
96
|
+
function construct(buffer, sourceText, sourceByteLen) {
|
|
97
97
|
// Create AST object
|
|
98
|
-
const sourceIsAscii = sourceText.length ===
|
|
99
|
-
const ast = { buffer, sourceText,
|
|
98
|
+
const sourceIsAscii = sourceText.length === sourceByteLen;
|
|
99
|
+
const ast = { buffer, sourceText, sourceByteLen, sourceIsAscii, nodes: new Map(), token: TOKEN };
|
|
100
100
|
|
|
101
101
|
// Register `ast` with the recycle registry so buffer is returned to cache
|
|
102
102
|
// when `ast` is garbage collected
|