@next/swc-wasm-web 15.4.7 → 15.5.0

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
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@next/swc-wasm-web",
3
- "type": "module",
4
- "version": "15.4.7",
3
+ "version": "15.5.0",
5
4
  "files": [
6
5
  "wasm_bg.wasm",
7
6
  "wasm.js",
8
7
  "wasm.d.ts"
9
8
  ],
10
- "main": "wasm.js",
9
+ "module": "wasm.js",
11
10
  "types": "wasm.d.ts",
12
11
  "sideEffects": [
13
12
  "./snippets/*"
package/wasm.d.ts CHANGED
@@ -8,6 +8,7 @@ export function transformSync(s: any, opts: any): any;
8
8
  export function transform(s: any, opts: any): Promise<any>;
9
9
  export function parseSync(s: string, opts: any): any;
10
10
  export function parse(s: string, opts: any): Promise<any>;
11
+ export function expandNextJsTemplate(content: Uint8Array, template_path: string, next_package_dir_path: string, replacements: any, injections: any, imports: any): string;
11
12
 
12
13
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
13
14
 
@@ -21,16 +22,17 @@ export interface InitOutput {
21
22
  readonly transform: (a: any, b: any) => any;
22
23
  readonly parseSync: (a: any, b: any) => [number, number, number];
23
24
  readonly parse: (a: any, b: any) => any;
25
+ readonly expandNextJsTemplate: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any, i: any) => [number, number, number, number];
26
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
27
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
24
28
  readonly __wbindgen_exn_store: (a: number) => void;
25
29
  readonly __externref_table_alloc: () => number;
26
- readonly __wbindgen_export_2: WebAssembly.Table;
30
+ readonly __wbindgen_export_4: WebAssembly.Table;
27
31
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
28
- readonly __wbindgen_malloc: (a: number, b: number) => number;
29
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
30
32
  readonly __wbindgen_export_6: WebAssembly.Table;
31
33
  readonly __externref_table_dealloc: (a: number) => void;
32
- readonly closure1137_externref_shim: (a: number, b: number, c: any) => void;
33
- readonly closure124_externref_shim: (a: number, b: number, c: any, d: any) => void;
34
+ readonly closure1130_externref_shim: (a: number, b: number, c: any) => void;
35
+ readonly closure123_externref_shim: (a: number, b: number, c: any, d: any) => void;
34
36
  readonly __wbindgen_start: () => void;
35
37
  }
36
38
 
package/wasm.js CHANGED
@@ -1,25 +1,6 @@
1
1
  let wasm;
2
2
 
3
- function addToExternrefTable0(obj) {
4
- const idx = wasm.__externref_table_alloc();
5
- wasm.__wbindgen_export_2.set(idx, obj);
6
- return idx;
7
- }
8
-
9
- function handleError(f, args) {
10
- try {
11
- return f.apply(this, args);
12
- } catch (e) {
13
- const idx = addToExternrefTable0(e);
14
- wasm.__wbindgen_exn_store(idx);
15
- }
16
- }
17
-
18
- function getFromExternrefTable0(idx) { return wasm.__wbindgen_export_2.get(idx); }
19
-
20
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
21
-
22
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
3
+ let WASM_VECTOR_LEN = 0;
23
4
 
24
5
  let cachedUint8ArrayMemory0 = null;
25
6
 
@@ -30,26 +11,6 @@ function getUint8ArrayMemory0() {
30
11
  return cachedUint8ArrayMemory0;
31
12
  }
32
13
 
33
- function getStringFromWasm0(ptr, len) {
34
- ptr = ptr >>> 0;
35
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
36
- }
37
-
38
- function getCachedStringFromWasm0(ptr, len) {
39
- if (ptr === 0) {
40
- return getFromExternrefTable0(len);
41
- } else {
42
- return getStringFromWasm0(ptr, len);
43
- }
44
- }
45
-
46
- function getArrayU8FromWasm0(ptr, len) {
47
- ptr = ptr >>> 0;
48
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
49
- }
50
-
51
- let WASM_VECTOR_LEN = 0;
52
-
53
14
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
54
15
 
55
16
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -113,6 +74,45 @@ function getDataViewMemory0() {
113
74
  return cachedDataViewMemory0;
114
75
  }
115
76
 
