yuku-codegen 0.5.28 → 0.5.29
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/encode.js +28 -14
- package/package.json +13 -13
package/encode.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// generated by tools/gen_estree_encoder.zig, do not edit
|
|
2
2
|
const NULL = 0xFFFFFFFF;
|
|
3
|
-
const _enc = new TextEncoder();
|
|
4
3
|
const NODE_SIZE = 48;
|
|
5
4
|
const HEADER_SIZE = 44;
|
|
6
5
|
const NODE_FLAGS_OFFSET = 2;
|
|
@@ -125,21 +124,35 @@ function encode(program, lineStarts) {
|
|
|
125
124
|
}
|
|
126
125
|
const start = poolLen;
|
|
127
126
|
let p = start;
|
|
128
|
-
let
|
|
129
|
-
for (
|
|
127
|
+
let i = 0;
|
|
128
|
+
for (; i < n; i++) {
|
|
130
129
|
const c = s.charCodeAt(i);
|
|
131
|
-
if (c
|
|
130
|
+
if (c >= 0x80) break;
|
|
131
|
+
pool[p++] = c;
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
// wtf-8 tail: keep lone surrogates as ED A0..BF rather than U+FFFD
|
|
134
|
+
for (; i < n; i++) {
|
|
135
|
+
let c = s.charCodeAt(i);
|
|
136
|
+
if (c < 0x80) {
|
|
137
|
+
pool[p++] = c;
|
|
138
|
+
} else if (c < 0x800) {
|
|
139
|
+
pool[p++] = 0xC0 | (c >> 6);
|
|
140
|
+
pool[p++] = 0x80 | (c & 0x3F);
|
|
141
|
+
} else if (c >= 0xD800 && c <= 0xDBFF && i + 1 < n &&
|
|
142
|
+
s.charCodeAt(i + 1) >= 0xDC00 && s.charCodeAt(i + 1) <= 0xDFFF) {
|
|
143
|
+
c = 0x10000 + ((c - 0xD800) << 10) + (s.charCodeAt(++i) - 0xDC00);
|
|
144
|
+
pool[p++] = 0xF0 | (c >> 18);
|
|
145
|
+
pool[p++] = 0x80 | ((c >> 12) & 0x3F);
|
|
146
|
+
pool[p++] = 0x80 | ((c >> 6) & 0x3F);
|
|
147
|
+
pool[p++] = 0x80 | (c & 0x3F);
|
|
148
|
+
} else {
|
|
149
|
+
pool[p++] = 0xE0 | (c >> 12);
|
|
150
|
+
pool[p++] = 0x80 | ((c >> 6) & 0x3F);
|
|
151
|
+
pool[p++] = 0x80 | (c & 0x3F);
|
|
152
|
+
}
|
|
142
153
|
}
|
|
154
|
+
const r = { start, end: p };
|
|
155
|
+
poolLen = p;
|
|
143
156
|
strMap.set(s, r);
|
|
144
157
|
return r;
|
|
145
158
|
}
|
|
@@ -265,7 +278,6 @@ function encode(program, lineStarts) {
|
|
|
265
278
|
tagAt(idx, 7);
|
|
266
279
|
slotAt(idx, 0, pat);
|
|
267
280
|
spanAt(idx, asStart(p), asEnd(p));
|
|
268
|
-
recordComments(p, idx);
|
|
269
281
|
return idx;
|
|
270
282
|
}
|
|
271
283
|
function enc_binary_expression(n) {
|
|
@@ -675,10 +687,12 @@ function encode(program, lineStarts) {
|
|
|
675
687
|
const v = (n.value || {});
|
|
676
688
|
const undef = v.cooked == null;
|
|
677
689
|
const c = encStr(undef ? "" : v.cooked);
|
|
690
|
+
const r = encStr(v.raw);
|
|
678
691
|
const idx = alloc();
|
|
679
692
|
tagAt(idx, 41);
|
|
680
693
|
flagsAt(idx, (n.tail ? 1 : 0) | (undef ? 2 : 0));
|
|
681
694
|
slotAt(idx, 0, c.start); slotAt(idx, 1, c.end);
|
|
695
|
+
slotAt(idx, 2, r.start); slotAt(idx, 3, r.end);
|
|
682
696
|
spanAt(idx, asStart(n), asEnd(n));
|
|
683
697
|
recordComments(n, idx);
|
|
684
698
|
return idx;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yuku-codegen",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.29",
|
|
4
4
|
"description": "High-performance JavaScript/TypeScript code generator written in Zig",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"encode.js"
|
|
18
18
|
],
|
|
19
19
|
"optionalDependencies": {
|
|
20
|
-
"@yuku-codegen/binding-linux-x64-gnu": "0.5.
|
|
21
|
-
"@yuku-codegen/binding-linux-arm64-gnu": "0.5.
|
|
22
|
-
"@yuku-codegen/binding-linux-arm-gnu": "0.5.
|
|
23
|
-
"@yuku-codegen/binding-linux-x64-musl": "0.5.
|
|
24
|
-
"@yuku-codegen/binding-linux-arm64-musl": "0.5.
|
|
25
|
-
"@yuku-codegen/binding-linux-arm-musl": "0.5.
|
|
26
|
-
"@yuku-codegen/binding-darwin-x64": "0.5.
|
|
27
|
-
"@yuku-codegen/binding-darwin-arm64": "0.5.
|
|
28
|
-
"@yuku-codegen/binding-win32-x64": "0.5.
|
|
29
|
-
"@yuku-codegen/binding-win32-arm64": "0.5.
|
|
30
|
-
"@yuku-codegen/binding-freebsd-x64": "0.5.
|
|
20
|
+
"@yuku-codegen/binding-linux-x64-gnu": "0.5.29",
|
|
21
|
+
"@yuku-codegen/binding-linux-arm64-gnu": "0.5.29",
|
|
22
|
+
"@yuku-codegen/binding-linux-arm-gnu": "0.5.29",
|
|
23
|
+
"@yuku-codegen/binding-linux-x64-musl": "0.5.29",
|
|
24
|
+
"@yuku-codegen/binding-linux-arm64-musl": "0.5.29",
|
|
25
|
+
"@yuku-codegen/binding-linux-arm-musl": "0.5.29",
|
|
26
|
+
"@yuku-codegen/binding-darwin-x64": "0.5.29",
|
|
27
|
+
"@yuku-codegen/binding-darwin-arm64": "0.5.29",
|
|
28
|
+
"@yuku-codegen/binding-win32-x64": "0.5.29",
|
|
29
|
+
"@yuku-codegen/binding-win32-arm64": "0.5.29",
|
|
30
|
+
"@yuku-codegen/binding-freebsd-x64": "0.5.29"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"ast",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"typescript"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"yuku-parser": "0.5.
|
|
43
|
+
"yuku-parser": "0.5.28"
|
|
44
44
|
}
|
|
45
45
|
}
|