@swc/wasm 1.2.223 → 1.2.226

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "강동윤 <kdy1997.dev@gmail.com>"
5
5
  ],
6
6
  "description": "wasm module for swc",
7
- "version": "1.2.223",
7
+ "version": "1.2.226",
8
8
  "license": "Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
package/wasm.d.ts CHANGED
@@ -1,42 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
- export function minify(src: string, opts?: JsMinifyOptions): Promise<Output>;
5
- export function minifySync(code: string, opts?: JsMinifyOptions): Output;
6
-
7
- export function parse(src: string, options: ParseOptions & {
8
- isModule: false;
9
- }): Promise<Script>;
10
- export function parse(src: string, options?: ParseOptions): Promise<Module>;
11
- export function parseSync(src: string, options: ParseOptions & {
12
- isModule: false;
13
- }): Script;
14
- export function parseSync(src: string, options?: ParseOptions): Module;
15
-
16
- export function print(m: Program, options?: Options): Promise<Output>;
17
- export function printSync(m: Program, options?: Options): Output
18
-
19
- /**
20
- * Note: this interface currently does not do _actual_ async work, only provides
21
- * a corresponding async interfaces to the `@swc/core`'s interface.
22
- */
23
- export function transform(
24
- code: string | Program,
25
- options?: Options,
26
- experimental_plugin_bytes_resolver?: any
27
- ): Promise<Output>;
28
- /**
29
- * @param {string} code
30
- * @param {Options} opts
31
- * @param {Record<string, ArrayBuffer>} experimental_plugin_bytes_resolver An object contains bytes array for the plugin
32
- * specified in config. Key of record represents the name of the plugin specified in config. Note this is an experimental
33
- * interface, likely will change.
34
- * @returns {Output}
35
- */
36
- export function transformSync(code: string | Program, opts?: Options, experimental_plugin_bytes_resolver?: any): Output;
37
-
38
-
39
-
40
4
  export interface Plugin {
41
5
  (module: Program): Program;
42
6
  }
@@ -2825,3 +2789,39 @@ export interface Invalid extends Node, HasSpan {
2825
2789
  }
2826
2790
 
2827
2791
 
2792
+
2793
+ export function minify(src: string, opts?: JsMinifyOptions): Promise<Output>;
2794
+ export function minifySync(code: string, opts?: JsMinifyOptions): Output;
2795
+
2796
+ export function parse(src: string, options: ParseOptions & {
2797
+ isModule: false;
2798
+ }): Promise<Script>;
2799
+ export function parse(src: string, options?: ParseOptions): Promise<Module>;
2800
+ export function parseSync(src: string, options: ParseOptions & {
2801
+ isModule: false;
2802
+ }): Script;
2803
+ export function parseSync(src: string, options?: ParseOptions): Module;
2804
+
2805
+ export function print(m: Program, options?: Options): Promise<Output>;
2806
+ export function printSync(m: Program, options?: Options): Output
2807
+
2808
+ /**
2809
+ * Note: this interface currently does not do _actual_ async work, only provides
2810
+ * a corresponding async interfaces to the `@swc/core`'s interface.
2811
+ */
2812
+ export function transform(
2813
+ code: string | Program,
2814
+ options?: Options,
2815
+ experimental_plugin_bytes_resolver?: any
2816
+ ): Promise<Output>;
2817
+ /**
2818
+ * @param {string} code
2819
+ * @param {Options} opts
2820
+ * @param {Record<string, ArrayBuffer>} experimental_plugin_bytes_resolver An object contains bytes array for the plugin
2821
+ * specified in config. Key of record represents the name of the plugin specified in config. Note this is an experimental
2822
+ * interface, likely will change.
2823
+ * @returns {Output}
2824
+ */
2825
+ export function transformSync(code: string | Program, opts?: Options, experimental_plugin_bytes_resolver?: any): Output;
2826
+
2827
+
package/wasm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { TextDecoder, TextEncoder } = require(`util`);
4
+ const { TextEncoder, TextDecoder } = require(`util`);
5
5
 
6
6
  const heap = new Array(32).fill(undefined);
7
7
 
@@ -23,9 +23,7 @@ function takeObject(idx) {
23
23
  return ret;
24
24
  }
