@ferscloud/fers-calculation 0.1.69 → 0.1.70
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/fers_calculations.js +134 -6
- package/fers_calculations_bg.wasm +0 -0
- package/package.json +1 -7
- package/fers_calculations_bg.js +0 -130
package/fers_calculations.js
CHANGED
|
@@ -1,9 +1,137 @@
|
|
|
1
1
|
/* @ts-self-types="./fers_calculations.d.ts" */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} json_data
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
function calculate_from_json(json_data) {
|
|
8
|
+
let deferred2_0;
|
|
9
|
+
let deferred2_1;
|
|
10
|
+
try {
|
|
11
|
+
const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12
|
+
const len0 = WASM_VECTOR_LEN;
|
|
13
|
+
const ret = wasm.calculate_from_json(ptr0, len0);
|
|
14
|
+
deferred2_0 = ret[0];
|
|
15
|
+
deferred2_1 = ret[1];
|
|
16
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
17
|
+
} finally {
|
|
18
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.calculate_from_json = calculate_from_json;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} path
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
function load_fers_from_file(path) {
|
|
28
|
+
let deferred2_0;
|
|
29
|
+
let deferred2_1;
|
|
30
|
+
try {
|
|
31
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
32
|
+
const len0 = WASM_VECTOR_LEN;
|
|
33
|
+
const ret = wasm.load_fers_from_file(ptr0, len0);
|
|
34
|
+
deferred2_0 = ret[0];
|
|
35
|
+
deferred2_1 = ret[1];
|
|
36
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
37
|
+
} finally {
|
|
38
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.load_fers_from_file = load_fers_from_file;
|
|
42
|
+
|
|
43
|
+
function __wbg_get_imports() {
|
|
44
|
+
const import0 = {
|
|
45
|
+
__proto__: null,
|
|
46
|
+
__wbindgen_init_externref_table: function() {
|
|
47
|
+
const table = wasm.__wbindgen_externrefs;
|
|
48
|
+
const offset = table.grow(4);
|
|
49
|
+
table.set(0, undefined);
|
|
50
|
+
table.set(offset + 0, undefined);
|
|
51
|
+
table.set(offset + 1, null);
|
|
52
|
+
table.set(offset + 2, true);
|
|
53
|
+
table.set(offset + 3, false);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
__proto__: null,
|
|
58
|
+
"./fers_calculations_bg.js": import0,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getStringFromWasm0(ptr, len) {
|
|
63
|
+
ptr = ptr >>> 0;
|
|
64
|
+
return decodeText(ptr, len);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let cachedUint8ArrayMemory0 = null;
|
|
68
|
+
function getUint8ArrayMemory0() {
|
|
69
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
70
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
71
|
+
}
|
|
72
|
+
return cachedUint8ArrayMemory0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
76
|
+
if (realloc === undefined) {
|
|
77
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
78
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
79
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
80
|
+
WASM_VECTOR_LEN = buf.length;
|
|
81
|
+
return ptr;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let len = arg.length;
|
|
85
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
86
|
+
|
|
87
|
+
const mem = getUint8ArrayMemory0();
|
|
88
|
+
|
|
89
|
+
let offset = 0;
|
|
90
|
+
|
|
91
|
+
for (; offset < len; offset++) {
|
|
92
|
+
const code = arg.charCodeAt(offset);
|
|
93
|
+
if (code > 0x7F) break;
|
|
94
|
+
mem[ptr + offset] = code;
|
|
95
|
+
}
|
|
96
|
+
if (offset !== len) {
|
|
97
|
+
if (offset !== 0) {
|
|
98
|
+
arg = arg.slice(offset);
|
|
99
|
+
}
|
|
100
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
101
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
102
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
103
|
+
|
|
104
|
+
offset += ret.written;
|
|
105
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
WASM_VECTOR_LEN = offset;
|
|
109
|
+
return ptr;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
113
|
+
cachedTextDecoder.decode();
|
|
114
|
+
function decodeText(ptr, len) {
|
|
115
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const cachedTextEncoder = new TextEncoder();
|
|
119
|
+
|
|
120
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
121
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
122
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
123
|
+
view.set(buf);
|
|
124
|
+
return {
|
|
125
|
+
read: arg.length,
|
|
126
|
+
written: buf.length
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let WASM_VECTOR_LEN = 0;
|
|
132
|
+
|
|
133
|
+
const wasmPath = `${__dirname}/fers_calculations_bg.wasm`;
|
|
134
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
135
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
136
|
+
const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
6
137
|
wasm.__wbindgen_start();
|
|
7
|
-
export {
|
|
8
|
-
calculate_from_json, load_fers_from_file
|
|
9
|
-
} from "./fers_calculations_bg.js";
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ferscloud/fers-calculation",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.1.69",
|
|
3
|
+
"version": "0.1.70",
|
|
5
4
|
"files": [
|
|
6
5
|
"fers_calculations_bg.wasm",
|
|
7
6
|
"fers_calculations.js",
|
|
8
|
-
"fers_calculations_bg.js",
|
|
9
7
|
"fers_calculations.d.ts"
|
|
10
8
|
],
|
|
11
9
|
"main": "fers_calculations.js",
|
|
12
10
|
"types": "fers_calculations.d.ts",
|
|
13
|
-
"sideEffects": [
|
|
14
|
-
"./fers_calculations.js",
|
|
15
|
-
"./snippets/*"
|
|
16
|
-
],
|
|
17
11
|
"publishConfig": {
|
|
18
12
|
"access": "public"
|
|
19
13
|
},
|
package/fers_calculations_bg.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {string} json_data
|
|
3
|
-
* @returns {string}
|
|
4
|
-
*/
|
|
5
|
-
export function calculate_from_json(json_data) {
|
|
6
|
-
let deferred2_0;
|
|
7
|
-
let deferred2_1;
|
|
8
|
-
try {
|
|
9
|
-
const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
10
|
-
const len0 = WASM_VECTOR_LEN;
|
|
11
|
-
const ret = wasm.calculate_from_json(ptr0, len0);
|
|
12
|
-
deferred2_0 = ret[0];
|
|
13
|
-
deferred2_1 = ret[1];
|
|
14
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
15
|
-
} finally {
|
|
16
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {string} path
|
|
22
|
-
* @returns {string}
|
|
23
|
-
*/
|
|
24
|
-
export function load_fers_from_file(path) {
|
|
25
|
-
let deferred2_0;
|
|
26
|
-
let deferred2_1;
|
|
27
|
-
try {
|
|
28
|
-
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29
|
-
const len0 = WASM_VECTOR_LEN;
|
|
30
|
-
const ret = wasm.load_fers_from_file(ptr0, len0);
|
|
31
|
-
deferred2_0 = ret[0];
|
|
32
|
-
deferred2_1 = ret[1];
|
|
33
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
34
|
-
} finally {
|
|
35
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export function __wbindgen_init_externref_table() {
|
|
39
|
-
const table = wasm.__wbindgen_externrefs;
|
|
40
|
-
const offset = table.grow(4);
|
|
41
|
-
table.set(0, undefined);
|
|
42
|
-
table.set(offset + 0, undefined);
|
|
43
|
-
table.set(offset + 1, null);
|
|
44
|
-
table.set(offset + 2, true);
|
|
45
|
-
table.set(offset + 3, false);
|
|
46
|
-
}
|
|
47
|
-
function getStringFromWasm0(ptr, len) {
|
|
48
|
-
ptr = ptr >>> 0;
|
|
49
|
-
return decodeText(ptr, len);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let cachedUint8ArrayMemory0 = null;
|
|
53
|
-
function getUint8ArrayMemory0() {
|
|
54
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
55
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
56
|
-
}
|
|
57
|
-
return cachedUint8ArrayMemory0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
61
|
-
if (realloc === undefined) {
|
|
62
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
63
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
64
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
65
|
-
WASM_VECTOR_LEN = buf.length;
|
|
66
|
-
return ptr;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
let len = arg.length;
|
|
70
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
71
|
-
|
|
72
|
-
const mem = getUint8ArrayMemory0();
|
|
73
|
-
|
|
74
|
-
let offset = 0;
|
|
75
|
-
|
|
76
|
-
for (; offset < len; offset++) {
|
|
77
|
-
const code = arg.charCodeAt(offset);
|
|
78
|
-
if (code > 0x7F) break;
|
|
79
|
-
mem[ptr + offset] = code;
|
|
80
|
-
}
|
|
81
|
-
if (offset !== len) {
|
|
82
|
-
if (offset !== 0) {
|
|
83
|
-
arg = arg.slice(offset);
|
|
84
|
-
}
|
|
85
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
86
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
87
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
88
|
-
|
|
89
|
-
offset += ret.written;
|
|
90
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
WASM_VECTOR_LEN = offset;
|
|
94
|
-
return ptr;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
98
|
-
cachedTextDecoder.decode();
|
|
99
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
100
|
-
let numBytesDecoded = 0;
|
|
101
|
-
function decodeText(ptr, len) {
|
|
102
|
-
numBytesDecoded += len;
|
|
103
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
104
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
105
|
-
cachedTextDecoder.decode();
|
|
106
|
-
numBytesDecoded = len;
|
|
107
|
-
}
|
|
108
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const cachedTextEncoder = new TextEncoder();
|
|
112
|
-
|
|
113
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
114
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
115
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
116
|
-
view.set(buf);
|
|
117
|
-
return {
|
|
118
|
-
read: arg.length,
|
|
119
|
-
written: buf.length
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
let WASM_VECTOR_LEN = 0;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
let wasm;
|
|
128
|
-
export function __wbg_set_wasm(val) {
|
|
129
|
-
wasm = val;
|
|
130
|
-
}
|