@next/swc-wasm-web 12.0.5-canary.10

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@next/swc-wasm`
2
+
3
+ This is the **wasm** binary for `@next/swc`
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@next/swc-wasm-web",
3
+ "version": "12.0.5-canary.10",
4
+ "files": [
5
+ "wasm_bg.wasm",
6
+ "wasm.js",
7
+ "wasm.d.ts"
8
+ ],
9
+ "module": "wasm.js",
10
+ "types": "wasm.d.ts",
11
+ "sideEffects": false
12
+ }
package/wasm.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @param {string} query
5
+ * @param {any} opts
6
+ * @returns {any}
7
+ */
8
+ export function execute(query: string, opts: any): any;
9
+ /**
10
+ * @param {string} s
11
+ * @param {any} opts
12
+ * @returns {any}
13
+ */
14
+ export function minifySync(s: string, opts: any): any;
15
+ /**
16
+ * @param {string} s
17
+ * @param {any} opts
18
+ * @returns {any}
19
+ */
20
+ export function transformSync(s: string, opts: any): any;
21
+
22
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
23
+
24
+ export interface InitOutput {
25
+ readonly memory: WebAssembly.Memory;
26
+ readonly execute: (a: number, b: number, c: number) => number;
27
+ readonly minifySync: (a: number, b: number, c: number) => number;
28
+ readonly transformSync: (a: number, b: number, c: number) => number;
29
+ readonly __wbindgen_malloc: (a: number) => number;
30
+ readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
31
+ readonly __wbindgen_free: (a: number, b: number) => void;
32
+ readonly __wbindgen_exn_store: (a: number) => void;
33
+ }
34
+
35
+ /**
36
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
37
+ * for everything else, calls `WebAssembly.instantiate` directly.
38
+ *
39
+ * @param {InitInput | Promise<InitInput>} module_or_path
40
+ *
41
+ * @returns {Promise<InitOutput>}
42
+ */
43
+ export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
package/wasm.js ADDED
@@ -0,0 +1,321 @@
1
+
2
+ let wasm;
3
+
4
+ const heap = new Array(32).fill(undefined);
5
+
6
+ heap.push(undefined, null, true, false);
7
+
8
+ function getObject(idx) { return heap[idx]; }
9
+
10
+ let heap_next = heap.length;
11
+
12
+ function dropObject(idx) {
13
+ if (idx < 36) return;
14
+ heap[idx] = heap_next;
15
+ heap_next = idx;
16
+ }
17
+
18
+ function takeObject(idx) {
19
+ const ret = getObject(idx);
20
+ dropObject(idx);
21
+ return ret;
22
+ }
23
+
24
+ function addHeapObject(obj) {
25
+ if (heap_next === heap.length) heap.push(heap.length + 1);
26
+ const idx = heap_next;
27
+ heap_next = heap[idx];
28
+
29
+ heap[idx] = obj;
30
+ return idx;
31
+ }
32
+
33
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
34
+
35
+ cachedTextDecoder.decode();
36
+
37
+ let cachegetUint8Memory0 = null;
38
+ function getUint8Memory0() {
39
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
40
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
41
+ }
42
+ return cachegetUint8Memory0;
43
+ }
44
+
45
+ function getStringFromWasm0(ptr, len) {
46
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
47
+ }
48
+
49
+ let WASM_VECTOR_LEN = 0;
50
+
51
+ let cachedTextEncoder = new TextEncoder('utf-8');
52
+
53
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
54
+ ? function (arg, view) {
55
+ return cachedTextEncoder.encodeInto(arg, view);
56
+ }
57
+ : function (arg, view) {
58
+ const buf = cachedTextEncoder.encode(arg);
59
+ view.set(buf);
60
+ return {
61
+ read: arg.length,
62
+ written: buf.length
63
+ };
64
+ });
65
+
66
+ function passStringToWasm0(arg, malloc, realloc) {
67
+
68
+ if (realloc === undefined) {
69
+ const buf = cachedTextEncoder.encode(arg);
70
+ const ptr = malloc(buf.length);
71
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
72
+ WASM_VECTOR_LEN = buf.length;
73
+ return ptr;
74
+ }
75
+
76
+ let len = arg.length;
77
+ let ptr = malloc(len);
78
+
79
+ const mem = getUint8Memory0();
80
+
81
+ let offset = 0;
82
+
83
+ for (; offset < len; offset++) {
84
+ const code = arg.charCodeAt(offset);
85
+ if (code > 0x7F) break;
86
+ mem[ptr + offset] = code;
87
+ }
88
+
89
+ if (offset !== len) {
90
+ if (offset !== 0) {
91
+ arg = arg.slice(offset);
92
+ }
93
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
94
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
95
+ const ret = encodeString(arg, view);
96
+
97
+ offset += ret.written;
98
+ }
99
+
100
+ WASM_VECTOR_LEN = offset;
101
+ return ptr;
102
+ }
103
+
104
+ function isLikeNone(x) {
105
+ return x === undefined || x === null;
106
+ }
107
+
108
+ let cachegetInt32Memory0 = null;
109
+ function getInt32Memory0() {
110
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
111
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
112
+ }
113
+ return cachegetInt32Memory0;
114
+ }
115
+ /**
116
+ * @param {string} query
117
+ * @param {any} opts
118
+ * @returns {any}
119
+ */
120
+ export function execute(query, opts) {
121
+ var ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
122
+ var len0 = WASM_VECTOR_LEN;
123
+ var ret = wasm.execute(ptr0, len0, addHeapObject(opts));
124
+ return takeObject(ret);
125
+ }
126
+
127
+ function handleError(f) {
128
+ return function () {
129
+ try {
130
+ return f.apply(this, arguments);
131
+
132
+ } catch (e) {
133
+ wasm.__wbindgen_exn_store(addHeapObject(e));
134
+ }
135
+ };
136
+ }
137
+ /**
138
+ * @param {string} s
139
+ * @param {any} opts
140
+ * @returns {any}
141
+ */
142
+ export function minifySync(s, opts) {
143
+ var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
144
+ var len0 = WASM_VECTOR_LEN;
145
+ var ret = wasm.minifySync(ptr0, len0, addHeapObject(opts));
146
+ return takeObject(ret);
147
+ }
148
+
149
+ /**
150
+ * @param {string} s
151
+ * @param {any} opts
152
+ * @returns {any}
153
+ */
154
+ export function transformSync(s, opts) {
155
+ var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
156
+ var len0 = WASM_VECTOR_LEN;
157
+ var ret = wasm.transformSync(ptr0, len0, addHeapObject(opts));
158
+ return takeObject(ret);
159
+ }
160
+
161
+ async function load(module, imports) {
162
+ if (typeof Response === 'function' && module instanceof Response) {
163
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
164
+ try {
165
+ return await WebAssembly.instantiateStreaming(module, imports);
166
+
167
+ } catch (e) {
168
+ if (module.headers.get('Content-Type') != 'application/wasm') {
169
+ 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);
170
+
171
+ } else {
172
+ throw e;
173
+ }
174
+ }
175
+ }
176
+
177
+ const bytes = await module.arrayBuffer();
178
+ return await WebAssembly.instantiate(bytes, imports);
179
+
180
+ } else {
181
+ const instance = await WebAssembly.instantiate(module, imports);
182
+
183
+ if (instance instanceof WebAssembly.Instance) {
184
+ return { instance, module };
185
+
186
+ } else {
187
+ return instance;
188
+ }
189
+ }
190
+ }
191
+
192
+ async function init(input) {
193
+ if (typeof input === 'undefined') {
194
+ input = new URL('wasm_bg.wasm', import.meta.url);
195
+ }
196
+ const imports = {};
197
+ imports.wbg = {};
198
+ imports.wbg.__wbg_new0_b999da099e34d501 = function() {
199
+ var ret = new Date();
200
+ return addHeapObject(ret);
201
+ };
202
+ imports.wbg.__wbg_getTime_fea26678ab8a3ccc = function(arg0) {
203
+ var ret = getObject(arg0).getTime();
204
+ return ret;
205
+ };
206
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
207
+ takeObject(arg0);
208
+ };
209
+ imports.wbg.__wbg_getTimezoneOffset_b888306309b35fe2 = function(arg0) {
210
+ var ret = getObject(arg0).getTimezoneOffset();
211
+ return ret;
212
+ };
213
+ imports.wbg.__wbg_self_35a0fda3eb965abe = handleError(function() {
214
+ var ret = self.self;
215
+ return addHeapObject(ret);
216
+ });
217
+ imports.wbg.__wbg_window_88a6f88dd3a474f1 = handleError(function() {
218
+ var ret = window.window;
219
+ return addHeapObject(ret);
220
+ });
221
+ imports.wbg.__wbg_globalThis_1d843c4ad7b6a1f5 = handleError(function() {
222
+ var ret = globalThis.globalThis;
223
+ return addHeapObject(ret);
224
+ });
225
+ imports.wbg.__wbg_global_294ce70448e8fbbf = handleError(function() {
226
+ var ret = global.global;
227
+ return addHeapObject(ret);
228
+ });
229
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
230
+ var ret = getObject(arg0) === undefined;
231
+ return ret;
232
+ };
233
+ imports.wbg.__wbg_newnoargs_2349ba6aefe72376 = function(arg0, arg1) {
234
+ var ret = new Function(getStringFromWasm0(arg0, arg1));
235
+ return addHeapObject(ret);
236
+ };
237
+ imports.wbg.__wbg_call_e5847d15cc228e4f = handleError(function(arg0, arg1) {
238
+ var ret = getObject(arg0).call(getObject(arg1));
239
+ return addHeapObject(ret);
240
+ });
241
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
242
+ var ret = getObject(arg0);
243
+ return addHeapObject(ret);
244
+ };
245
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
246
+ var ret = getStringFromWasm0(arg0, arg1);
247
+ return addHeapObject(ret);
248
+ };
249
+ imports.wbg.__wbg_get_4e90ba4e3de362de = handleError(function(arg0, arg1) {
250
+ var ret = Reflect.get(getObject(arg0), getObject(arg1));
251
+ return addHeapObject(ret);
252
+ });
253
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
254
+ const obj = getObject(arg1);
255
+ var ret = typeof(obj) === 'string' ? obj : undefined;
256
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
+ var len0 = WASM_VECTOR_LEN;
258
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
259
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
260
+ };
261
+ imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
262
+ const obj = getObject(arg1);
263
+ var ret = JSON.stringify(obj === undefined ? null : obj);
264
+ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
+ var len0 = WASM_VECTOR_LEN;
266
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
267
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
268
+ };
269
+ imports.wbg.__wbg_new_7c995f2adeba6fb5 = function() {
270
+ var ret = new Array();
271
+ return addHeapObject(ret);
272
+ };
273
+ imports.wbg.__wbg_push_3f7c76b58919ce0d = function(arg0, arg1) {
274
+ var ret = getObject(arg0).push(getObject(arg1));
275
+ return ret;
276
+ };
277
+ imports.wbg.__wbg_new_693216e109162396 = function() {
278
+ var ret = new Error();
279
+ return addHeapObject(ret);
280
+ };
281
+ imports.wbg.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) {
282
+ var ret = getObject(arg1).stack;
283
+ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
+ var len0 = WASM_VECTOR_LEN;
285
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
286
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
287
+ };
288
+ imports.wbg.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
289
+ try {
290
+ console.error(getStringFromWasm0(arg0, arg1));
291
+ } finally {
292
+ wasm.__wbindgen_free(arg0, arg1);
293
+ }
294
+ };
295
+ imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
296
+ var ret = JSON.parse(getStringFromWasm0(arg0, arg1));
297
+ return addHeapObject(ret);
298
+ };
299
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
300
+ throw new Error(getStringFromWasm0(arg0, arg1));
301
+ };
302
+ imports.wbg.__wbindgen_rethrow = function(arg0) {
303
+ throw takeObject(arg0);
304
+ };
305
+
306
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
307
+ input = fetch(input);
308
+ }
309
+
310
+
311
+
312
+ const { instance, module } = await load(await input, imports);
313
+
314
+ wasm = instance.exports;
315
+ init.__wbindgen_wasm_module = module;
316
+
317
+ return wasm;
318
+ }
319
+
320
+ export default init;
321
+
package/wasm_bg.wasm ADDED
Binary file