@next/swc-wasm-web 12.2.4-canary.7 → 12.2.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/package.json +1 -1
- package/wasm.d.ts +38 -4
- package/wasm.js +212 -53
- package/wasm_bg.wasm +0 -0
package/package.json
CHANGED
package/wasm.d.ts
CHANGED
|
@@ -9,29 +9,63 @@ export function minifySync(s: string, opts: any): any;
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {string} s
|
|
11
11
|
* @param {any} opts
|
|
12
|
+
* @returns {Promise<any>}
|
|
13
|
+
*/
|
|
14
|
+
export function minify(s: string, opts: any): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* @param {any} s
|
|
17
|
+
* @param {any} opts
|
|
12
18
|
* @returns {any}
|
|
13
19
|
*/
|
|
14
|
-
export function transformSync(s:
|
|
20
|
+
export function transformSync(s: any, opts: any): any;
|
|
21
|
+
/**
|
|
22
|
+
* @param {any} s
|
|
23
|
+
* @param {any} opts
|
|
24
|
+
* @returns {Promise<any>}
|
|
25
|
+
*/
|
|
26
|
+
export function transform(s: any, opts: any): Promise<any>;
|
|
15
27
|
/**
|
|
16
28
|
* @param {string} s
|
|
17
29
|
* @param {any} opts
|
|
18
30
|
* @returns {any}
|
|
19
31
|
*/
|
|
20
32
|
export function parseSync(s: string, opts: any): any;
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} s
|
|
35
|
+
* @param {any} opts
|
|
36
|
+
* @returns {Promise<any>}
|
|
37
|
+
*/
|
|
38
|
+
export function parse(s: string, opts: any): Promise<any>;
|
|
21
39
|
|
|
22
40
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
23
41
|
|
|
24
42
|
export interface InitOutput {
|
|
25
43
|
readonly memory: WebAssembly.Memory;
|
|
26
|
-
readonly minifySync: (a: number, b: number, c: number
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
44
|
+
readonly minifySync: (a: number, b: number, c: number) => void;
|
|
45
|
+
readonly minify: (a: number, b: number) => number;
|
|
46
|
+
readonly transformSync: (a: number, b: number, c: number) => void;
|
|
47
|
+
readonly transform: (a: number, b: number) => number;
|
|
48
|
+
readonly parseSync: (a: number, b: number, c: number) => void;
|
|
49
|
+
readonly parse: (a: number, b: number) => number;
|
|
29
50
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
30
51
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
52
|
+
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
53
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h61642589700c528b: (a: number, b: number, c: number) => void;
|
|
31
54
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
|
55
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
56
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h7f50d477bd18f33c: (a: number, b: number, c: number, d: number) => void;
|
|
32
57
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
33
58
|
}
|
|
34
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Synchronously compiles the given `bytes` and instantiates the WebAssembly module.
|
|
62
|
+
*
|
|
63
|
+
* @param {BufferSource} bytes
|
|
64
|
+
*
|
|
65
|
+
* @returns {InitOutput}
|
|
66
|
+
*/
|
|
67
|
+
export function initSync(bytes: BufferSource): InitOutput;
|
|
68
|
+
|
|
35
69
|
/**
|
|
36
70
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
37
71
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
package/wasm.js
CHANGED
|
@@ -25,12 +25,13 @@ const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: tru
|
|
|
25
25
|
|
|
26
26
|
cachedTextDecoder.decode();
|
|
27
27
|
|
|
28
|
-
let
|
|
28
|
+
let cachedUint8Memory0 = new Uint8Array();
|
|
29
|
+
|
|
29
30
|
function getUint8Memory0() {
|
|
30
|
-
if (
|
|
31
|
-
|
|
31
|
+
if (cachedUint8Memory0.byteLength === 0) {
|
|
32
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
32
33
|
}
|
|
33
|
-
return
|
|
34
|
+
return cachedUint8Memory0;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
function getStringFromWasm0(ptr, len) {
|
|
@@ -101,13 +102,66 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
101
102
|
return ptr;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
let
|
|
105
|
+
let cachedInt32Memory0 = new Int32Array();
|
|
106
|
+
|
|
105
107
|
function getInt32Memory0() {
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
+
if (cachedInt32Memory0.byteLength === 0) {
|
|
109
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
110
|
+
}
|
|
111
|
+
return cachedInt32Memory0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function isLikeNone(x) {
|
|
115
|
+
return x === undefined || x === null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
119
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
120
|
+
const real = (...args) => {
|
|
121
|
+
// First up with a closure we increment the internal reference
|
|
122
|
+
// count. This ensures that the Rust closure environment won't
|
|
123
|
+
// be deallocated while we're invoking it.
|
|
124
|
+
state.cnt++;
|
|
125
|
+
const a = state.a;
|
|
126
|
+
state.a = 0;
|
|
127
|
+
try {
|
|
128
|
+
return f(a, state.b, ...args);
|
|
129
|
+
} finally {
|
|
130
|
+
if (--state.cnt === 0) {
|
|
131
|
+
wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
|
|
132
|
+
|
|
133
|
+
} else {
|
|
134
|
+
state.a = a;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
real.original = state;
|
|
139
|
+
|
|
140
|
+
return real;
|
|
141
|
+
}
|
|
142
|
+
function __wbg_adapter_18(arg0, arg1, arg2) {
|
|
143
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h61642589700c528b(arg0, arg1, addHeapObject(arg2));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function getCachedStringFromWasm0(ptr, len) {
|
|
147
|
+
if (ptr === 0) {
|
|
148
|
+
return getObject(len);
|
|
149
|
+
} else {
|
|
150
|
+
return getStringFromWasm0(ptr, len);
|
|
108
151
|
}
|
|
109
|
-
return cachegetInt32Memory0;
|
|
110
152
|
}
|
|
153
|
+
|
|
154
|
+
function handleError(f, args) {
|
|
155
|
+
try {
|
|
156
|
+
return f.apply(this, args);
|
|
157
|
+
} catch (e) {
|
|
158
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function __wbg_adapter_33(arg0, arg1, arg2, arg3) {
|
|
162
|
+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h7f50d477bd18f33c(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
163
|
+
}
|
|
164
|
+
|
|
111
165
|
/**
|
|
112
166
|
* @param {string} s
|
|
113
167
|
* @param {any} opts
|
|
@@ -116,9 +170,7 @@ function getInt32Memory0() {
|
|
|
116
170
|
export function minifySync(s, opts) {
|
|
117
171
|
try {
|
|
118
172
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
119
|
-
|
|
120
|
-
const len0 = WASM_VECTOR_LEN;
|
|
121
|
-
wasm.minifySync(retptr, ptr0, len0, addHeapObject(opts));
|
|
173
|
+
wasm.minifySync(retptr, addHeapObject(s), addHeapObject(opts));
|
|
122
174
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
123
175
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
124
176
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -134,14 +186,22 @@ export function minifySync(s, opts) {
|
|
|
134
186
|
/**
|
|
135
187
|
* @param {string} s
|
|
136
188
|
* @param {any} opts
|
|
189
|
+
* @returns {Promise<any>}
|
|
190
|
+
*/
|
|
191
|
+
export function minify(s, opts) {
|
|
192
|
+
const ret = wasm.minify(addHeapObject(s), addHeapObject(opts));
|
|
193
|
+
return takeObject(ret);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @param {any} s
|
|
198
|
+
* @param {any} opts
|
|
137
199
|
* @returns {any}
|
|
138
200
|
*/
|
|
139
201
|
export function transformSync(s, opts) {
|
|
140
202
|
try {
|
|
141
203
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
142
|
-
|
|
143
|
-
const len0 = WASM_VECTOR_LEN;
|
|
144
|
-
wasm.transformSync(retptr, ptr0, len0, addHeapObject(opts));
|
|
204
|
+
wasm.transformSync(retptr, addHeapObject(s), addHeapObject(opts));
|
|
145
205
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
146
206
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
147
207
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -154,6 +214,16 @@ export function transformSync(s, opts) {
|
|
|
154
214
|
}
|
|
155
215
|
}
|
|
156
216
|
|
|
217
|
+
/**
|
|
218
|
+
* @param {any} s
|
|
219
|
+
* @param {any} opts
|
|
220
|
+
* @returns {Promise<any>}
|
|
221
|
+
*/
|
|
222
|
+
export function transform(s, opts) {
|
|
223
|
+
const ret = wasm.transform(addHeapObject(s), addHeapObject(opts));
|
|
224
|
+
return takeObject(ret);
|
|
225
|
+
}
|
|
226
|
+
|
|
157
227
|
/**
|
|
158
228
|
* @param {string} s
|
|
159
229
|
* @param {any} opts
|
|
@@ -162,9 +232,7 @@ export function transformSync(s, opts) {
|
|
|
162
232
|
export function parseSync(s, opts) {
|
|
163
233
|
try {
|
|
164
234
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
165
|
-
|
|
166
|
-
const len0 = WASM_VECTOR_LEN;
|
|
167
|
-
wasm.parseSync(retptr, ptr0, len0, addHeapObject(opts));
|
|
235
|
+
wasm.parseSync(retptr, addHeapObject(s), addHeapObject(opts));
|
|
168
236
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
169
237
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
170
238
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -177,6 +245,16 @@ export function parseSync(s, opts) {
|
|
|
177
245
|
}
|
|
178
246
|
}
|
|
179
247
|
|
|
248
|
+
/**
|
|
249
|
+
* @param {string} s
|
|
250
|
+
* @param {any} opts
|
|
251
|
+
* @returns {Promise<any>}
|
|
252
|
+
*/
|
|
253
|
+
export function parse(s, opts) {
|
|
254
|
+
const ret = wasm.parse(addHeapObject(s), addHeapObject(opts));
|
|
255
|
+
return takeObject(ret);
|
|
256
|
+
}
|
|
257
|
+
|
|
180
258
|
async function load(module, imports) {
|
|
181
259
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
182
260
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -208,24 +286,21 @@ async function load(module, imports) {
|
|
|
208
286
|
}
|
|
209
287
|
}
|
|
210
288
|
|
|
211
|
-
|
|
212
|
-
if (typeof input === 'undefined') {
|
|
213
|
-
input = new URL('wasm_bg.wasm', import.meta.url);
|
|
214
|
-
}
|
|
289
|
+
function getImports() {
|
|
215
290
|
const imports = {};
|
|
216
291
|
imports.wbg = {};
|
|
217
|
-
imports.wbg.
|
|
292
|
+
imports.wbg.__wbg_new0_adda2d4bcb124f0a = function() {
|
|
218
293
|
const ret = new Date();
|
|
219
294
|
return addHeapObject(ret);
|
|
220
295
|
};
|
|
221
|
-
imports.wbg.
|
|
296
|
+
imports.wbg.__wbg_getTime_58b0bdbebd4ef11d = function(arg0) {
|
|
222
297
|
const ret = getObject(arg0).getTime();
|
|
223
298
|
return ret;
|
|
224
299
|
};
|
|
225
300
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
226
301
|
takeObject(arg0);
|
|
227
302
|
};
|
|
228
|
-
imports.wbg.
|
|
303
|
+
imports.wbg.__wbg_getTimezoneOffset_8a39b51acb4f52c9 = function(arg0) {
|
|
229
304
|
const ret = getObject(arg0).getTimezoneOffset();
|
|
230
305
|
return ret;
|
|
231
306
|
};
|
|
@@ -241,45 +316,129 @@ async function init(input) {
|
|
|
241
316
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
242
317
|
};
|
|
243
318
|
imports.wbg.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
319
|
+
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
|
320
|
+
if (arg0 !== 0) { wasm.__wbindgen_free(arg0, arg1); }
|
|
321
|
+
console.error(v0);
|
|
322
|
+
};
|
|
323
|
+
imports.wbg.__wbg_call_65af9f665ab6ade5 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
324
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
325
|
+
return addHeapObject(ret);
|
|
326
|
+
}, arguments) };
|
|
327
|
+
imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
|
|
328
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
329
|
+
return addHeapObject(ret);
|
|
330
|
+
};
|
|
331
|
+
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
332
|
+
const obj = getObject(arg1);
|
|
333
|
+
const ret = JSON.stringify(obj === undefined ? null : obj);
|
|
334
|
+
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
335
|
+
const len0 = WASM_VECTOR_LEN;
|
|
336
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
337
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
338
|
+
};
|
|
339
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
340
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
341
|
+
return ret;
|
|
342
|
+
};
|
|
343
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
344
|
+
const obj = getObject(arg1);
|
|
345
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
346
|
+
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
347
|
+
var len0 = WASM_VECTOR_LEN;
|
|
348
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
349
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
350
|
+
};
|
|
351
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
352
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
353
|
+
return addHeapObject(ret);
|
|
354
|
+
};
|
|
355
|
+
imports.wbg.__wbg_new_52205195aa880fc2 = function(arg0, arg1) {
|
|
356
|
+
try {
|
|
357
|
+
var state0 = {a: arg0, b: arg1};
|
|
358
|
+
var cb0 = (arg0, arg1) => {
|
|
359
|
+
const a = state0.a;
|
|
360
|
+
state0.a = 0;
|
|
361
|
+
try {
|
|
362
|
+
return __wbg_adapter_33(a, state0.b, arg0, arg1);
|
|
363
|
+
} finally {
|
|
364
|
+
state0.a = a;
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
const ret = new Promise(cb0);
|
|
264
368
|
return addHeapObject(ret);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
271
|
-
input = fetch(input);
|
|
369
|
+
} finally {
|
|
370
|
+
state0.a = state0.b = 0;
|
|
272
371
|
}
|
|
372
|
+
};
|
|
373
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
374
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
375
|
+
};
|
|
376
|
+
imports.wbg.__wbg_then_18da6e5453572fc8 = function(arg0, arg1) {
|
|
377
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
378
|
+
return addHeapObject(ret);
|
|
379
|
+
};
|
|
380
|
+
imports.wbg.__wbg_resolve_0107b3a501450ba0 = function(arg0) {
|
|
381
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
382
|
+
return addHeapObject(ret);
|
|
383
|
+
};
|
|
384
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
385
|
+
const obj = takeObject(arg0).original;
|
|
386
|
+
if (obj.cnt-- == 1) {
|
|
387
|
+
obj.a = 0;
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
const ret = false;
|
|
391
|
+
return ret;
|
|
392
|
+
};
|
|
393
|
+
imports.wbg.__wbindgen_closure_wrapper15875 = function(arg0, arg1, arg2) {
|
|
394
|
+
const ret = makeMutClosure(arg0, arg1, 223, __wbg_adapter_18);
|
|
395
|
+
return addHeapObject(ret);
|
|
396
|
+
};
|
|
273
397
|
|
|
398
|
+
return imports;
|
|
399
|
+
}
|
|
274
400
|
|
|
401
|
+
function initMemory(imports, maybe_memory) {
|
|
275
402
|
|
|
276
|
-
|
|
403
|
+
}
|
|
277
404
|
|
|
405
|
+
function finalizeInit(instance, module) {
|
|
278
406
|
wasm = instance.exports;
|
|
279
407
|
init.__wbindgen_wasm_module = module;
|
|
408
|
+
cachedInt32Memory0 = new Int32Array();
|
|
409
|
+
cachedUint8Memory0 = new Uint8Array();
|
|
410
|
+
|
|
280
411
|
|
|
281
412
|
return wasm;
|
|
282
413
|
}
|
|
283
414
|
|
|
284
|
-
|
|
415
|
+
function initSync(bytes) {
|
|
416
|
+
const imports = getImports();
|
|
417
|
+
|
|
418
|
+
initMemory(imports);
|
|
419
|
+
|
|
420
|
+
const module = new WebAssembly.Module(bytes);
|
|
421
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
285
422
|
|
|
423
|
+
return finalizeInit(instance, module);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
async function init(input) {
|
|
427
|
+
if (typeof input === 'undefined') {
|
|
428
|
+
input = new URL('wasm_bg.wasm', import.meta.url);
|
|
429
|
+
}
|
|
430
|
+
const imports = getImports();
|
|
431
|
+
|
|
432
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
433
|
+
input = fetch(input);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
initMemory(imports);
|
|
437
|
+
|
|
438
|
+
const { instance, module } = await load(await input, imports);
|
|
439
|
+
|
|
440
|
+
return finalizeInit(instance, module);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export { initSync }
|
|
444
|
+
export default init;
|
package/wasm_bg.wasm
CHANGED
|
Binary file
|