Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 1d7baf8

Browse files
committed
chore(compiler): rebuild wasm
1 parent 3c5c6a3 commit 1d7baf8

File tree

3 files changed

+175
-147
lines changed

3 files changed

+175
-147
lines changed

compiler/dist/wasm-checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const checksum = "15a66a1451c1d48258d7b4d125e91189efbc643a"
1+
export const checksum = "ab5e2a0a682ba6b1d5a68269b95c86eec6ed9ae3";

compiler/dist/wasm-pack.js

Lines changed: 172 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -5,213 +5,241 @@ const heap = new Array(32).fill(undefined);
55

66
heap.push(undefined, null, true, false);
77

8-
function getObject(idx) { return heap[idx]; }
8+
function getObject(idx) {
9+
return heap[idx];
10+
}
911

1012
let WASM_VECTOR_LEN = 0;
1113

1214
let cachegetUint8Memory0 = null;
1315
function getUint8Memory0() {
14-
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
15-
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
16-
}
17-
return cachegetUint8Memory0;
16+
if (
17+
cachegetUint8Memory0 === null ||
18+
cachegetUint8Memory0.buffer !== wasm.memory.buffer
19+
) {
20+
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
21+
}
22+
return cachegetUint8Memory0;
1823
}
1924

20-
let cachedTextEncoder = new TextEncoder('utf-8');
25+
let cachedTextEncoder = new TextEncoder("utf-8");
2126

22-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
27+
const encodeString =
28+
(typeof cachedTextEncoder.encodeInto === "function"
2329
? function (arg, view) {
24-
return cachedTextEncoder.encodeInto(arg, view);
25-
}
30+
return cachedTextEncoder.encodeInto(arg, view);
31+
}
2632
: function (arg, view) {
27-
const buf = cachedTextEncoder.encode(arg);
28-
view.set(buf);
29-
return {
33+
const buf = cachedTextEncoder.encode(arg);
34+
view.set(buf);
35+
return {
3036
read: arg.length,
31-
written: buf.length
32-
};
33-
});
37+
written: buf.length,
38+
};
39+
});
3440

3541
function passStringToWasm0(arg, malloc, realloc) {
42+
if (realloc === undefined) {
43+
const buf = cachedTextEncoder.encode(arg);
44+
const ptr = malloc(buf.length);
45+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
46+
WASM_VECTOR_LEN = buf.length;
47+
return ptr;
48+
}
3649

37-
if (realloc === undefined) {
38-
const buf = cachedTextEncoder.encode(arg);
39-
const ptr = malloc(buf.length);
40-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
41-
WASM_VECTOR_LEN = buf.length;
42-
return ptr;
43-
}
50+
let len = arg.length;
51+
let ptr = malloc(len);
4452

45-
let len = arg.length;
46-
let ptr = malloc(len);
53+
const mem = getUint8Memory0();
4754

48-
const mem = getUint8Memory0();
55+
let offset = 0;
4956

50-
let offset = 0;
57+
for (; offset < len; offset++) {
58+
const code = arg.charCodeAt(offset);
59+
if (code > 0x7F) break;
60+
mem[ptr + offset] = code;
61+
}
5162

52-
for (; offset < len; offset++) {
53-
const code = arg.charCodeAt(offset);
54-
if (code > 0x7F) break;
55-
mem[ptr + offset] = code;
63+
if (offset !== len) {
64+
if (offset !== 0) {
65+
arg = arg.slice(offset);
5666
}
67+
ptr = realloc(ptr, len, len = offset + arg.length * 3);
68+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
69+
const ret = encodeString(arg, view);
5770

58-
if (offset !== len) {
59-
if (offset !== 0) {
60-
arg = arg.slice(offset);
61-
}
62-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
63-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
64-
const ret = encodeString(arg, view);
65-
66-
offset += ret.written;
67-
}
71+
offset += ret.written;
72+
}
6873

69-
WASM_VECTOR_LEN = offset;
70-
return ptr;
74+
WASM_VECTOR_LEN = offset;
75+
return ptr;
7176
}
7277

7378
let cachegetInt32Memory0 = null;
7479
function getInt32Memory0() {
75-
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
76-
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
77-
}
78-
return cachegetInt32Memory0;
80+
if (
81+
cachegetInt32Memory0 === null ||
82+
cachegetInt32Memory0.buffer !== wasm.memory.buffer
83+
) {
84+
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
85+
}
86+
return cachegetInt32Memory0;
7987
}
8088

