@swc/wasm-web 1.2.224 → 1.2.225

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.224",
7
+ "version": "1.2.225",
8
8
  "license": "Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
package/wasm-web.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
  }
@@ -2826,6 +2790,42 @@ export interface Invalid extends Node, HasSpan {
2826
2790
 
2827
2791
 
2828
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
+
2828
+
2829
2829
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
2830
2830
 
2831
2831
  export interface InitOutput {
@@ -2834,10 +2834,10 @@ export interface InitOutput {
2834
2834
  readonly minify: (a: number, b: number) => number;
2835
2835
  readonly parseSync: (a: number, b: number, c: number) => void;
2836
2836
  readonly parse: (a: number, b: number) => number;
2837
- readonly printSync: (a: number, b: number, c: number) => void;
2838
- readonly print: (a: number, b: number) => number;
2839
2837
  readonly transformSync: (a: number, b: number, c: number, d: number) => void;
2840
2838
  readonly transform: (a: number, b: number, c: number) => number;
2839
+ readonly printSync: (a: number, b: number, c: number) => void;
2840
+ readonly print: (a: number, b: number) => number;
2841
2841
  readonly __wbindgen_malloc: (a: number) => number;
2842
2842
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
2843
2843
  readonly __wbindgen_export_2: WebAssembly.Table;
package/wasm-web.js CHANGED
@@ -21,9 +21,7 @@ function takeObject(idx) {
21
21
  return ret;
22
22
  }
23
23
 
24
- const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
25
-
26
- cachedTextDecoder.decode();
24
+ let WASM_VECTOR_LEN = 0;
27
25
 
28
26
  let cachedUint8Memory0 = new Uint8Array();
29
27
 
@@ -34,21 +32,6 @@ function getUint8Memory0() {
34
32
  return cachedUint8Memory0;
35
33
  }
36
34
 
37
- function getStringFromWasm0(ptr, len) {
38
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
39
- }
40
-
41
- function addHeapObject(obj) {
42
- if (heap_next === heap.length) heap.push(heap.length + 1);
43
- const idx = heap_next;
44
- heap_next = heap[idx];
45
-
46
- heap[idx] = obj;
47
- return idx;
48
- }
49
-
50
- let WASM_VECTOR_LEN = 0;
51
-
52
35
  const cachedTextEncoder = new TextEncoder('utf-8');
53
36
 
54
37
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -115,6 +98,23 @@ function getInt32Memory0() {
115
98
  return cachedInt32Memory0;
116
99
  }
117
100
 
101
+ const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
102
+
103
+ cachedTextDecoder.decode();
104
+
105
+ function getStringFromWasm0(ptr, len) {
106
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
107
+ }
108
+
109
+ function addHeapObject(obj) {
110
+ if (heap_next === heap.length) heap.push(heap.length + 1);
111
+ const idx = heap_next;
112
+ heap_next = heap[idx];
113
+
114
+ heap[idx] = obj;
115
+ return idx;
116
+ }
117
+
118
118
  function makeMutClosure(arg0, arg1, dtor, f) {
119
119
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
120
120
  const real = (...args) => {
@@ -208,12 +208,13 @@ export function parse(s, opts) {
208
208
  /**
209
209
  * @param {any} s
210
210
  * @param {any} opts
211
+ * @param {any} experimental_plugin_bytes_resolver
211
212
  * @returns {any}
212
213
  */
213
- export function printSync(s, opts) {
214
+ export function transformSync(s, opts, experimental_plugin_bytes_resolver) {
214
215
  try {
215
216
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
216
- wasm.printSync(retptr, addHeapObject(s), addHeapObject(opts));
217
+ wasm.transformSync(retptr, addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
217
218
  var r0 = getInt32Memory0()[retptr / 4 + 0];
218
219
  var r1 = getInt32Memory0()[retptr / 4 + 1];
219
220
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -229,23 +230,23 @@ export function printSync(s, opts) {
229
230
  /**
230
231
  * @param {any} s
231
232
  * @param {any} opts
233
+ * @param {any} experimental_plugin_bytes_resolver
232
234
  * @returns {Promise<any>}
233
235
  */
234
- export function print(s, opts) {
235
- const ret = wasm.print(addHeapObject(s), addHeapObject(opts));
236
+ export function transform(s, opts, experimental_plugin_bytes_resolver) {
237
+ const ret = wasm.transform(addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
236
238
  return takeObject(ret);
237
239
  }
238
240
 
239
241
  /**
240
242
  * @param {any} s
241
243
  * @param {any} opts
242
- * @param {any} experimental_plugin_bytes_resolver
243
244
  * @returns {any}
244
245
  */
245
- export function transformSync(s, opts, experimental_plugin_bytes_resolver) {
246
+ export function printSync(s, opts) {
246
247
  try {
247
248
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
248
- wasm.transformSync(retptr, addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
249
+ wasm.printSync(retptr, addHeapObject(s), addHeapObject(opts));
249
250
  var r0 = getInt32Memory0()[retptr / 4 + 0];
250
251
  var r1 = getInt32Memory0()[retptr / 4 + 1];
251
252
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -261,11 +262,10 @@ export function transformSync(s, opts, experimental_plugin_bytes_resolver) {
261
262
  /**
262
263
  * @param {any} s
263
264
  * @param {any} opts
264
- * @param {any} experimental_plugin_bytes_resolver
265
265
  * @returns {Promise<any>}
266
266
  */
267
- export function transform(s, opts, experimental_plugin_bytes_resolver) {
268
- const ret = wasm.transform(addHeapObject(s), addHeapObject(opts), addHeapObject(experimental_plugin_bytes_resolver));
267
+ export function print(s, opts) {
268
+ const ret = wasm.print(addHeapObject(s), addHeapObject(opts));
269
269
  return takeObject(ret);
270
270
  }
271
271
 
@@ -325,36 +325,6 @@ function getImports() {
325
325
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
326
326
  takeObject(arg0);
327
327
  };
328
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
329
- const ret = getStringFromWasm0(arg0, arg1);
330
- return addHeapObject(ret);
331
- };
332
- imports.wbg.__wbg_new_52205195aa880fc2 = function(arg0, arg1) {
333
- try {
334
- var state0 = {a: arg0, b: arg1};
335
- var cb0 = (arg0, arg1) => {
336
- const a = state0.a;
337
- state0.a = 0;
338
- try {
339
- return __wbg_adapter_45(a, state0.b, arg0, arg1);
340
- } finally {
341
- state0.a = a;
342
- }
343
- };
344
- const ret = new Promise(cb0);
345
- return addHeapObject(ret);
346
- } finally {
347
- state0.a = state0.b = 0;
348
- }
349
- };
350
- imports.wbg.__wbindgen_is_null = function(arg0) {
351
- const ret = getObject(arg0) === null;
352
- return ret;
353
- };
354
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
355
- const ret = getObject(arg0) === undefined;
356
- return ret;
357
- };
358
328
  imports.wbg.__wbindgen_is_string = function(arg0) {
359
329
  const ret = typeof(getObject(arg0)) === 'string';
360
330
  return ret;
@@ -367,10 +337,14 @@ function getImports() {
367
337
  getInt32Memory0()[arg0 / 4 + 1] = len0;
368
338
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
369
339
  };
370
- imports.wbg.__wbg_call_65af9f665ab6ade5 = function() { return handleError(function (arg0, arg1, arg2) {
371
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
372
- return addHeapObject(ret);
373
- }, arguments) };
340
+ imports.wbg.__wbindgen_is_null = function(arg0) {
341
+ const ret = getObject(arg0) === null;
342
+ return ret;
343
+ };
344
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
345
+ const ret = getObject(arg0) === undefined;
346
+ return ret;
347
+ };
374
348
  imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
375
349
  const obj = getObject(arg1);
376
350
  const ret = JSON.stringify(obj === undefined ? null : obj);
@@ -383,6 +357,32 @@ function getImports() {
383
357
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
384
358
  return addHeapObject(ret);
385
359
  };
360
+ imports.wbg.__wbg_call_65af9f665ab6ade5 = function() { return handleError(function (arg0, arg1, arg2) {
361
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
362
+ return addHeapObject(ret);
363
+ }, arguments) };
364
+ imports.wbg.__wbg_new_52205195aa880fc2 = function(arg0, arg1) {
365
+ try {
366
+ var state0 = {a: arg0, b: arg1};
367
+ var cb0 = (arg0, arg1) => {
368
+ const a = state0.a;
369
+ state0.a = 0;
370
+ try {
371
+ return __wbg_adapter_45(a, state0.b, arg0, arg1);
372
+ } finally {
373
+ state0.a = a;
374
+ }
375
+ };
376
+ const ret = new Promise(cb0);
377
+ return addHeapObject(ret);
378
+ } finally {
379
+ state0.a = state0.b = 0;
380
+ }
381
+ };
382
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
383
+ const ret = getStringFromWasm0(arg0, arg1);
384
+ return addHeapObject(ret);
385
+ };
386
386
  imports.wbg.__wbg_new0_adda2d4bcb124f0a = function() {
387
387
  const ret = new Date();
388
388
  return addHeapObject(ret);
@@ -431,8 +431,8 @@ imports.wbg.__wbg_then_18da6e5453572fc8 = function(arg0, arg1) {
431
431
  const ret = getObject(arg0).then(getObject(arg1));
432
432
  return addHeapObject(ret);
433
433
  };
434
- imports.wbg.__wbindgen_closure_wrapper13563 = function(arg0, arg1, arg2) {
435
- const ret = makeMutClosure(arg0, arg1, 153, __wbg_adapter_22);
434
+ imports.wbg.__wbindgen_closure_wrapper14389 = function(arg0, arg1, arg2) {
435
+ const ret = makeMutClosure(arg0, arg1, 154, __wbg_adapter_22);
436
436
  return addHeapObject(ret);
437
437
  };
438
438
 
package/wasm-web_bg.wasm CHANGED
Binary file