plantuml-rs 0.5.4 → 0.5.6

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.
@@ -17,7 +17,7 @@ function render(source) {
17
17
  let deferred3_0;
18
18
  let deferred3_1;
19
19
  try {
20
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
20
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
21
21
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
22
22
  const len0 = WASM_VECTOR_LEN;
23
23
  wasm.render(retptr, ptr0, len0);
@@ -29,7 +29,7 @@ function render(source) {
29
29
  var len2 = r1;
30
30
  if (r3) {
31
31
  ptr2 = 0; len2 = 0;
32
- throw takeObject(r2);
32
+ throw takeFromExternrefTable0(r2);
33
33
  }
34
34
  deferred3_0 = ptr2;
35
35
  deferred3_1 = len2;
@@ -43,35 +43,40 @@ exports.render = render;
43
43
  function __wbg_get_imports() {
44
44
  const import0 = {
45
45
  __proto__: null,
46
- __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
46
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
47
47
  const ret = Error(getStringFromWasm0(arg0, arg1));
48
- return addHeapObject(ret);
48
+ return ret;
49
49
  },
50
- __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
50
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
51
51
  throw new Error(getStringFromWasm0(arg0, arg1));
52
52
  },
53
- __wbg_debug_52bda05ddf50b736: function(arg0) {
54
- console.debug(getObject(arg0));
53
+ __wbg_debug_29e5044b8c3730bb: function(arg0) {
54
+ console.debug(arg0);
55
55
  },
56
- __wbg_error_c9cf3fc2064683a9: function(arg0) {
57
- console.error(getObject(arg0));
56
+ __wbg_error_d1fc0193610e0e39: function(arg0) {
57
+ console.error(arg0);
58
58
  },
59
- __wbg_info_26925f73a2eee895: function(arg0) {
60
- console.info(getObject(arg0));
59
+ __wbg_info_ef9e889444913d2f: function(arg0) {
60
+ console.info(arg0);
61
61
  },
62
- __wbg_log_17c30ef363c61cf4: function(arg0) {
63
- console.log(getObject(arg0));
62
+ __wbg_log_ff86bbb34c295e21: function(arg0) {
63
+ console.log(arg0);
64
64
  },
65
- __wbg_warn_13abc63e0d4b3527: function(arg0) {
66
- console.warn(getObject(arg0));
65
+ __wbg_warn_228ff2257384d295: function(arg0) {
66
+ console.warn(arg0);
67
67
  },
68
68
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
69
69
  // Cast intrinsic for `Ref(String) -> Externref`.
70
70
  const ret = getStringFromWasm0(arg0, arg1);
71
- return addHeapObject(ret);
71
+ return ret;
72
72
  },
73
- __wbindgen_object_drop_ref: function(arg0) {
74
- takeObject(arg0);
73
+ __wbindgen_init_externref_table: function() {
74
+ const table = wasm.__wbindgen_externrefs;
75
+ table.set(0, undefined);
76
+ table.set(1024, undefined);
77
+ table.set(1025, null);
78
+ table.set(1026, true);
79
+ table.set(1027, false);
75
80
  },
76
81
  };
77
82
  return {
@@ -80,21 +85,6 @@ function __wbg_get_imports() {
80
85
  };
81
86
  }
82
87
 
83
- function addHeapObject(obj) {
84
- if (heap_next === heap.length) heap.push(heap.length + 1);
85
- const idx = heap_next;
86
- heap_next = heap[idx];
87
-
88
- heap[idx] = obj;
89
- return idx;
90
- }
91
-
92
- function dropObject(idx) {
93
- if (idx < 1028) return;
94
- heap[idx] = heap_next;
95
- heap_next = idx;
96
- }
97
-
98
88
  let cachedDataViewMemory0 = null;
99
89
  function getDataViewMemory0() {
100
90
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -104,7 +94,8 @@ function getDataViewMemory0() {
104
94
  }
105
95
 
106
96
  function getStringFromWasm0(ptr, len) {
107
- return decodeText(ptr >>> 0, len);
97
+ ptr = ptr >>> 0;
98
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
108
99
  }
109
100
 
110
101
  let cachedUint8ArrayMemory0 = null;
@@ -115,13 +106,6 @@ function getUint8ArrayMemory0() {
115
106
  return cachedUint8ArrayMemory0;
116
107
  }
117
108
 
118
- function getObject(idx) { return heap[idx]; }
119
-
120
- let heap = new Array(1024).fill(undefined);
121
- heap.push(undefined, null, true, false);
122
-
123
- let heap_next = heap.length;
124
-
125
109
  function passStringToWasm0(arg, malloc, realloc) {
126
110
  if (realloc === undefined) {
127
111
  const buf = cachedTextEncoder.encode(arg);
@@ -159,16 +143,16 @@ function passStringToWasm0(arg, malloc, realloc) {
159
143
  return ptr;
160
144
  }
161
145
 
162
- function takeObject(idx) {
163
- const ret = getObject(idx);
164
- dropObject(idx);
165
- return ret;
146
+ function takeFromExternrefTable0(idx) {
147
+ const value = wasm.__wbindgen_externrefs.get(idx);
148
+ wasm.__wbindgen_export4(idx);
149
+ return value;
166
150
  }
167
151
 
168
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
152
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
169
153
  cachedTextDecoder.decode();
170
- function decodeText(ptr, len) {
171
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
154
+ function decodeText(bytes) {
155
+ return cachedTextDecoder.decode(bytes);
172
156
  }
173
157
 
174
158
  const cachedTextEncoder = new TextEncoder();
@@ -191,3 +175,4 @@ const wasmBytes = require('fs').readFileSync(wasmPath);
191
175
  const wasmModule = new WebAssembly.Module(wasmBytes);
192
176
  let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
193
177
  let wasm = wasmInstance.exports;
178
+ wasm.__wbindgen_start();
Binary file
@@ -3,7 +3,10 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const init_logging: () => void;
5
5
  export const render: (a: number, b: number, c: number) => void;
6
+ export const __wbindgen_externrefs: WebAssembly.Table;
6
7
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
7
8
  export const __wbindgen_export: (a: number, b: number) => number;
8
9
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
9
10
  export const __wbindgen_export3: (a: number, b: number, c: number) => void;
11
+ export const __wbindgen_export4: (a: number) => void;
12
+ export const __wbindgen_start: () => void;
@@ -17,10 +17,13 @@ export interface InitOutput {
17
17
  readonly memory: WebAssembly.Memory;
18
18
  readonly init_logging: () => void;
19
19
  readonly render: (a: number, b: number, c: number) => void;
20
+ readonly __wbindgen_externrefs: WebAssembly.Table;
20
21
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
21
22
  readonly __wbindgen_export: (a: number, b: number) => number;
22
23
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
23
24
  readonly __wbindgen_export3: (a: number, b: number, c: number) => void;
25
+ readonly __wbindgen_export4: (a: number) => void;
26
+ readonly __wbindgen_start: () => void;
24
27
  }
25
28
 
26
29
  export type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -16,7 +16,7 @@ export function render(source) {
16
16
  let deferred3_0;
17
17
  let deferred3_1;
18
18
  try {
19
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
19
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
20
20
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
21
21
  const len0 = WASM_VECTOR_LEN;
22
22
  wasm.render(retptr, ptr0, len0);
@@ -28,7 +28,7 @@ export function render(source) {
28
28
  var len2 = r1;
29
29
  if (r3) {
30
30
  ptr2 = 0; len2 = 0;
31
- throw takeObject(r2);
31
+ throw takeFromExternrefTable0(r2);
32
32
  }
33
33
  deferred3_0 = ptr2;
34
34
  deferred3_1 = len2;
@@ -41,35 +41,40 @@ export function render(source) {
41
41
  function __wbg_get_imports() {
42
42
  const import0 = {
43
43
  __proto__: null,
44
- __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
44
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
45
45
  const ret = Error(getStringFromWasm0(arg0, arg1));
46
- return addHeapObject(ret);
46
+ return ret;
47
47
  },
48
- __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
48
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
49
49
  throw new Error(getStringFromWasm0(arg0, arg1));
50
50
  },
51
- __wbg_debug_52bda05ddf50b736: function(arg0) {
52
- console.debug(getObject(arg0));
51
+ __wbg_debug_29e5044b8c3730bb: function(arg0) {
52
+ console.debug(arg0);
53
53
  },
54
- __wbg_error_c9cf3fc2064683a9: function(arg0) {
55
- console.error(getObject(arg0));
54
+ __wbg_error_d1fc0193610e0e39: function(arg0) {
55
+ console.error(arg0);
56
56
  },
57
- __wbg_info_26925f73a2eee895: function(arg0) {
58
- console.info(getObject(arg0));
57
+ __wbg_info_ef9e889444913d2f: function(arg0) {
58
+ console.info(arg0);
59
59
  },
60
- __wbg_log_17c30ef363c61cf4: function(arg0) {
61
- console.log(getObject(arg0));
60
+ __wbg_log_ff86bbb34c295e21: function(arg0) {
61
+ console.log(arg0);
62
62
  },
63
- __wbg_warn_13abc63e0d4b3527: function(arg0) {
64
- console.warn(getObject(arg0));
63
+ __wbg_warn_228ff2257384d295: function(arg0) {
64
+ console.warn(arg0);
65
65
  },
66
66
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
67
67
  // Cast intrinsic for `Ref(String) -> Externref`.
68
68
  const ret = getStringFromWasm0(arg0, arg1);
69
- return addHeapObject(ret);
69
+ return ret;
70
70
  },
71
- __wbindgen_object_drop_ref: function(arg0) {
72
- takeObject(arg0);
71
+ __wbindgen_init_externref_table: function() {
72
+ const table = wasm.__wbindgen_externrefs;
73
+ table.set(0, undefined);
74
+ table.set(1024, undefined);
75
+ table.set(1025, null);
76
+ table.set(1026, true);
77
+ table.set(1027, false);
73
78
  },
74
79
  };
75
80
  return {
@@ -78,21 +83,6 @@ function __wbg_get_imports() {
78
83
  };
79
84
  }
80
85
 
81
- function addHeapObject(obj) {
82
- if (heap_next === heap.length) heap.push(heap.length + 1);
83
- const idx = heap_next;
84
- heap_next = heap[idx];
85
-
86
- heap[idx] = obj;
87
- return idx;
88
- }
89
-
90
- function dropObject(idx) {
91
- if (idx < 1028) return;
92
- heap[idx] = heap_next;
93
- heap_next = idx;
94
- }
95
-
96
86
  let cachedDataViewMemory0 = null;
97
87
  function getDataViewMemory0() {
98
88
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -102,7 +92,8 @@ function getDataViewMemory0() {
102
92
  }
103
93
 
104
94
  function getStringFromWasm0(ptr, len) {
105
- return decodeText(ptr >>> 0, len);
95
+ ptr = ptr >>> 0;
96
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
106
97
  }
107
98
 
108
99
  let cachedUint8ArrayMemory0 = null;
@@ -113,13 +104,6 @@ function getUint8ArrayMemory0() {
113
104
  return cachedUint8ArrayMemory0;
114
105
  }
115
106
 
116
- function getObject(idx) { return heap[idx]; }
117
-
118
- let heap = new Array(1024).fill(undefined);
119
- heap.push(undefined, null, true, false);
120
-
121
- let heap_next = heap.length;
122
-
123
107
  function passStringToWasm0(arg, malloc, realloc) {
124
108
  if (realloc === undefined) {
125
109
  const buf = cachedTextEncoder.encode(arg);
@@ -157,24 +141,24 @@ function passStringToWasm0(arg, malloc, realloc) {
157
141
  return ptr;
158
142
  }
159
143
 
160
- function takeObject(idx) {
161
- const ret = getObject(idx);
162
- dropObject(idx);
163
- return ret;
144
+ function takeFromExternrefTable0(idx) {
145
+ const value = wasm.__wbindgen_externrefs.get(idx);
146
+ wasm.__wbindgen_export4(idx);
147
+ return value;
164
148
  }
165
149
 
166
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
150
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
167
151
  cachedTextDecoder.decode();
168
152
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
169
153
  let numBytesDecoded = 0;
170
- function decodeText(ptr, len) {
171
- numBytesDecoded += len;
154
+ function decodeText(bytes) {
155
+ numBytesDecoded += bytes.length;
172
156
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
173
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
157
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
174
158
  cachedTextDecoder.decode();
175
- numBytesDecoded = len;
159
+ numBytesDecoded = bytes.length;
176
160
  }
177
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
161
+ return cachedTextDecoder.decode(bytes);
178
162
  }
179
163
 
180
164
  const cachedTextEncoder = new TextEncoder();
@@ -199,6 +183,7 @@ function __wbg_finalize_init(instance, module) {
199
183
  wasmModule = module;
200
184
  cachedDataViewMemory0 = null;
201
185
  cachedUint8ArrayMemory0 = null;
186
+ wasm.__wbindgen_start();
202
187
  return wasm;
203
188
  }
204
189
 
@@ -261,9 +246,17 @@ function initSync(module) {
261
246
  return __wbg_finalize_init(instance, module);
262
247
  }
263
248
 
249
+ let __wbg_init_promise;
264
250
  async function __wbg_init(module_or_path) {
265
251
  if (wasm !== undefined) return wasm;
252
+ if (__wbg_init_promise === undefined) {
253
+ __wbg_init_promise = __wbg_init_once(module_or_path);
254
+ __wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
255
+ }
256
+ return __wbg_init_promise;
257
+ }
266
258
 
259
+ async function __wbg_init_once(module_or_path) {
267
260
 
268
261
  if (module_or_path !== undefined) {
269
262
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
Binary file
@@ -3,7 +3,10 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const init_logging: () => void;
5
5
  export const render: (a: number, b: number, c: number) => void;
6
+ export const __wbindgen_externrefs: WebAssembly.Table;
6
7
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
7
8
  export const __wbindgen_export: (a: number, b: number) => number;
8
9
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
9
10
  export const __wbindgen_export3: (a: number, b: number, c: number) => void;
11
+ export const __wbindgen_export4: (a: number) => void;
12
+ export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plantuml-rs",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "PlantUML renderer in WebAssembly: deterministic SVG from text, no Java, no Graphviz, no network",
5
5
  "license": "MIT",
6
6
  "repository": {