8189
let heap_next = heap.length;
8290

8391
function dropObject(idx) {
84-
if (idx < 36) return;
85-
heap[idx] = heap_next;
86-
heap_next = idx;
92+
if (idx < 36) return;
93+
heap[idx] = heap_next;
94+
heap_next = idx;
8795
}
8896

8997
function takeObject(idx) {
90-
const ret = getObject(idx);
91-
dropObject(idx);
92-
return ret;
98+
const ret = getObject(idx);
99+
dropObject(idx);
100+
return ret;
93101
}
94102

95-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
103+
let cachedTextDecoder = new TextDecoder("utf-8", {
104+
ignoreBOM: true,
105+
fatal: true,
106+
});
96107

97108
cachedTextDecoder.decode();
98109

99110
function getStringFromWasm0(ptr, len) {
100-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
111+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
101112
}
102113

103114
function addHeapObject(obj) {
104-
if (heap_next === heap.length) heap.push(heap.length + 1);
105-
const idx = heap_next;
106-
heap_next = heap[idx];
115+
if (heap_next === heap.length) heap.push(heap.length + 1);
116+
const idx = heap_next;
117+
heap_next = heap[idx];
107118

108-
heap[idx] = obj;
109-
return idx;
119+
heap[idx] = obj;
120+
return idx;
110121
}
111122
/**
112-
* @param {string} s
113-
* @param {any} opts
123+
* @param {string} url
124+
* @param {string} code
125+
* @param {any} options
114126
* @returns {any}
115127
*/
116-
export function transformSync(s, opts) {
117-
var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
118-
var len0 = WASM_VECTOR_LEN;
119-
var ret = wasm.transformSync(ptr0, len0, addHeapObject(opts));
120-
return takeObject(ret);
128+
export function transformSync(url, code, options) {
129+
var ptr0 = passStringToWasm0(
130+
url,
131+
wasm.__wbindgen_malloc,
132+
wasm.__wbindgen_realloc,
133+
);
134+
var len0 = WASM_VECTOR_LEN;
135+
var ptr1 = passStringToWasm0(
136+
code,
137+
wasm.__wbindgen_malloc,
138+
wasm.__wbindgen_realloc,
139+
);
140+
var len1 = WASM_VECTOR_LEN;
141+
var ret = wasm.transformSync(ptr0, len0, ptr1, len1, addHeapObject(options));
142+
return takeObject(ret);
121143
}
122144

123145
async function load(module, imports) {
124-
if (typeof Response === 'function' && module instanceof Response) {
125-
126-
if (typeof WebAssembly.instantiateStreaming === 'function') {
127-
try {
128-
return await WebAssembly.instantiateStreaming(module, imports);
129-
130-
} catch (e) {
131-
if (module.headers.get('Content-Type') != 'application/wasm') {
132-
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
133-
134-
} else {
135-
throw e;
136-
}
137-
}
146+
if (typeof Response === "function" && module instanceof Response) {
147+
if (typeof WebAssembly.instantiateStreaming === "function") {
148+
try {
149+
return await WebAssembly.instantiateStreaming(module, imports);
150+
} catch (e) {
151+
if (module.headers.get("Content-Type") != "application/wasm") {
152+
console.warn(
153+
"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",
154+
e,
155+
);
156+
} else {
157+
throw e;
138158
}
159+
}
160+
}
139161

140-
const bytes = await module.arrayBuffer();
141-
return await WebAssembly.instantiate(bytes, imports);
162+
const bytes = await module.arrayBuffer();
163+
return await WebAssembly.instantiate(bytes, imports);
164+
} else {
165+
const instance = await WebAssembly.instantiate(module, imports);
142166

167+
if (instance instanceof WebAssembly.Instance) {
168+
return { instance, module };
143169
} else {
144-
145-
const instance = await WebAssembly.instantiate(module, imports);
146-
147-
if (instance instanceof WebAssembly.Instance) {
148-
return { instance, module };
149-
150-
} else {
151-
return instance;
152-
}
170+
return instance;
153171
}
172+
}
154173
}
155174

156175
async function init(input) {
157-
if (typeof input === 'undefined') {
158-
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
176+
if (typeof input === "undefined") {
177+
input = import.meta.url.replace(/\.js$/, "_bg.wasm");
178+
}
179+
const imports = {};
180+
imports.wbg = {};
181+
imports.wbg.__wbindgen_json_serialize = function (arg0, arg1) {
182+
const obj = getObject(arg1);
183+
var ret = JSON.stringify(obj === undefined ? null : obj);
184+
var ptr0 = passStringToWasm0(
185+
ret,
186+
wasm.__wbindgen_malloc,
187+
wasm.__wbindgen_realloc,
188+
);
189+
var len0 = WASM_VECTOR_LEN;
190+
getInt32Memory0()[arg0 / 4 + 1] = len0;
191+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
192+
};
193+
imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
194+
takeObject(arg0);
195+
};
196+
imports.wbg.__wbindgen_json_parse = function (arg0, arg1) {
197+
var ret = JSON.parse(getStringFromWasm0(arg0, arg1));
198+
return addHeapObject(ret);
199+
};
200+
imports.wbg.__wbg_new_59cb74e423758ede = function () {
201+
var ret = new Error();
202+
return addHeapObject(ret);
203+
};
204+
imports.wbg.__wbg_stack_558ba5917b466edd = function (arg0, arg1) {
205+
var ret = getObject(arg1).stack;
206+
var ptr0 = passStringToWasm0(
207+
ret,
208+
wasm.__wbindgen_malloc,
209+
wasm.__wbindgen_realloc,
210+
);
211+
var len0 = WASM_VECTOR_LEN;
212+
getInt32Memory0()[arg0 / 4 + 1] = len0;
213+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
214+
};
215+
imports.wbg.__wbg_error_4bb6c2a97407129a = function (arg0, arg1) {
216+
try {
217+
const msg = getStringFromWasm0(arg0, arg1);
218+
if (msg.includes('DiagnosticBuffer(["')) {
219+
const diagnostic = msg.split('DiagnosticBuffer(["')[1].split('"])')[0];
220+
log.error("swc:", diagnostic);
221+
} else {
222+
log.error(msg);
223+
}
224+
} finally {
225+
wasm.__wbindgen_free(arg0, arg1);
159226
}
160-
const imports = {};
161-
imports.wbg = {};
162-
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
163-
const obj = getObject(arg1);
164-
var ret = JSON.stringify(obj === undefined ? null : obj);
165-
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
166-
var len0 = WASM_VECTOR_LEN;
167-
getInt32Memory0()[arg0 / 4 + 1] = len0;
168-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
169-
};
170-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
171-
takeObject(arg0);
172-
};
173-
imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
174-
var ret = JSON.parse(getStringFromWasm0(arg0, arg1));
175-
return addHeapObject(ret);
176-
};
177-
imports.wbg.__wbg_new_59cb74e423758ede = function() {
178-
var ret = new Error();
179-
return addHeapObject(ret);
180-
};
181-
imports.wbg.__wbg_stack_558ba5917b466edd = function(arg0, arg1) {
182-
var ret = getObject(arg1).stack;
183-
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
184-
var len0 = WASM_VECTOR_LEN;
185-
getInt32Memory0()[arg0 / 4 + 1] = len0;
186-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
187-
};
188-
imports.wbg.__wbg_error_4bb6c2a97407129a = function(arg0, arg1) {
189-
try {
190-
191-
const msg = getStringFromWasm0(arg0, arg1);
192-
if (msg.includes("DiagnosticBuffer")) {
193-
const diagnostic = msg.split('DiagnosticBuffer(["')[1].split('"])')[0]
194-
log.error("swc:", diagnostic)
195-
} else {
196-
log.error(msg)
197-
}
198-
199-
} finally {
200-
wasm.__wbindgen_free(arg0, arg1);
201-
}
202-
};
227+
};
203228

204-
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
205-
input = fetch(input);
206-
}
229+
if (
230+
typeof input === "string" ||
231+
(typeof Request === "function" && input instanceof Request) ||
232+
(typeof URL === "function" && input instanceof URL)
233+
) {
234+
input = fetch(input);
235+
}
207236

208-
const { instance, module } = await load(await input, imports);
237+
const { instance, module } = await load(await input, imports);
209238

210-
wasm = instance.exports;
211-
init.__wbindgen_wasm_module = module;
239+
wasm = instance.exports;
240+
init.__wbindgen_wasm_module = module;
212241

213-
return wasm;
242+
return wasm;
214243
}
215244

216245
export default init;
217-

compiler/dist/wasm.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)