77
+ function addToExternrefTable0(obj) {
78
+ const idx = wasm.__externref_table_alloc();
79
+ wasm.__wbindgen_export_4.set(idx, obj);
80
+ return idx;
81
+ }
82
+
83
+ function handleError(f, args) {
84
+ try {
85
+ return f.apply(this, args);
86
+ } catch (e) {
87
+ const idx = addToExternrefTable0(e);
88
+ wasm.__wbindgen_exn_store(idx);
89
+ }
90
+ }
91
+
92
+ function getFromExternrefTable0(idx) { return wasm.__wbindgen_export_4.get(idx); }
93
+
94
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
95
+
96
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
97
+
98
+ function getStringFromWasm0(ptr, len) {
99
+ ptr = ptr >>> 0;
100
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
101
+ }
102
+
103
+ function getCachedStringFromWasm0(ptr, len) {
104
+ if (ptr === 0) {
105
+ return getFromExternrefTable0(len);
106
+ } else {
107
+ return getStringFromWasm0(ptr, len);
108
+ }
109
+ }
110
+
111
+ function getArrayU8FromWasm0(ptr, len) {
112
+ ptr = ptr >>> 0;
113
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
114
+ }
115
+
116
116
  function isLikeNone(x) {
117
117
  return x === undefined || x === null;
118
118
  }
@@ -214,7 +214,7 @@ function debugString(val) {
214
214
  }
215
215
 
216
216
  function takeFromExternrefTable0(idx) {
217
- const value = wasm.__wbindgen_export_2.get(idx);
217
+ const value = wasm.__wbindgen_export_4.get(idx);
218
218
  wasm.__externref_table_dealloc(idx);
219
219
  return value;
220
220
  }
@@ -310,12 +310,43 @@ export function parse(s, opts) {
310
310
  return ret;
311
311
  }
312
312
 
313
+ function passArray8ToWasm0(arg, malloc) {
314
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
315
+ getUint8ArrayMemory0().set(arg, ptr / 1);
316
+ WASM_VECTOR_LEN = arg.length;
317
+ return ptr;
318
+ }
319
+ /**
320
+ * @param {Uint8Array} content
321
+ * @param {string} template_path
322
+ * @param {string} next_package_dir_path
323
+ * @param {any} replacements
324
+ * @param {any} injections
325
+ * @param {any} imports
326
+ * @returns {string}
327
+ */
328
+ export function expandNextJsTemplate(content, template_path, next_package_dir_path, replacements, injections, imports) {
329
+ const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
330
+ const len0 = WASM_VECTOR_LEN;
331
+ const ptr1 = passStringToWasm0(template_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
332
+ const len1 = WASM_VECTOR_LEN;
333
+ const ptr2 = passStringToWasm0(next_package_dir_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
334
+ const len2 = WASM_VECTOR_LEN;
335
+ const ret = wasm.expandNextJsTemplate(ptr0, len0, ptr1, len1, ptr2, len2, replacements, injections, imports);
336
+ if (ret[3]) {
337
+ throw takeFromExternrefTable0(ret[2]);
338
+ }
339
+ var v4 = getCachedStringFromWasm0(ret[0], ret[1]);
340
+ if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
341
+ return v4;
342
+ }
343
+
313
344
  function __wbg_adapter_50(arg0, arg1, arg2) {
314
- wasm.closure1137_externref_shim(arg0, arg1, arg2);
345
+ wasm.closure1130_externref_shim(arg0, arg1, arg2);
315
346
  }
316
347
 
317
348
  function __wbg_adapter_101(arg0, arg1, arg2, arg3) {
318
- wasm.closure124_externref_shim(arg0, arg1, arg2, arg3);
349
+ wasm.closure123_externref_shim(arg0, arg1, arg2, arg3);
319
350
  }
320
351
 
321
352
  async function __wbg_load(module, imports) {
@@ -352,6 +383,13 @@ async function __wbg_load(module, imports) {
352
383
  function __wbg_get_imports() {
353
384
  const imports = {};
354
385
  imports.wbg = {};
386
+ imports.wbg.__wbg_String_fed4d24b68977888 = function(arg0, arg1) {
387
+ const ret = String(arg1);
388
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
389
+ const len1 = WASM_VECTOR_LEN;
390
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
391
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
392
+ };
355
393
  imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
356
394
  const ret = arg0.buffer;
357
395
  return ret;
@@ -574,8 +612,8 @@ function __wbg_get_imports() {
574
612
  const ret = false;
575
613
  return ret;
576
614
  };
577
- imports.wbg.__wbindgen_closure_wrapper23772 = function(arg0, arg1, arg2) {
578
- const ret = makeMutClosure(arg0, arg1, 1138, __wbg_adapter_50);
615
+ imports.wbg.__wbindgen_closure_wrapper23819 = function(arg0, arg1, arg2) {
616
+ const ret = makeMutClosure(arg0, arg1, 1131, __wbg_adapter_50);
579
617
  return ret;
580
618
  };
581
619
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
@@ -594,7 +632,7 @@ function __wbg_get_imports() {
594
632
  return ret;
595
633
  };
596
634
  imports.wbg.__wbindgen_init_externref_table = function() {
597
- const table = wasm.__wbindgen_export_2;
635
+ const table = wasm.__wbindgen_export_4;
598
636
  const offset = table.grow(4);
599
637
  table.set(0, undefined);
600
638
  table.set(offset + 0, undefined);
package/wasm_bg.wasm CHANGED
Binary file