25
25
 
26
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
-
28
- cachedTextDecoder.decode();
26
+ let WASM_VECTOR_LEN = 0;
29
27
 
30
28
  let cachedUint8Memory0 = new Uint8Array();
31
29
 
@@ -36,21 +34,6 @@ function getUint8Memory0() {
36
34
  return cachedUint8Memory0;
37
35
  }
38
36
 
39
- function getStringFromWasm0(ptr, len) {
40
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
41
- }
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
- let WASM_VECTOR_LEN = 0;
53
-
54
37
  let cachedTextEncoder = new TextEncoder('utf-8');
55
38
 
56
39
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -117,6 +100,23 @@ function getInt32Memory0() {
117
100
  return cachedInt32Memory0;
118
101
  }
119
102
 
103
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
104
+
105
+ cachedTextDecoder.decode();
106
+
107
+ function getStringFromWasm0(ptr, len) {
108
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
109
+ }
110
+
111
+ function addHeapObject(obj) {
112
+ if (heap_next === heap.length) heap.push(heap.length + 1);
113
+ const idx = heap_next;
114
+ heap_next = heap[idx];
115
+
116
+ heap[idx] = obj;
117
+ return idx;
118
+ }
119
+
120
120
  function makeMutClosure(arg0, arg1, dtor, f) {
121
121
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
122
122
  const real = (...args) => {
@@ -210,12 +210,13 @@ module.exports.parse = function(s, opts) {
210
210
  /**
211
211
  * @param {any} s
212
212
  * @param {any} opts
213
+ * @param {any} experimental_plugin_bytes_resolver
213
214
  * @returns {any}
214
215
  */
215
- module.exports.printSync = function(s, opts) {
216
+ module.exports.transformSync = function(s, opts, experimental_plugin_bytes_resolver) {
216
217
  try {
217
218
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
218
- wasm.printSync(retptr, addHeapObject(s), addHeapObject(opts));
219
+ wasm.transformSync(retptr, addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
219
220
  var r0 = getInt32Memory0()[retptr / 4 + 0];
220
221
  var r1 = getInt32Memory0()[retptr / 4 + 1];
221
222
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -231,23 +232,23 @@ module.exports.printSync = function(s, opts) {
231
232
  /**
232
233
  * @param {any} s
233
234
  * @param {any} opts
235
+ * @param {any} experimental_plugin_bytes_resolver
234
236
  * @returns {Promise<any>}
235
237
  */
236
- module.exports.print = function(s, opts) {
237
- const ret = wasm.print(addHeapObject(s), addHeapObject(opts));
238
+ module.exports.transform = function(s, opts, experimental_plugin_bytes_resolver) {
239
+ const ret = wasm.transform(addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
238
240
  return takeObject(ret);
239
241
  };
240
242
 
241
243
  /**
242
244
  * @param {any} s
243
245
  * @param {any} opts
244
- * @param {any} experimental_plugin_bytes_resolver
245
246
  * @returns {any}
246
247
  */
247
- module.exports.transformSync = function(s, opts, experimental_plugin_bytes_resolver) {
248
+ module.exports.printSync = function(s, opts) {
248
249
  try {
249
250
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
250
- wasm.transformSync(retptr, addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
251
+ wasm.printSync(retptr, addHeapObject(s), addHeapObject(opts));
251
252
  var r0 = getInt32Memory0()[retptr / 4 + 0];
252
253
  var r1 = getInt32Memory0()[retptr / 4 + 1];
253
254
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -263,11 +264,10 @@ module.exports.transformSync = function(s, opts, experimental_plugin_bytes_resol
263
264
  /**
264
265
  * @param {any} s
265
266
  * @param {any} opts
266
- * @param {any} experimental_plugin_bytes_resolver
267
267
  * @returns {Promise<any>}
268
268
  */
269
- module.exports.transform = function(s, opts, experimental_plugin_bytes_resolver) {
270
- const ret = wasm.transform(addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
269
+ module.exports.print = function(s, opts) {
270
+ const ret = wasm.print(addHeapObject(s), addHeapObject(opts));
271
271
  return takeObject(ret);
272
272
  };
273
273
 
@@ -294,40 +294,6 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
294
294
  takeObject(arg0);
295
295
  };
296
296
 
297
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
298
- const ret = getStringFromWasm0(arg0, arg1);
299
- return addHeapObject(ret);
300
- };
301
-
302
- module.exports.__wbg_new_52205195aa880fc2 = function(arg0, arg1) {
303
- try {
304
- var state0 = {a: arg0, b: arg1};
305
- var cb0 = (arg0, arg1) => {
306
- const a = state0.a;
307
- state0.a = 0;
308
- try {
309
- return __wbg_adapter_45(a, state0.b, arg0, arg1);
310
- } finally {
311
- state0.a = a;
312
- }
313
- };
314
- const ret = new Promise(cb0);
315
- return addHeapObject(ret);
316
- } finally {
317
- state0.a = state0.b = 0;
318
- }
319
- };
320
-
321
- module.exports.__wbindgen_is_null = function(arg0) {
322
- const ret = getObject(arg0) === null;
323
- return ret;
324
- };
325
-
326
- module.exports.__wbindgen_is_undefined = function(arg0) {
327
- const ret = getObject(arg0) === undefined;
328
- return ret;
329
- };
330
-
331
297
  module.exports.__wbindgen_is_string = function(arg0) {
332
298
  const ret = typeof(getObject(arg0)) === 'string';
333
299
  return ret;
@@ -342,10 +308,15 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
342
308
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
343
309
  };
344
310
 
345
- module.exports.__wbg_call_65af9f665ab6ade5 = function() { return handleError(function (arg0, arg1, arg2) {
346
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
347
- return addHeapObject(ret);
348
- }, arguments) };
311
+ module.exports.__wbindgen_is_null = function(arg0) {
312
+ const ret = getObject(arg0) === null;
313
+ return ret;
314
+ };
315
+
316
+ module.exports.__wbindgen_is_undefined = function(arg0) {
317
+ const ret = getObject(arg0) === undefined;
318
+ return ret;
319
+ };
349
320
 
350
321
  module.exports.__wbindgen_json_serialize = function(arg0, arg1) {
351
322
  const obj = getObject(arg1);
@@ -361,6 +332,35 @@ module.exports.__wbindgen_json_parse = function(arg0, arg1) {
361
332
  return addHeapObject(ret);
362
333
  };
363
334
 
335
+ module.exports.__wbg_call_65af9f665ab6ade5 = function() { return handleError(function (arg0, arg1, arg2) {
336
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
337
+ return addHeapObject(ret);
338
+ }, arguments) };
339
+
340
+ module.exports.__wbg_new_52205195aa880fc2 = function(arg0, arg1) {
341
+ try {
342
+ var state0 = {a: arg0, b: arg1};
343
+ var cb0 = (arg0, arg1) => {
344
+ const a = state0.a;
345
+ state0.a = 0;
346
+ try {
347
+ return __wbg_adapter_45(a, state0.b, arg0, arg1);
348
+ } finally {
349
+ state0.a = a;
350
+ }
351
+ };
352
+ const ret = new Promise(cb0);
353
+ return addHeapObject(ret);
354
+ } finally {
355
+ state0.a = state0.b = 0;
356
+ }
357
+ };
358
+
359
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
360
+ const ret = getStringFromWasm0(arg0, arg1);
361
+ return addHeapObject(ret);
362
+ };
363
+
364
364
  module.exports.__wbg_new0_adda2d4bcb124f0a = function() {
365
365
  const ret = new Date();
366
366
  return addHeapObject(ret);
@@ -419,8 +419,8 @@ module.exports.__wbg_then_18da6e5453572fc8 = function(arg0, arg1) {
419
419
  return addHeapObject(ret);
420
420
  };
421
421
 
422
- module.exports.__wbindgen_closure_wrapper13510 = function(arg0, arg1, arg2) {
423
- const ret = makeMutClosure(arg0, arg1, 153, __wbg_adapter_22);
422
+ module.exports.__wbindgen_closure_wrapper14381 = function(arg0, arg1, arg2) {
423
+ const ret = makeMutClosure(arg0, arg1, 154, __wbg_adapter_22);
424
424
  return addHeapObject(ret);
425
425
  };
426
426
 
package/wasm_bg.wasm CHANGED
Binary file