@lynx-js/web-mainthread-apis-canary 0.18.4-canary-20251120-e2c78043 → 0.18.4
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/CHANGELOG.md +11 -12
- package/binary/debug.d.ts +4 -0
- package/binary/debug.js +5 -0
- package/binary/debug_bg.js +150 -0
- package/binary/debug_bg.wasm +0 -0
- package/binary/debug_bg.wasm.d.ts +10 -0
- package/binary/legacy.d.ts +4 -0
- package/binary/legacy.js +4 -0
- package/binary/legacy_bg.js +188 -0
- package/binary/legacy_bg.wasm +0 -0
- package/binary/legacy_bg.wasm.d.ts +9 -0
- package/binary/standard.d.ts +4 -0
- package/binary/standard.js +5 -0
- package/binary/standard_bg.js +150 -0
- package/binary/standard_bg.wasm +0 -0
- package/binary/standard_bg.wasm.d.ts +10 -0
- package/dist/prepareMainThreadAPIs.js +0 -3
- package/dist/utils/tokenizer.js +1 -1
- package/package.json +13 -4
- package/wasm/index.d.ts +3 -0
- package/wasm/index.js +23 -0
- package/wasm/legacy.js +1 -0
- package/wasm/standard.d.ts +9 -0
- package/wasm/standard.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# @lynx-js/web-mainthread-apis
|
|
2
2
|
|
|
3
|
-
## 0.18.4
|
|
3
|
+
## 0.18.4
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Updated dependencies []:
|
|
8
|
-
- @lynx-js/web-constants@0.18.4
|
|
9
|
-
- @lynx-js/web-style-transformer@0.18.4-canary-20251120164658-e2c780434772d9abd8f92c67ce87e3935f495429
|
|
8
|
+
- @lynx-js/web-constants@0.18.4
|
|
10
9
|
|
|
11
10
|
## 0.18.3
|
|
12
11
|
|
|
@@ -304,25 +303,25 @@
|
|
|
304
303
|
lynxView.initI18nResources = [
|
|
305
304
|
{
|
|
306
305
|
options: {
|
|
307
|
-
locale:
|
|
308
|
-
channel:
|
|
309
|
-
fallback_url:
|
|
306
|
+
locale: 'en',
|
|
307
|
+
channel: '1',
|
|
308
|
+
fallback_url: '',
|
|
310
309
|
},
|
|
311
310
|
resource: {
|
|
312
|
-
hello:
|
|
313
|
-
lynx:
|
|
311
|
+
hello: 'hello',
|
|
312
|
+
lynx: 'lynx web platform1',
|
|
314
313
|
},
|
|
315
314
|
},
|
|
316
315
|
];
|
|
317
|
-
lynxView.addEventListener(
|
|
316
|
+
lynxView.addEventListener('i18nResourceMissed', (e) => {
|
|
318
317
|
console.log(e);
|
|
319
318
|
});
|
|
320
319
|
|
|
321
320
|
// mts
|
|
322
321
|
_I18nResourceTranslation({
|
|
323
|
-
locale:
|
|
324
|
-
channel:
|
|
325
|
-
fallback_url:
|
|
322
|
+
locale: 'en',
|
|
323
|
+
channel: '1',
|
|
324
|
+
fallback_url: '',
|
|
326
325
|
});
|
|
327
326
|
```
|
|
328
327
|
|
package/binary/debug.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
8
|
+
|
|
9
|
+
function getUint8ArrayMemory0() {
|
|
10
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
11
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8ArrayMemory0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
17
|
+
|
|
18
|
+
cachedTextDecoder.decode();
|
|
19
|
+
|
|
20
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
21
|
+
let numBytesDecoded = 0;
|
|
22
|
+
function decodeText(ptr, len) {
|
|
23
|
+
numBytesDecoded += len;
|
|
24
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
25
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
26
|
+
cachedTextDecoder.decode();
|
|
27
|
+
numBytesDecoded = len;
|
|
28
|
+
}
|
|
29
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getStringFromWasm0(ptr, len) {
|
|
33
|
+
ptr = ptr >>> 0;
|
|
34
|
+
return decodeText(ptr, len);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let WASM_VECTOR_LEN = 0;
|
|
38
|
+
|
|
39
|
+
const cachedTextEncoder = new TextEncoder();
|
|
40
|
+
|
|
41
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
42
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
43
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
44
|
+
view.set(buf);
|
|
45
|
+
return {
|
|
46
|
+
read: arg.length,
|
|
47
|
+
written: buf.length
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
53
|
+
|
|
54
|
+
if (realloc === undefined) {
|
|
55
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
56
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
57
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
58
|
+
WASM_VECTOR_LEN = buf.length;
|
|
59
|
+
return ptr;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let len = arg.length;
|
|
63
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
64
|
+
|
|
65
|
+
const mem = getUint8ArrayMemory0();
|
|
66
|
+
|
|
67
|
+
let offset = 0;
|
|
68
|
+
|
|
69
|
+
for (; offset < len; offset++) {
|
|
70
|
+
const code = arg.charCodeAt(offset);
|
|
71
|
+
if (code > 0x7F) break;
|
|
72
|
+
mem[ptr + offset] = code;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (offset !== len) {
|
|
76
|
+
if (offset !== 0) {
|
|
77
|
+
arg = arg.slice(offset);
|
|
78
|
+
}
|
|
79
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
80
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
81
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
82
|
+
|
|
83
|
+
offset += ret.written;
|
|
84
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
WASM_VECTOR_LEN = offset;
|
|
88
|
+
return ptr;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} str
|
|
92
|
+
* @returns {string | undefined}
|
|
93
|
+
*/
|
|
94
|
+
export function transform_raw_u16_inline_style_ptr(str) {
|
|
95
|
+
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
96
|
+
const len0 = WASM_VECTOR_LEN;
|
|
97
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr(ptr0, len0);
|
|
98
|
+
let v2;
|
|
99
|
+
if (ret[0] !== 0) {
|
|
100
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
101
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
102
|
+
}
|
|
103
|
+
return v2;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @param {string} name
|
|
108
|
+
* @param {string} value
|
|
109
|
+
* @returns {Array<any> | undefined}
|
|
110
|
+
*/
|
|
111
|
+
export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
|
|
112
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
113
|
+
const len0 = WASM_VECTOR_LEN;
|
|
114
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
115
|
+
const len1 = WASM_VECTOR_LEN;
|
|
116
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
|
|
117
|
+
return ret;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
|
|
121
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export function __wbg_new_e17d9f43105b08be() {
|
|
125
|
+
const ret = new Array();
|
|
126
|
+
return ret;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export function __wbg_push_df81a39d04db858c(arg0, arg1) {
|
|
130
|
+
const ret = arg0.push(arg1);
|
|
131
|
+
return ret;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
135
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
136
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
137
|
+
return ret;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export function __wbindgen_init_externref_table() {
|
|
141
|
+
const table = wasm.__wbindgen_externrefs;
|
|
142
|
+
const offset = table.grow(4);
|
|
143
|
+
table.set(0, undefined);
|
|
144
|
+
table.set(offset + 0, undefined);
|
|
145
|
+
table.set(offset + 1, null);
|
|
146
|
+
table.set(offset + 2, true);
|
|
147
|
+
table.set(offset + 3, false);
|
|
148
|
+
;
|
|
149
|
+
};
|
|
150
|
+
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const transform_raw_u16_inline_style_ptr: (a: number, b: number) => [number, number];
|
|
5
|
+
export const transform_raw_u16_inline_style_ptr_parsed: (a: number, b: number, c: number, d: number) => any;
|
|
6
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
7
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
8
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
9
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
10
|
+
export const __wbindgen_start: () => void;
|
package/binary/legacy.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
8
|
+
|
|
9
|
+
function getUint8ArrayMemory0() {
|
|
10
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
11
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8ArrayMemory0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
17
|
+
|
|
18
|
+
cachedTextDecoder.decode();
|
|
19
|
+
|
|
20
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
21
|
+
let numBytesDecoded = 0;
|
|
22
|
+
function decodeText(ptr, len) {
|
|
23
|
+
numBytesDecoded += len;
|
|
24
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
25
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
26
|
+
cachedTextDecoder.decode();
|
|
27
|
+
numBytesDecoded = len;
|
|
28
|
+
}
|
|
29
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getStringFromWasm0(ptr, len) {
|
|
33
|
+
ptr = ptr >>> 0;
|
|
34
|
+
return decodeText(ptr, len);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let heap = new Array(128).fill(undefined);
|
|
38
|
+
|
|
39
|
+
heap.push(undefined, null, true, false);
|
|
40
|
+
|
|
41
|
+
let heap_next = heap.length;
|
|
42
|
+
|
|
43
|
+
function addHeapObject(obj) {
|
|
44
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
45
|
+
const idx = heap_next;
|
|
46
|
+
heap_next = heap[idx];
|
|
47
|
+
|
|
48
|
+
heap[idx] = obj;
|
|
49
|
+
return idx;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getObject(idx) { return heap[idx]; }
|
|
53
|
+
|
|
54
|
+
function dropObject(idx) {
|
|
55
|
+
if (idx < 132) return;
|
|
56
|
+
heap[idx] = heap_next;
|
|
57
|
+
heap_next = idx;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function takeObject(idx) {
|
|
61
|
+
const ret = getObject(idx);
|
|
62
|
+
dropObject(idx);
|
|
63
|
+
return ret;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let WASM_VECTOR_LEN = 0;
|
|
67
|
+
|
|
68
|
+
const cachedTextEncoder = new TextEncoder();
|
|
69
|
+
|
|
70
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
71
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
72
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
73
|
+
view.set(buf);
|
|
74
|
+
return {
|
|
75
|
+
read: arg.length,
|
|
76
|
+
written: buf.length
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
82
|
+
|
|
83
|
+
if (realloc === undefined) {
|
|
84
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
85
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
86
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
87
|
+
WASM_VECTOR_LEN = buf.length;
|
|
88
|
+
return ptr;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let len = arg.length;
|
|
92
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
93
|
+
|
|
94
|
+
const mem = getUint8ArrayMemory0();
|
|
95
|
+
|
|
96
|
+
let offset = 0;
|
|
97
|
+
|
|
98
|
+
for (; offset < len; offset++) {
|
|
99
|
+
const code = arg.charCodeAt(offset);
|
|
100
|
+
if (code > 0x7F) break;
|
|
101
|
+
mem[ptr + offset] = code;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (offset !== len) {
|
|
105
|
+
if (offset !== 0) {
|
|
106
|
+
arg = arg.slice(offset);
|
|
107
|
+
}
|
|
108
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
109
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
110
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
111
|
+
|
|
112
|
+
offset += ret.written;
|
|
113
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
WASM_VECTOR_LEN = offset;
|
|
117
|
+
return ptr;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let cachedDataViewMemory0 = null;
|
|
121
|
+
|
|
122
|
+
function getDataViewMemory0() {
|
|
123
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
124
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
125
|
+
}
|
|
126
|
+
return cachedDataViewMemory0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @param {string} str
|
|
130
|
+
* @returns {string | undefined}
|
|
131
|
+
*/
|
|
132
|
+
export function transform_raw_u16_inline_style_ptr(str) {
|
|
133
|
+
try {
|
|
134
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
135
|
+
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
136
|
+
const len0 = WASM_VECTOR_LEN;
|
|
137
|
+
wasm.transform_raw_u16_inline_style_ptr(retptr, ptr0, len0);
|
|
138
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
139
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140
|
+
let v2;
|
|
141
|
+
if (r0 !== 0) {
|
|
142
|
+
v2 = getStringFromWasm0(r0, r1).slice();
|
|
143
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
144
|
+
}
|
|
145
|
+
return v2;
|
|
146
|
+
} finally {
|
|
147
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {string} name
|
|
153
|
+
* @param {string} value
|
|
154
|
+
* @returns {Array<any> | undefined}
|
|
155
|
+
*/
|
|
156
|
+
export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
|
|
157
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
158
|
+
const len0 = WASM_VECTOR_LEN;
|
|
159
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
160
|
+
const len1 = WASM_VECTOR_LEN;
|
|
161
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
|
|
162
|
+
return takeObject(ret);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
|
|
166
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export function __wbg_new_e17d9f43105b08be() {
|
|
170
|
+
const ret = new Array();
|
|
171
|
+
return addHeapObject(ret);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export function __wbg_push_df81a39d04db858c(arg0, arg1) {
|
|
175
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
176
|
+
return ret;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
180
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
181
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
182
|
+
return addHeapObject(ret);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
186
|
+
takeObject(arg0);
|
|
187
|
+
};
|
|
188
|
+
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const transform_raw_u16_inline_style_ptr: (a: number, b: number, c: number) => void;
|
|
5
|
+
export const transform_raw_u16_inline_style_ptr_parsed: (a: number, b: number, c: number, d: number) => number;
|
|
6
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
7
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
8
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
9
|
+
export const __wbindgen_export3: (a: number, b: number, c: number) => void;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
8
|
+
|
|
9
|
+
function getUint8ArrayMemory0() {
|
|
10
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
11
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8ArrayMemory0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
17
|
+
|
|
18
|
+
cachedTextDecoder.decode();
|
|
19
|
+
|
|
20
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
21
|
+
let numBytesDecoded = 0;
|
|
22
|
+
function decodeText(ptr, len) {
|
|
23
|
+
numBytesDecoded += len;
|
|
24
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
25
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
26
|
+
cachedTextDecoder.decode();
|
|
27
|
+
numBytesDecoded = len;
|
|
28
|
+
}
|
|
29
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getStringFromWasm0(ptr, len) {
|
|
33
|
+
ptr = ptr >>> 0;
|
|
34
|
+
return decodeText(ptr, len);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let WASM_VECTOR_LEN = 0;
|
|
38
|
+
|
|
39
|
+
const cachedTextEncoder = new TextEncoder();
|
|
40
|
+
|
|
41
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
42
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
43
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
44
|
+
view.set(buf);
|
|
45
|
+
return {
|
|
46
|
+
read: arg.length,
|
|
47
|
+
written: buf.length
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
53
|
+
|
|
54
|
+
if (realloc === undefined) {
|
|
55
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
56
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
57
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
58
|
+
WASM_VECTOR_LEN = buf.length;
|
|
59
|
+
return ptr;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let len = arg.length;
|
|
63
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
64
|
+
|
|
65
|
+
const mem = getUint8ArrayMemory0();
|
|
66
|
+
|
|
67
|
+
let offset = 0;
|
|
68
|
+
|
|
69
|
+
for (; offset < len; offset++) {
|
|
70
|
+
const code = arg.charCodeAt(offset);
|
|
71
|
+
if (code > 0x7F) break;
|
|
72
|
+
mem[ptr + offset] = code;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (offset !== len) {
|
|
76
|
+
if (offset !== 0) {
|
|
77
|
+
arg = arg.slice(offset);
|
|
78
|
+
}
|
|
79
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
80
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
81
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
82
|
+
|
|
83
|
+
offset += ret.written;
|
|
84
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
WASM_VECTOR_LEN = offset;
|
|
88
|
+
return ptr;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} str
|
|
92
|
+
* @returns {string | undefined}
|
|
93
|
+
*/
|
|
94
|
+
export function transform_raw_u16_inline_style_ptr(str) {
|
|
95
|
+
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
96
|
+
const len0 = WASM_VECTOR_LEN;
|
|
97
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr(ptr0, len0);
|
|
98
|
+
let v2;
|
|
99
|
+
if (ret[0] !== 0) {
|
|
100
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
101
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
102
|
+
}
|
|
103
|
+
return v2;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @param {string} name
|
|
108
|
+
* @param {string} value
|
|
109
|
+
* @returns {Array<any> | undefined}
|
|
110
|
+
*/
|
|
111
|
+
export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
|
|
112
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
113
|
+
const len0 = WASM_VECTOR_LEN;
|
|
114
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
115
|
+
const len1 = WASM_VECTOR_LEN;
|
|
116
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
|
|
117
|
+
return ret;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
|
|
121
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export function __wbg_new_e17d9f43105b08be() {
|
|
125
|
+
const ret = new Array();
|
|
126
|
+
return ret;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export function __wbg_push_df81a39d04db858c(arg0, arg1) {
|
|
130
|
+
const ret = arg0.push(arg1);
|
|
131
|
+
return ret;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
135
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
136
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
137
|
+
return ret;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export function __wbindgen_init_externref_table() {
|
|
141
|
+
const table = wasm.__wbindgen_externrefs;
|
|
142
|
+
const offset = table.grow(4);
|
|
143
|
+
table.set(0, undefined);
|
|
144
|
+
table.set(offset + 0, undefined);
|
|
145
|
+
table.set(offset + 1, null);
|
|
146
|
+
table.set(offset + 2, true);
|
|
147
|
+
table.set(offset + 3, false);
|
|
148
|
+
;
|
|
149
|
+
};
|
|
150
|
+
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const transform_raw_u16_inline_style_ptr: (a: number, b: number) => [number, number];
|
|
5
|
+
export const transform_raw_u16_inline_style_ptr_parsed: (a: number, b: number, c: number, d: number) => any;
|
|
6
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
7
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
8
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
9
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
10
|
+
export const __wbindgen_start: () => void;
|
|
@@ -6,10 +6,8 @@ import { registerCallLepusMethodHandler } from './crossThreadHandlers/registerCa
|
|
|
6
6
|
import { registerGetCustomSectionHandler } from './crossThreadHandlers/registerGetCustomSectionHandler.js';
|
|
7
7
|
import { createMainThreadGlobalThis } from './createMainThreadGlobalThis.js';
|
|
8
8
|
import { createExposureService } from './utils/createExposureService.js';
|
|
9
|
-
import { initWasm } from '@lynx-js/web-style-transformer';
|
|
10
9
|
import { appendStyleElement } from './utils/processStyleInfo.js';
|
|
11
10
|
import { createQueryComponent } from './crossThreadHandlers/createQueryComponent.js';
|
|
12
|
-
const initWasmPromise = initWasm();
|
|
13
11
|
export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealmPromise, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, loadTemplate, ssrHooks) {
|
|
14
12
|
const postTimingFlags = backgroundThreadRpc.createCall(postTimingFlagsEndpoint);
|
|
15
13
|
const backgroundStart = backgroundThreadRpc.createCall(BackgroundThreadStartEndpoint);
|
|
@@ -25,7 +23,6 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mt
|
|
|
25
23
|
const { styleInfo, pageConfig, customSections, cardType, } = template;
|
|
26
24
|
const mtsRealm = await mtsRealmPromise;
|
|
27
25
|
markTimingInternal('decode_start');
|
|
28
|
-
await initWasmPromise;
|
|
29
26
|
const jsContext = new LynxCrossThreadContext({
|
|
30
27
|
rpc: backgroundThreadRpc,
|
|
31
28
|
receiveEventEndpoint: dispatchJSContextOnMainThreadEndpoint,
|
package/dist/utils/tokenizer.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-mainthread-apis-canary",
|
|
3
|
-
"version": "0.18.4
|
|
3
|
+
"version": "0.18.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"binary",
|
|
19
|
+
"wasm",
|
|
19
20
|
"!dist/**/*.js.map",
|
|
21
|
+
"!binary/**/*.js.map",
|
|
20
22
|
"LICENSE.txt",
|
|
21
23
|
"Notice.txt",
|
|
22
24
|
"CHANGELOG.md",
|
|
@@ -24,8 +26,15 @@
|
|
|
24
26
|
"**/*.css"
|
|
25
27
|
],
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.18.4
|
|
28
|
-
"
|
|
29
|
-
"
|
|
29
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.18.4",
|
|
30
|
+
"hyphenate-style-name": "^1.1.0",
|
|
31
|
+
"wasm-feature-detect": "^1.8.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"binaryen": "^125.0.0",
|
|
35
|
+
"fb-dotslash": "^0.5.8"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "node scripts/build.js"
|
|
30
39
|
}
|
|
31
40
|
}
|
package/wasm/index.d.ts
ADDED
package/wasm/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { referenceTypes } from 'wasm-feature-detect';
|
|
2
|
+
export let wasm;
|
|
3
|
+
export async function initWasm() {
|
|
4
|
+
const supportsReferenceTypes = await referenceTypes();
|
|
5
|
+
if (supportsReferenceTypes) {
|
|
6
|
+
wasm = await import(
|
|
7
|
+
/* webpackMode: "eager" */
|
|
8
|
+
/* webpackFetchPriority: "high" */
|
|
9
|
+
/* webpackChunkName: "standard-wasm-chunk" */
|
|
10
|
+
/* webpackPrefetch: true */
|
|
11
|
+
/* webpackPreload: true */
|
|
12
|
+
'./standard.js'
|
|
13
|
+
);
|
|
14
|
+
} else {
|
|
15
|
+
wasm = await import(
|
|
16
|
+
/* webpackMode: "lazy" */
|
|
17
|
+
/* webpackChunkName: "legacy-wasm-chunk" */
|
|
18
|
+
/* webpackPrefetch: false */
|
|
19
|
+
'./legacy.js'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
await initWasm();
|
package/wasm/legacy.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../binary/legacy.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export function transform_raw_u16_inline_style_ptr(
|
|
4
|
+
str: string,
|
|
5
|
+
): string | undefined;
|
|
6
|
+
export function transform_raw_u16_inline_style_ptr_parsed(
|
|
7
|
+
name: string,
|
|
8
|
+
value: string,
|
|
9
|
+
): [[string, string][], [string, string][]] | undefined;
|
package/wasm/standard.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../binary/standard.js';
|