@openbim/ifcx 0.1.0 → 0.2.1
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/README.md +98 -10
- package/bundler/fetch-imports.d.ts +53 -0
- package/bundler/fetch-imports.js +137 -0
- package/bundler/openbim_ifcx_wasm.d.ts +139 -0
- package/bundler/openbim_ifcx_wasm.js +10 -0
- package/bundler/openbim_ifcx_wasm_bg.js +481 -0
- package/bundler/openbim_ifcx_wasm_bg.wasm +0 -0
- package/bundler/openbim_ifcx_wasm_bg.wasm.d.ts +18 -0
- package/bundler/package.json +3 -0
- package/fetch-imports.d.ts +53 -0
- package/fetch-imports.js +139 -0
- package/openbim_ifcx_wasm.d.ts +3 -1
- package/openbim_ifcx_wasm.js +1 -0
- package/openbim_ifcx_wasm_bg.wasm +0 -0
- package/package.json +29 -3
- package/web/fetch-imports.d.ts +53 -0
- package/web/fetch-imports.js +137 -0
- package/web/openbim_ifcx_wasm.d.ts +182 -0
- package/web/openbim_ifcx_wasm.js +585 -0
- package/web/openbim_ifcx_wasm_bg.wasm +0 -0
- package/web/openbim_ifcx_wasm_bg.wasm.d.ts +18 -0
- package/web/package.json +3 -0
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
/* @ts-self-types="./openbim_ifcx_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One IFCX file. Writing it back is lossless: key order, unknown fields,
|
|
5
|
+
* `null` deletions and every number stay as read.
|
|
6
|
+
*
|
|
7
|
+
* A newtype because `wasm_bindgen` can only export a type defined in this
|
|
8
|
+
* crate; all state and behaviour are the core's.
|
|
9
|
+
*/
|
|
10
|
+
export class IfcxFile {
|
|
11
|
+
static __wrap(ptr) {
|
|
12
|
+
const obj = Object.create(IfcxFile.prototype);
|
|
13
|
+
obj.__wbg_ptr = ptr;
|
|
14
|
+
IfcxFileFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
__destroy_into_raw() {
|
|
18
|
+
const ptr = this.__wbg_ptr;
|
|
19
|
+
this.__wbg_ptr = 0;
|
|
20
|
+
IfcxFileFinalization.unregister(this);
|
|
21
|
+
return ptr;
|
|
22
|
+
}
|
|
23
|
+
free() {
|
|
24
|
+
const ptr = this.__destroy_into_raw();
|
|
25
|
+
wasm.__wbg_ifcxfile_free(ptr, 0);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The `header` object.
|
|
29
|
+
* @returns {Record<string, unknown>}
|
|
30
|
+
*/
|
|
31
|
+
get header() {
|
|
32
|
+
try {
|
|
33
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
34
|
+
wasm.ifcxfile_header(retptr, this.__wbg_ptr);
|
|
35
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
36
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
37
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
38
|
+
if (r2) {
|
|
39
|
+
throw takeObject(r1);
|
|
40
|
+
}
|
|
41
|
+
return takeObject(r0);
|
|
42
|
+
} finally {
|
|
43
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Number of entries in `data`; several may share a path.
|
|
48
|
+
* @returns {number}
|
|
49
|
+
*/
|
|
50
|
+
get nodeCount() {
|
|
51
|
+
const ret = wasm.ifcxfile_nodeCount(this.__wbg_ptr);
|
|
52
|
+
return ret >>> 0;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Read an IFCX file from its JSON text or UTF-8 bytes.
|
|
56
|
+
* @param {IfcxInput} input
|
|
57
|
+
* @returns {IfcxFile}
|
|
58
|
+
*/
|
|
59
|
+
static parse(input) {
|
|
60
|
+
try {
|
|
61
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
62
|
+
wasm.ifcxfile_parse(retptr, addBorrowedObject(input));
|
|
63
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
64
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
65
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
66
|
+
if (r2) {
|
|
67
|
+
throw takeObject(r1);
|
|
68
|
+
}
|
|
69
|
+
return IfcxFile.__wrap(r0);
|
|
70
|
+
} finally {
|
|
71
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
72
|
+
heap[stack_pointer++] = undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The file as a plain object, so `JSON.stringify(file)` works. Unlike
|
|
77
|
+
* `write`, a plain object may reorder integer-like keys and round
|
|
78
|
+
* integers beyond 2^53.
|
|
79
|
+
* @returns {Record<string, unknown>}
|
|
80
|
+
*/
|
|
81
|
+
toJSON() {
|
|
82
|
+
try {
|
|
83
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
84
|
+
wasm.ifcxfile_toJSON(retptr, this.__wbg_ptr);
|
|
85
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
86
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
87
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
88
|
+
if (r2) {
|
|
89
|
+
throw takeObject(r1);
|
|
90
|
+
}
|
|
91
|
+
return takeObject(r0);
|
|
92
|
+
} finally {
|
|
93
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check every attribute against this file's own `schemas`. Imports are
|
|
98
|
+
* not resolved; use the `validate` function to include them.
|
|
99
|
+
* @returns {ValidationReport}
|
|
100
|
+
*/
|
|
101
|
+
validate() {
|
|
102
|
+
try {
|
|
103
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
104
|
+
wasm.ifcxfile_validate(retptr, this.__wbg_ptr);
|
|
105
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
106
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
107
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
108
|
+
if (r2) {
|
|
109
|
+
throw takeObject(r1);
|
|
110
|
+
}
|
|
111
|
+
return takeObject(r0);
|
|
112
|
+
} finally {
|
|
113
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The file as JSON text; `pretty` indents it by two spaces.
|
|
118
|
+
* @param {boolean | null} [pretty]
|
|
119
|
+
* @returns {string}
|
|
120
|
+
*/
|
|
121
|
+
write(pretty) {
|
|
122
|
+
let deferred2_0;
|
|
123
|
+
let deferred2_1;
|
|
124
|
+
try {
|
|
125
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
126
|
+
wasm.ifcxfile_write(retptr, this.__wbg_ptr, isLikeNone(pretty) ? 0xFFFFFF : pretty ? 1 : 0);
|
|
127
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
128
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
129
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
130
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
131
|
+
var ptr1 = r0;
|
|
132
|
+
var len1 = r1;
|
|
133
|
+
if (r3) {
|
|
134
|
+
ptr1 = 0; len1 = 0;
|
|
135
|
+
throw takeObject(r2);
|
|
136
|
+
}
|
|
137
|
+
deferred2_0 = ptr1;
|
|
138
|
+
deferred2_1 = len1;
|
|
139
|
+
return getStringFromWasm0(ptr1, len1);
|
|
140
|
+
} finally {
|
|
141
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
142
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (Symbol.dispose) IfcxFile.prototype[Symbol.dispose] = IfcxFile.prototype.free;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Compose layers, weakest first, into a tree of plain objects: the
|
|
150
|
+
* artificial root (path `""`) over every root node. Declared for
|
|
151
|
+
* TypeScript in `TYPES`, where `options` can be optional.
|
|
152
|
+
* @param {any} layers
|
|
153
|
+
* @param {any | null} [options]
|
|
154
|
+
* @returns {any}
|
|
155
|
+
*/
|
|
156
|
+
export function compose(layers, options) {
|
|
157
|
+
try {
|
|
158
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
159
|
+
wasm.compose(retptr, addBorrowedObject(layers), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
160
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
161
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
162
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
163
|
+
if (r2) {
|
|
164
|
+
throw takeObject(r1);
|
|
165
|
+
}
|
|
166
|
+
return takeObject(r0);
|
|
167
|
+
} finally {
|
|
168
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
169
|
+
heap[stack_pointer++] = undefined;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Compose layers, weakest first, and write their render scene as GLB
|
|
175
|
+
* bytes. Declared for TypeScript in `TYPES`.
|
|
176
|
+
* @param {any} layers
|
|
177
|
+
* @param {any | null} [options]
|
|
178
|
+
* @returns {Uint8Array}
|
|
179
|
+
*/
|
|
180
|
+
export function exportGlb(layers, options) {
|
|
181
|
+
try {
|
|
182
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
183
|
+
wasm.exportGlb(retptr, addBorrowedObject(layers), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
184
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
185
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
186
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
187
|
+
if (r2) {
|
|
188
|
+
throw takeObject(r1);
|
|
189
|
+
}
|
|
190
|
+
return takeObject(r0);
|
|
191
|
+
} finally {
|
|
192
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
193
|
+
heap[stack_pointer++] = undefined;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Check the attributes of the layers, weakest first, against the schemas
|
|
199
|
+
* of every layer (and of resolved imports), after merging nodes that share
|
|
200
|
+
* a path. Declared for TypeScript in `TYPES`.
|
|
201
|
+
* @param {any} layers
|
|
202
|
+
* @param {any | null} [options]
|
|
203
|
+
* @returns {any}
|
|
204
|
+
*/
|
|
205
|
+
export function validate(layers, options) {
|
|
206
|
+
try {
|
|
207
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
208
|
+
wasm.validate(retptr, addBorrowedObject(layers), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
209
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
210
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
211
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
212
|
+
if (r2) {
|
|
213
|
+
throw takeObject(r1);
|
|
214
|
+
}
|
|
215
|
+
return takeObject(r0);
|
|
216
|
+
} finally {
|
|
217
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
218
|
+
heap[stack_pointer++] = undefined;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function __wbg_get_imports() {
|
|
222
|
+
const import0 = {
|
|
223
|
+
__proto__: null,
|
|
224
|
+
__wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function(arg0) {
|
|
225
|
+
const v = getObject(arg0);
|
|
226
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
227
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
228
|
+
},
|
|
229
|
+
__wbg___wbindgen_is_null_5160b3e381865372: function(arg0) {
|
|
230
|
+
const ret = getObject(arg0) === null;
|
|
231
|
+
return ret;
|
|
232
|
+
},
|
|
233
|
+
__wbg___wbindgen_is_object_edb6b15aa3afe12e: function(arg0) {
|
|
234
|
+
const val = getObject(arg0);
|
|
235
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
236
|
+
return ret;
|
|
237
|
+
},
|
|
238
|
+
__wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
|
|
239
|
+
const ret = getObject(arg0) === undefined;
|
|
240
|
+
return ret;
|
|
241
|
+
},
|
|
242
|
+
__wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
|
|
243
|
+
const obj = getObject(arg1);
|
|
244
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
245
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
246
|
+
var len1 = WASM_VECTOR_LEN;
|
|
247
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
248
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
249
|
+
},
|
|
250
|
+
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
251
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
252
|
+
},
|
|
253
|
+
__wbg_entries_20b9608d57d8ddd6: function(arg0) {
|
|
254
|
+
const ret = getObject(arg0).entries();
|
|
255
|
+
return addHeapObject(ret);
|
|
256
|
+
},
|
|
257
|
+
__wbg_entries_972a87586902cf87: function(arg0) {
|
|
258
|
+
const ret = Object.entries(getObject(arg0));
|
|
259
|
+
return addHeapObject(ret);
|
|
260
|
+
},
|
|
261
|
+
__wbg_from_a39669ce566077da: function(arg0) {
|
|
262
|
+
const ret = Array.from(getObject(arg0));
|
|
263
|
+
return addHeapObject(ret);
|
|
264
|
+
},
|
|
265
|
+
__wbg_get_989d0a1309644f2b: function() { return handleError(function (arg0, arg1) {
|
|
266
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
267
|
+
return addHeapObject(ret);
|
|
268
|
+
}, arguments); },
|
|
269
|
+
__wbg_get_b1f0ab13c737f856: function(arg0, arg1) {
|
|
270
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
271
|
+
return addHeapObject(ret);
|
|
272
|
+
},
|
|
273
|
+
__wbg_get_unchecked_363572bdd397d473: function(arg0, arg1) {
|
|
274
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
275
|
+
return addHeapObject(ret);
|
|
276
|
+
},
|
|
277
|
+
__wbg_instanceof_Map_1ff6a2b54c899f0d: function(arg0) {
|
|
278
|
+
let result;
|
|
279
|
+
try {
|
|
280
|
+
result = getObject(arg0) instanceof Map;
|
|
281
|
+
} catch (_) {
|
|
282
|
+
result = false;
|
|
283
|
+
}
|
|
284
|
+
const ret = result;
|
|
285
|
+
return ret;
|
|
286
|
+
},
|
|
287
|
+
__wbg_instanceof_Uint8Array_598adc0fef426aa8: function(arg0) {
|
|
288
|
+
let result;
|
|
289
|
+
try {
|
|
290
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
291
|
+
} catch (_) {
|
|
292
|
+
result = false;
|
|
293
|
+
}
|
|
294
|
+
const ret = result;
|
|
295
|
+
return ret;
|
|
296
|
+
},
|
|
297
|
+
__wbg_isArray_5674713bb7b79043: function(arg0) {
|
|
298
|
+
const ret = Array.isArray(getObject(arg0));
|
|
299
|
+
return ret;
|
|
300
|
+
},
|
|
301
|
+
__wbg_length_31bdaf014f5fbde2: function(arg0) {
|
|
302
|
+
const ret = getObject(arg0).length;
|
|
303
|
+
return ret;
|
|
304
|
+
},
|
|
305
|
+
__wbg_length_4e1adc0d42e23620: function(arg0) {
|
|
306
|
+
const ret = getObject(arg0).length;
|
|
307
|
+
return ret;
|
|
308
|
+
},
|
|
309
|
+
__wbg_new_a32a1ab6c6655abe: function(arg0, arg1) {
|
|
310
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
311
|
+
return addHeapObject(ret);
|
|
312
|
+
},
|
|
313
|
+
__wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
|
|
314
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
315
|
+
return addHeapObject(ret);
|
|
316
|
+
},
|
|
317
|
+
__wbg_parse_6937a9050adfb0e1: function() { return handleError(function (arg0, arg1) {
|
|
318
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
319
|
+
return addHeapObject(ret);
|
|
320
|
+
}, arguments); },
|
|
321
|
+
__wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
|
|
322
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
323
|
+
},
|
|
324
|
+
__wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
|
|
325
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
326
|
+
return ret;
|
|
327
|
+
}, arguments); },
|
|
328
|
+
__wbg_set_name_6e2a5da46a9ae1e7: function(arg0, arg1, arg2) {
|
|
329
|
+
getObject(arg0).name = getStringFromWasm0(arg1, arg2);
|
|
330
|
+
},
|
|
331
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
332
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
333
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
334
|
+
return addHeapObject(ret);
|
|
335
|
+
},
|
|
336
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
337
|
+
takeObject(arg0);
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
return {
|
|
341
|
+
__proto__: null,
|
|
342
|
+
"./openbim_ifcx_wasm_bg.js": import0,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const IfcxFileFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
347
|
+
? { register: () => {}, unregister: () => {} }
|
|
348
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ifcxfile_free(ptr, 1));
|
|
349
|
+
|
|
350
|
+
function addHeapObject(obj) {
|
|
351
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
352
|
+
const idx = heap_next;
|
|
353
|
+
heap_next = heap[idx];
|
|
354
|
+
|
|
355
|
+
heap[idx] = obj;
|
|
356
|
+
return idx;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function addBorrowedObject(obj) {
|
|
360
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
361
|
+
heap[--stack_pointer] = obj;
|
|
362
|
+
return stack_pointer;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function dropObject(idx) {
|
|
366
|
+
if (idx < 1028) return;
|
|
367
|
+
heap[idx] = heap_next;
|
|
368
|
+
heap_next = idx;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
372
|
+
ptr = ptr >>> 0;
|
|
373
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
let cachedDataViewMemory0 = null;
|
|
377
|
+
function getDataViewMemory0() {
|
|
378
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
379
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
380
|
+
}
|
|
381
|
+
return cachedDataViewMemory0;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function getStringFromWasm0(ptr, len) {
|
|
385
|
+
return decodeText(ptr >>> 0, len);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
let cachedUint8ArrayMemory0 = null;
|
|
389
|
+
function getUint8ArrayMemory0() {
|
|
390
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
391
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
392
|
+
}
|
|
393
|
+
return cachedUint8ArrayMemory0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function getObject(idx) { return heap[idx]; }
|
|
397
|
+
|
|
398
|
+
function handleError(f, args) {
|
|
399
|
+
try {
|
|
400
|
+
return f.apply(this, args);
|
|
401
|
+
} catch (e) {
|
|
402
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
let heap = new Array(1024).fill(undefined);
|
|
407
|
+
heap.push(undefined, null, true, false);
|
|
408
|
+
|
|
409
|
+
let heap_next = heap.length;
|
|
410
|
+
|
|
411
|
+
function isLikeNone(x) {
|
|
412
|
+
return x === undefined || x === null;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
416
|
+
if (realloc === undefined) {
|
|
417
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
418
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
419
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
420
|
+
WASM_VECTOR_LEN = buf.length;
|
|
421
|
+
return ptr;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
let len = arg.length;
|
|
425
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
426
|
+
|
|
427
|
+
const mem = getUint8ArrayMemory0();
|
|
428
|
+
|
|
429
|
+
let offset = 0;
|
|
430
|
+
|
|
431
|
+
for (; offset < len; offset++) {
|
|
432
|
+
const code = arg.charCodeAt(offset);
|
|
433
|
+
if (code > 0x7F) break;
|
|
434
|
+
mem[ptr + offset] = code;
|
|
435
|
+
}
|
|
436
|
+
if (offset !== len) {
|
|
437
|
+
if (offset !== 0) {
|
|
438
|
+
arg = arg.slice(offset);
|
|
439
|
+
}
|
|
440
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
441
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
442
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
443
|
+
|
|
444
|
+
offset += ret.written;
|
|
445
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
WASM_VECTOR_LEN = offset;
|
|
449
|
+
return ptr;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
let stack_pointer = 1024;
|
|
453
|
+
|
|
454
|
+
function takeObject(idx) {
|
|
455
|
+
const ret = getObject(idx);
|
|
456
|
+
dropObject(idx);
|
|
457
|
+
return ret;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
461
|
+
cachedTextDecoder.decode();
|
|
462
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
463
|
+
let numBytesDecoded = 0;
|
|
464
|
+
function decodeText(ptr, len) {
|
|
465
|
+
numBytesDecoded += len;
|
|
466
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
467
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
468
|
+
cachedTextDecoder.decode();
|
|
469
|
+
numBytesDecoded = len;
|
|
470
|
+
}
|
|
471
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const cachedTextEncoder = new TextEncoder();
|
|
475
|
+
|
|
476
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
477
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
478
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
479
|
+
view.set(buf);
|
|
480
|
+
return {
|
|
481
|
+
read: arg.length,
|
|
482
|
+
written: buf.length
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
let WASM_VECTOR_LEN = 0;
|
|
488
|
+
|
|
489
|
+
let wasmModule, wasmInstance, wasm;
|
|
490
|
+
function __wbg_finalize_init(instance, module) {
|
|
491
|
+
wasmInstance = instance;
|
|
492
|
+
wasm = instance.exports;
|
|
493
|
+
wasmModule = module;
|
|
494
|
+
cachedDataViewMemory0 = null;
|
|
495
|
+
cachedUint8ArrayMemory0 = null;
|
|
496
|
+
return wasm;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
async function __wbg_load(module, imports) {
|
|
500
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
501
|
+
if (!module.ok) {
|
|
502
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
506
|
+
try {
|
|
507
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
508
|
+
} catch (e) {
|
|
509
|
+
const validResponse = expectedResponseType(module.type);
|
|
510
|
+
|
|
511
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
512
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
513
|
+
|
|
514
|
+
} else { throw e; }
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const bytes = await module.arrayBuffer();
|
|
519
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
520
|
+
} else {
|
|
521
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
522
|
+
|
|
523
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
524
|
+
return { instance, module };
|
|
525
|
+
} else {
|
|
526
|
+
return instance;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function expectedResponseType(type) {
|
|
531
|
+
switch (type) {
|
|
532
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
533
|
+
}
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function initSync(module) {
|
|
539
|
+
if (wasm !== undefined) return wasm;
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
if (module !== undefined) {
|
|
543
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
544
|
+
({module} = module)
|
|
545
|
+
} else {
|
|
546
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
const imports = __wbg_get_imports();
|
|
551
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
552
|
+
module = new WebAssembly.Module(module);
|
|
553
|
+
}
|
|
554
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
555
|
+
return __wbg_finalize_init(instance, module);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
async function __wbg_init(module_or_path) {
|
|
559
|
+
if (wasm !== undefined) return wasm;
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
if (module_or_path !== undefined) {
|
|
563
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
564
|
+
({module_or_path} = module_or_path)
|
|
565
|
+
} else {
|
|
566
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (module_or_path === undefined) {
|
|
571
|
+
module_or_path = new URL('openbim_ifcx_wasm_bg.wasm', import.meta.url);
|
|
572
|
+
}
|
|
573
|
+
const imports = __wbg_get_imports();
|
|
574
|
+
|
|
575
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
576
|
+
module_or_path = fetch(module_or_path);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
580
|
+
|
|
581
|
+
return __wbg_finalize_init(instance, module);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export { initSync, __wbg_init as default };
|
|
585
|
+
export { fetchImports } from "./fetch-imports.js";
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_ifcxfile_free: (a: number, b: number) => void;
|
|
5
|
+
export const compose: (a: number, b: number, c: number) => void;
|
|
6
|
+
export const exportGlb: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const ifcxfile_header: (a: number, b: number) => void;
|
|
8
|
+
export const ifcxfile_nodeCount: (a: number) => number;
|
|
9
|
+
export const ifcxfile_parse: (a: number, b: number) => void;
|
|
10
|
+
export const ifcxfile_toJSON: (a: number, b: number) => void;
|
|
11
|
+
export const ifcxfile_validate: (a: number, b: number) => void;
|
|
12
|
+
export const ifcxfile_write: (a: number, b: number, c: number) => void;
|
|
13
|
+
export const validate: (a: number, b: number, c: number) => void;
|
|
14
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
15
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
16
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
17
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
18
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
package/web/package.json
ADDED