@xyo-network/wasm 5.3.29 → 5.4.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/README.md +0 -537
- package/dist/browser/WasmSupport.d.ts.map +1 -1
- package/dist/browser/index.mjs +1 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/neutral/WasmSupport.d.ts.map +1 -1
- package/dist/neutral/index.mjs +1 -2
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/WasmSupport.d.ts.map +1 -1
- package/dist/node/index.mjs +1 -2
- package/dist/node/index.mjs.map +1 -1
- package/package.json +8 -11
package/README.md
CHANGED
|
@@ -38,543 +38,6 @@ bun add {{name}}
|
|
|
38
38
|
|
|
39
39
|
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
40
40
|
|
|
41
|
-
## Reference
|
|
42
|
-
|
|
43
|
-
### packages
|
|
44
|
-
|
|
45
|
-
### protocol
|
|
46
|
-
|
|
47
|
-
### packages
|
|
48
|
-
|
|
49
|
-
### core
|
|
50
|
-
|
|
51
|
-
### packages
|
|
52
|
-
|
|
53
|
-
### wasm
|
|
54
|
-
|
|
55
|
-
### .temp-typedoc
|
|
56
|
-
|
|
57
|
-
### classes
|
|
58
|
-
|
|
59
|
-
### <a id="WasmSupport"></a>WasmSupport
|
|
60
|
-
|
|
61
|
-
[**@xyo-network/wasm**](#../README)
|
|
62
|
-
|
|
63
|
-
***
|
|
64
|
-
|
|
65
|
-
## Constructors
|
|
66
|
-
|
|
67
|
-
### Constructor
|
|
68
|
-
|
|
69
|
-
```ts
|
|
70
|
-
new WasmSupport(desiredFeatures): WasmSupport;
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Instance constructor for use where async instantiation
|
|
74
|
-
is not possible. Where possible, prefer the static
|
|
75
|
-
create method over use of this constructor directly
|
|
76
|
-
as no initialization (feature detection) is able to
|
|
77
|
-
be done here
|
|
78
|
-
|
|
79
|
-
### Parameters
|
|
80
|
-
|
|
81
|
-
#### desiredFeatures
|
|
82
|
-
|
|
83
|
-
(
|
|
84
|
-
\| `"bigInt"`
|
|
85
|
-
\| `"bulkMemory"`
|
|
86
|
-
\| `"exceptions"`
|
|
87
|
-
\| `"extendedConst"`
|
|
88
|
-
\| `"gc"`
|
|
89
|
-
\| `"memory64"`
|
|
90
|
-
\| `"multiValue"`
|
|
91
|
-
\| `"mutableGlobals"`
|
|
92
|
-
\| `"referenceTypes"`
|
|
93
|
-
\| `"relaxedSimd"`
|
|
94
|
-
\| `"saturatedFloatToInt"`
|
|
95
|
-
\| `"signExtensions"`
|
|
96
|
-
\| `"simd"`
|
|
97
|
-
\| `"streamingCompilation"`
|
|
98
|
-
\| `"tailCall"`
|
|
99
|
-
\| `"threads"`)[]
|
|
100
|
-
|
|
101
|
-
The desired feature set
|
|
102
|
-
|
|
103
|
-
### Returns
|
|
104
|
-
|
|
105
|
-
`WasmSupport`
|
|
106
|
-
|
|
107
|
-
## Properties
|
|
108
|
-
|
|
109
|
-
### desiredFeatures
|
|
110
|
-
|
|
111
|
-
```ts
|
|
112
|
-
protected desiredFeatures: (
|
|
113
|
-
| "bigInt"
|
|
114
|
-
| "bulkMemory"
|
|
115
|
-
| "exceptions"
|
|
116
|
-
| "extendedConst"
|
|
117
|
-
| "gc"
|
|
118
|
-
| "memory64"
|
|
119
|
-
| "multiValue"
|
|
120
|
-
| "mutableGlobals"
|
|
121
|
-
| "referenceTypes"
|
|
122
|
-
| "relaxedSimd"
|
|
123
|
-
| "saturatedFloatToInt"
|
|
124
|
-
| "signExtensions"
|
|
125
|
-
| "simd"
|
|
126
|
-
| "streamingCompilation"
|
|
127
|
-
| "tailCall"
|
|
128
|
-
| "threads")[];
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Accessors
|
|
132
|
-
|
|
133
|
-
### allowWasm
|
|
134
|
-
|
|
135
|
-
### Get Signature
|
|
136
|
-
|
|
137
|
-
```ts
|
|
138
|
-
get allowWasm(): boolean;
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Is Wasm allowed
|
|
142
|
-
|
|
143
|
-
#### Returns
|
|
144
|
-
|
|
145
|
-
`boolean`
|
|
146
|
-
|
|
147
|
-
### Set Signature
|
|
148
|
-
|
|
149
|
-
```ts
|
|
150
|
-
set allowWasm(v): void;
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Whether or not to allow WASM usage
|
|
154
|
-
|
|
155
|
-
#### Parameters
|
|
156
|
-
|
|
157
|
-
##### v
|
|
158
|
-
|
|
159
|
-
`boolean`
|
|
160
|
-
|
|
161
|
-
#### Returns
|
|
162
|
-
|
|
163
|
-
`void`
|
|
164
|
-
|
|
165
|
-
***
|
|
166
|
-
|
|
167
|
-
### canUseWasm
|
|
168
|
-
|
|
169
|
-
### Get Signature
|
|
170
|
-
|
|
171
|
-
```ts
|
|
172
|
-
get canUseWasm(): boolean;
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Whether or not Wasm should be used based on the desired
|
|
176
|
-
feature set, initialization state, or force-use settings
|
|
177
|
-
|
|
178
|
-
#### Returns
|
|
179
|
-
|
|
180
|
-
`boolean`
|
|
181
|
-
|
|
182
|
-
***
|
|
183
|
-
|
|
184
|
-
### featureSupport
|
|
185
|
-
|
|
186
|
-
### Get Signature
|
|
187
|
-
|
|
188
|
-
```ts
|
|
189
|
-
get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>>;
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Returns a object containing a property for each desired wasm feature
|
|
193
|
-
with a boolean value indicating whether or not the feature is supported
|
|
194
|
-
|
|
195
|
-
#### Returns
|
|
196
|
-
|
|
197
|
-
`Readonly`\<`Partial`\<`Record`\<[`WasmFeature`](#../type-aliases/WasmFeature), `boolean`\>\>\>
|
|
198
|
-
|
|
199
|
-
***
|
|
200
|
-
|
|
201
|
-
### forceWasm
|
|
202
|
-
|
|
203
|
-
### Get Signature
|
|
204
|
-
|
|
205
|
-
```ts
|
|
206
|
-
get forceWasm(): boolean;
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Force use of Wasm
|
|
210
|
-
|
|
211
|
-
#### Returns
|
|
212
|
-
|
|
213
|
-
`boolean`
|
|
214
|
-
|
|
215
|
-
### Set Signature
|
|
216
|
-
|
|
217
|
-
```ts
|
|
218
|
-
set forceWasm(v): void;
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Whether or not to force Wasm usage
|
|
222
|
-
|
|
223
|
-
#### Parameters
|
|
224
|
-
|
|
225
|
-
##### v
|
|
226
|
-
|
|
227
|
-
`boolean`
|
|
228
|
-
|
|
229
|
-
#### Returns
|
|
230
|
-
|
|
231
|
-
`void`
|
|
232
|
-
|
|
233
|
-
***
|
|
234
|
-
|
|
235
|
-
### isDesiredFeatureSetSupported
|
|
236
|
-
|
|
237
|
-
### Get Signature
|
|
238
|
-
|
|
239
|
-
```ts
|
|
240
|
-
get isDesiredFeatureSetSupported(): boolean;
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Whether or not Wasm is supported based
|
|
244
|
-
on the desired feature set
|
|
245
|
-
|
|
246
|
-
#### Returns
|
|
247
|
-
|
|
248
|
-
`boolean`
|
|
249
|
-
|
|
250
|
-
***
|
|
251
|
-
|
|
252
|
-
### isInitialized
|
|
253
|
-
|
|
254
|
-
### Get Signature
|
|
255
|
-
|
|
256
|
-
```ts
|
|
257
|
-
get isInitialized(): boolean;
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
Whether or not Wasm detection has been run
|
|
261
|
-
for the desired feature set
|
|
262
|
-
|
|
263
|
-
#### Returns
|
|
264
|
-
|
|
265
|
-
`boolean`
|
|
266
|
-
|
|
267
|
-
## Methods
|
|
268
|
-
|
|
269
|
-
### create()
|
|
270
|
-
|
|
271
|
-
```ts
|
|
272
|
-
static create(desiredFeatures): Promise<WasmSupport>;
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
Static creation & async initialization for use where
|
|
276
|
-
async instantiation is possible
|
|
277
|
-
|
|
278
|
-
### Parameters
|
|
279
|
-
|
|
280
|
-
#### desiredFeatures
|
|
281
|
-
|
|
282
|
-
(
|
|
283
|
-
\| `"bigInt"`
|
|
284
|
-
\| `"bulkMemory"`
|
|
285
|
-
\| `"exceptions"`
|
|
286
|
-
\| `"extendedConst"`
|
|
287
|
-
\| `"gc"`
|
|
288
|
-
\| `"memory64"`
|
|
289
|
-
\| `"multiValue"`
|
|
290
|
-
\| `"mutableGlobals"`
|
|
291
|
-
\| `"referenceTypes"`
|
|
292
|
-
\| `"relaxedSimd"`
|
|
293
|
-
\| `"saturatedFloatToInt"`
|
|
294
|
-
\| `"signExtensions"`
|
|
295
|
-
\| `"simd"`
|
|
296
|
-
\| `"streamingCompilation"`
|
|
297
|
-
\| `"tailCall"`
|
|
298
|
-
\| `"threads"`)[]
|
|
299
|
-
|
|
300
|
-
The desired feature set
|
|
301
|
-
|
|
302
|
-
### Returns
|
|
303
|
-
|
|
304
|
-
`Promise`\<`WasmSupport`\>
|
|
305
|
-
|
|
306
|
-
An initialized instance of the class with detection
|
|
307
|
-
for the desired feature set
|
|
308
|
-
|
|
309
|
-
***
|
|
310
|
-
|
|
311
|
-
### featureCheck()
|
|
312
|
-
|
|
313
|
-
```ts
|
|
314
|
-
featureCheck(features): Promise<boolean>;
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
Checks for specific wasm features
|
|
318
|
-
|
|
319
|
-
### Parameters
|
|
320
|
-
|
|
321
|
-
#### features
|
|
322
|
-
|
|
323
|
-
(
|
|
324
|
-
\| `"bigInt"`
|
|
325
|
-
\| `"bulkMemory"`
|
|
326
|
-
\| `"exceptions"`
|
|
327
|
-
\| `"extendedConst"`
|
|
328
|
-
\| `"gc"`
|
|
329
|
-
\| `"memory64"`
|
|
330
|
-
\| `"multiValue"`
|
|
331
|
-
\| `"mutableGlobals"`
|
|
332
|
-
\| `"referenceTypes"`
|
|
333
|
-
\| `"relaxedSimd"`
|
|
334
|
-
\| `"saturatedFloatToInt"`
|
|
335
|
-
\| `"signExtensions"`
|
|
336
|
-
\| `"simd"`
|
|
337
|
-
\| `"streamingCompilation"`
|
|
338
|
-
\| `"tailCall"`
|
|
339
|
-
\| `"threads"`)[]
|
|
340
|
-
|
|
341
|
-
The list of features to check for
|
|
342
|
-
|
|
343
|
-
### Returns
|
|
344
|
-
|
|
345
|
-
`Promise`\<`boolean`\>
|
|
346
|
-
|
|
347
|
-
True if all the features are supported, false otherwise
|
|
348
|
-
|
|
349
|
-
***
|
|
350
|
-
|
|
351
|
-
### initialize()
|
|
352
|
-
|
|
353
|
-
```ts
|
|
354
|
-
initialize(): Promise<void>;
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
Does feature detection for the desired feature set
|
|
358
|
-
|
|
359
|
-
### Returns
|
|
360
|
-
|
|
361
|
-
`Promise`\<`void`\>
|
|
362
|
-
|
|
363
|
-
***
|
|
364
|
-
|
|
365
|
-
### detectDesiredFeatures()
|
|
366
|
-
|
|
367
|
-
```ts
|
|
368
|
-
protected detectDesiredFeatures(): Promise<void>;
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
### Returns
|
|
372
|
-
|
|
373
|
-
`Promise`\<`void`\>
|
|
374
|
-
|
|
375
|
-
### type-aliases
|
|
376
|
-
|
|
377
|
-
### <a id="WasmFeature"></a>WasmFeature
|
|
378
|
-
|
|
379
|
-
[**@xyo-network/wasm**](#../README)
|
|
380
|
-
|
|
381
|
-
***
|
|
382
|
-
|
|
383
|
-
```ts
|
|
384
|
-
type WasmFeature = keyof typeof WasmFeatureDetectors;
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
### variables
|
|
388
|
-
|
|
389
|
-
### <a id="WasmFeatureDetectors"></a>WasmFeatureDetectors
|
|
390
|
-
|
|
391
|
-
[**@xyo-network/wasm**](#../README)
|
|
392
|
-
|
|
393
|
-
***
|
|
394
|
-
|
|
395
|
-
```ts
|
|
396
|
-
const WasmFeatureDetectors: object;
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
## Type Declaration
|
|
400
|
-
|
|
401
|
-
### bigInt
|
|
402
|
-
|
|
403
|
-
```ts
|
|
404
|
-
readonly bigInt: () => Promise<boolean>;
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
### Returns
|
|
408
|
-
|
|
409
|
-
`Promise`\<`boolean`\>
|
|
410
|
-
|
|
411
|
-
### bulkMemory
|
|
412
|
-
|
|
413
|
-
```ts
|
|
414
|
-
readonly bulkMemory: () => Promise<boolean>;
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### Returns
|
|
418
|
-
|
|
419
|
-
`Promise`\<`boolean`\>
|
|
420
|
-
|
|
421
|
-
### exceptions
|
|
422
|
-
|
|
423
|
-
```ts
|
|
424
|
-
readonly exceptions: () => Promise<boolean>;
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Returns
|
|
428
|
-
|
|
429
|
-
`Promise`\<`boolean`\>
|
|
430
|
-
|
|
431
|
-
### extendedConst
|
|
432
|
-
|
|
433
|
-
```ts
|
|
434
|
-
readonly extendedConst: () => Promise<boolean>;
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
### Returns
|
|
438
|
-
|
|
439
|
-
`Promise`\<`boolean`\>
|
|
440
|
-
|
|
441
|
-
### gc
|
|
442
|
-
|
|
443
|
-
```ts
|
|
444
|
-
readonly gc: () => Promise<boolean>;
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
### Returns
|
|
448
|
-
|
|
449
|
-
`Promise`\<`boolean`\>
|
|
450
|
-
|
|
451
|
-
### memory64
|
|
452
|
-
|
|
453
|
-
```ts
|
|
454
|
-
readonly memory64: () => Promise<boolean>;
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### Returns
|
|
458
|
-
|
|
459
|
-
`Promise`\<`boolean`\>
|
|
460
|
-
|
|
461
|
-
### multiValue
|
|
462
|
-
|
|
463
|
-
```ts
|
|
464
|
-
readonly multiValue: () => Promise<boolean>;
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
### Returns
|
|
468
|
-
|
|
469
|
-
`Promise`\<`boolean`\>
|
|
470
|
-
|
|
471
|
-
### mutableGlobals
|
|
472
|
-
|
|
473
|
-
```ts
|
|
474
|
-
readonly mutableGlobals: () => Promise<boolean>;
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
### Returns
|
|
478
|
-
|
|
479
|
-
`Promise`\<`boolean`\>
|
|
480
|
-
|
|
481
|
-
### referenceTypes
|
|
482
|
-
|
|
483
|
-
```ts
|
|
484
|
-
readonly referenceTypes: () => (executor) => Promise<boolean>;
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
### Returns
|
|
488
|
-
|
|
489
|
-
```ts
|
|
490
|
-
(executor): Promise<boolean>;
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
Creates a new Promise.
|
|
494
|
-
|
|
495
|
-
#### Parameters
|
|
496
|
-
|
|
497
|
-
##### executor
|
|
498
|
-
|
|
499
|
-
(`resolve`, `reject`) => `void`
|
|
500
|
-
|
|
501
|
-
A callback used to initialize the promise. This callback is passed two arguments:
|
|
502
|
-
a resolve callback used to resolve the promise with a value or the result of another promise,
|
|
503
|
-
and a reject callback used to reject the promise with a provided reason or error.
|
|
504
|
-
|
|
505
|
-
#### Returns
|
|
506
|
-
|
|
507
|
-
`Promise`\<`boolean`\>
|
|
508
|
-
|
|
509
|
-
### relaxedSimd
|
|
510
|
-
|
|
511
|
-
```ts
|
|
512
|
-
readonly relaxedSimd: () => Promise<boolean>;
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
### Returns
|
|
516
|
-
|
|
517
|
-
`Promise`\<`boolean`\>
|
|
518
|
-
|
|
519
|
-
### saturatedFloatToInt
|
|
520
|
-
|
|
521
|
-
```ts
|
|
522
|
-
readonly saturatedFloatToInt: () => Promise<boolean>;
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### Returns
|
|
526
|
-
|
|
527
|
-
`Promise`\<`boolean`\>
|
|
528
|
-
|
|
529
|
-
### signExtensions
|
|
530
|
-
|
|
531
|
-
```ts
|
|
532
|
-
readonly signExtensions: () => Promise<boolean>;
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
### Returns
|
|
536
|
-
|
|
537
|
-
`Promise`\<`boolean`\>
|
|
538
|
-
|
|
539
|
-
### simd
|
|
540
|
-
|
|
541
|
-
```ts
|
|
542
|
-
readonly simd: () => Promise<boolean>;
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
### Returns
|
|
546
|
-
|
|
547
|
-
`Promise`\<`boolean`\>
|
|
548
|
-
|
|
549
|
-
### streamingCompilation
|
|
550
|
-
|
|
551
|
-
```ts
|
|
552
|
-
readonly streamingCompilation: () => Promise<boolean>;
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
### Returns
|
|
556
|
-
|
|
557
|
-
`Promise`\<`boolean`\>
|
|
558
|
-
|
|
559
|
-
### tailCall
|
|
560
|
-
|
|
561
|
-
```ts
|
|
562
|
-
readonly tailCall: () => Promise<boolean>;
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
### Returns
|
|
566
|
-
|
|
567
|
-
`Promise`\<`boolean`\>
|
|
568
|
-
|
|
569
|
-
### threads
|
|
570
|
-
|
|
571
|
-
```ts
|
|
572
|
-
readonly threads: () => Promise<boolean>;
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
### Returns
|
|
576
|
-
|
|
577
|
-
`Promise`\<`boolean`\>
|
|
578
41
|
|
|
579
42
|
|
|
580
43
|
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,oBAAoB;;;;;;;;;;iGAsChB,CAAC;;qEAqBb,CAAE;;;;;;;;4EArBsB,CAAE;;;;;iDASf,GAAG;;;;;;;;;;CA9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@@ -138,8 +138,7 @@ var WasmSupport = class _WasmSupport {
|
|
|
138
138
|
this._isInitialized = true;
|
|
139
139
|
}
|
|
140
140
|
async detectDesiredFeatures() {
|
|
141
|
-
for (
|
|
142
|
-
const desiredFeature = this.desiredFeatures[feature];
|
|
141
|
+
for (const desiredFeature of this.desiredFeatures) {
|
|
143
142
|
const detector = WasmFeatureDetectors[desiredFeature];
|
|
144
143
|
this._featureSupport[desiredFeature] = isTruthy(await detector());
|
|
145
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/WasmSupport.ts"],"sourcesContent":["import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n relaxedSimd,\n saturatedFloatToInt,\n signExtensions,\n simd,\n streamingCompilation,\n tailCall,\n threads,\n} from 'wasm-feature-detect'\n\nexport const WasmFeatureDetectors = {\n bigInt: bigInt,\n bulkMemory: bulkMemory,\n exceptions: exceptions,\n extendedConst: extendedConst,\n gc: gc,\n memory64: memory64,\n multiValue: multiValue,\n mutableGlobals: mutableGlobals,\n referenceTypes: () => Promise<boolean>,\n relaxedSimd: relaxedSimd,\n saturatedFloatToInt: saturatedFloatToInt,\n signExtensions: signExtensions,\n simd: simd,\n streamingCompilation: streamingCompilation,\n tailCall: tailCall,\n threads: threads,\n} as const\n\nimport { isTruthy } from '@xylabs/sdk-js'\n\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\n protected desiredFeatures: WasmFeature[]\n\n private _allowWasm = true\n private _featureSupport: Partial<Record<WasmFeature, boolean>> = {}\n private _forceWasm = false\n private _isInitialized = false\n private _isWasmFeatureSetSupported = false\n\n /**\n * Instance constructor for use where async instantiation\n * is not possible. Where possible, prefer the static\n * create method over use of this constructor directly\n * as no initialization (feature detection) is able to\n * be done here\n * @param desiredFeatures The desired feature set\n */\n constructor(desiredFeatures: WasmFeature[]) {\n this.desiredFeatures = desiredFeatures\n }\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\n }\n\n /**\n * Whether or not to allow WASM usage\n */\n set allowWasm(v: boolean) {\n this._allowWasm = v\n }\n\n /**\n * Whether or not Wasm should be used based on the desired\n * feature set, initialization state, or force-use settings\n */\n get canUseWasm(): boolean {\n return (\n // Just force WASM\n this._forceWasm\n // Or if we haven't checked be optimistic\n || (this._allowWasm && !this._isInitialized)\n // Or if we have checked and WASM is not supported, be realistic\n || (this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported)\n )\n }\n\n /**\n * Returns a object containing a property for each desired wasm feature\n * with a boolean value indicating whether or not the feature is supported\n */\n get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>> {\n return { ...this._featureSupport }\n }\n\n /**\n * Force use of Wasm\n */\n get forceWasm(): boolean {\n return this._forceWasm\n }\n\n /**\n * Whether or not to force Wasm usage\n */\n set forceWasm(v: boolean) {\n this._forceWasm = v\n }\n\n /**\n * Whether or not Wasm is supported based\n * on the desired feature set\n */\n get isDesiredFeatureSetSupported(): boolean {\n return this._isWasmFeatureSetSupported\n }\n\n /**\n * Whether or not Wasm detection has been run\n * for the desired feature set\n */\n get isInitialized(): boolean {\n return this._isInitialized\n }\n\n /**\n * Static creation & async initialization for use where\n * async instantiation is possible\n * @param desiredFeatures The desired feature set\n * @returns An initialized instance of the class with detection\n * for the desired feature set\n */\n static async create(desiredFeatures: WasmFeature[]): Promise<WasmSupport> {\n const instance = new WasmSupport(desiredFeatures)\n await instance.initialize()\n return instance\n }\n\n /**\n * Checks for specific wasm features\n * @param features The list of features to check for\n * @returns True if all the features are supported, false otherwise\n */\n async featureCheck(features: WasmFeature[]): Promise<boolean> {\n const results = await Promise.all(features.map(feature => WasmFeatureDetectors[feature]).map(async detector => await detector()))\n return results.every(Boolean)\n }\n\n /**\n * Does feature detection for the desired feature set\n */\n async initialize(): Promise<void> {\n if (this._isInitialized) return\n await this.detectDesiredFeatures()\n this._isInitialized = true\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (
|
|
1
|
+
{"version":3,"sources":["../../src/WasmSupport.ts"],"sourcesContent":["import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n relaxedSimd,\n saturatedFloatToInt,\n signExtensions,\n simd,\n streamingCompilation,\n tailCall,\n threads,\n} from 'wasm-feature-detect'\n\nexport const WasmFeatureDetectors = {\n bigInt: bigInt,\n bulkMemory: bulkMemory,\n exceptions: exceptions,\n extendedConst: extendedConst,\n gc: gc,\n memory64: memory64,\n multiValue: multiValue,\n mutableGlobals: mutableGlobals,\n referenceTypes: () => Promise<boolean>,\n relaxedSimd: relaxedSimd,\n saturatedFloatToInt: saturatedFloatToInt,\n signExtensions: signExtensions,\n simd: simd,\n streamingCompilation: streamingCompilation,\n tailCall: tailCall,\n threads: threads,\n} as const\n\nimport { isTruthy } from '@xylabs/sdk-js'\n\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\n protected desiredFeatures: WasmFeature[]\n\n private _allowWasm = true\n private _featureSupport: Partial<Record<WasmFeature, boolean>> = {}\n private _forceWasm = false\n private _isInitialized = false\n private _isWasmFeatureSetSupported = false\n\n /**\n * Instance constructor for use where async instantiation\n * is not possible. Where possible, prefer the static\n * create method over use of this constructor directly\n * as no initialization (feature detection) is able to\n * be done here\n * @param desiredFeatures The desired feature set\n */\n constructor(desiredFeatures: WasmFeature[]) {\n this.desiredFeatures = desiredFeatures\n }\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\n }\n\n /**\n * Whether or not to allow WASM usage\n */\n set allowWasm(v: boolean) {\n this._allowWasm = v\n }\n\n /**\n * Whether or not Wasm should be used based on the desired\n * feature set, initialization state, or force-use settings\n */\n get canUseWasm(): boolean {\n return (\n // Just force WASM\n this._forceWasm\n // Or if we haven't checked be optimistic\n || (this._allowWasm && !this._isInitialized)\n // Or if we have checked and WASM is not supported, be realistic\n || (this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported)\n )\n }\n\n /**\n * Returns a object containing a property for each desired wasm feature\n * with a boolean value indicating whether or not the feature is supported\n */\n get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>> {\n return { ...this._featureSupport }\n }\n\n /**\n * Force use of Wasm\n */\n get forceWasm(): boolean {\n return this._forceWasm\n }\n\n /**\n * Whether or not to force Wasm usage\n */\n set forceWasm(v: boolean) {\n this._forceWasm = v\n }\n\n /**\n * Whether or not Wasm is supported based\n * on the desired feature set\n */\n get isDesiredFeatureSetSupported(): boolean {\n return this._isWasmFeatureSetSupported\n }\n\n /**\n * Whether or not Wasm detection has been run\n * for the desired feature set\n */\n get isInitialized(): boolean {\n return this._isInitialized\n }\n\n /**\n * Static creation & async initialization for use where\n * async instantiation is possible\n * @param desiredFeatures The desired feature set\n * @returns An initialized instance of the class with detection\n * for the desired feature set\n */\n static async create(desiredFeatures: WasmFeature[]): Promise<WasmSupport> {\n const instance = new WasmSupport(desiredFeatures)\n await instance.initialize()\n return instance\n }\n\n /**\n * Checks for specific wasm features\n * @param features The list of features to check for\n * @returns True if all the features are supported, false otherwise\n */\n async featureCheck(features: WasmFeature[]): Promise<boolean> {\n const results = await Promise.all(features.map(feature => WasmFeatureDetectors[feature]).map(async detector => await detector()))\n return results.every(Boolean)\n }\n\n /**\n * Does feature detection for the desired feature set\n */\n async initialize(): Promise<void> {\n if (this._isInitialized) return\n await this.detectDesiredFeatures()\n this._isInitialized = true\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (const desiredFeature of this.desiredFeatures) {\n const detector = WasmFeatureDetectors[desiredFeature]\n this._featureSupport[desiredFeature] = isTruthy(await detector())\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean)\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AAW;IACtB,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE,CAAA;IAExC,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;IAE1C;;;;;;;OAOG;gBACS,eAAe,EAAE,WAAW,EAAE;IAI1C;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,OAAO,CASxB;IAED;;;OAGG;IACH,IAAI,cAAc,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAEpE;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAED;;;OAGG;IACH,IAAI,4BAA4B,IAAI,OAAO,CAE1C;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;;;;OAMG;WACU,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAMzE;;;;OAIG;IACG,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAK7D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;cAMjB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;CAOvD"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -138,8 +138,7 @@ var WasmSupport = class _WasmSupport {
|
|
|
138
138
|
this._isInitialized = true;
|
|
139
139
|
}
|
|
140
140
|
async detectDesiredFeatures() {
|
|
141
|
-
for (
|
|
142
|
-
const desiredFeature = this.desiredFeatures[feature];
|
|
141
|
+
for (const desiredFeature of this.desiredFeatures) {
|
|
143
142
|
const detector = WasmFeatureDetectors[desiredFeature];
|
|
144
143
|
this._featureSupport[desiredFeature] = isTruthy(await detector());
|
|
145
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/WasmSupport.ts"],"sourcesContent":["import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n relaxedSimd,\n saturatedFloatToInt,\n signExtensions,\n simd,\n streamingCompilation,\n tailCall,\n threads,\n} from 'wasm-feature-detect'\n\nexport const WasmFeatureDetectors = {\n bigInt: bigInt,\n bulkMemory: bulkMemory,\n exceptions: exceptions,\n extendedConst: extendedConst,\n gc: gc,\n memory64: memory64,\n multiValue: multiValue,\n mutableGlobals: mutableGlobals,\n referenceTypes: () => Promise<boolean>,\n relaxedSimd: relaxedSimd,\n saturatedFloatToInt: saturatedFloatToInt,\n signExtensions: signExtensions,\n simd: simd,\n streamingCompilation: streamingCompilation,\n tailCall: tailCall,\n threads: threads,\n} as const\n\nimport { isTruthy } from '@xylabs/sdk-js'\n\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\n protected desiredFeatures: WasmFeature[]\n\n private _allowWasm = true\n private _featureSupport: Partial<Record<WasmFeature, boolean>> = {}\n private _forceWasm = false\n private _isInitialized = false\n private _isWasmFeatureSetSupported = false\n\n /**\n * Instance constructor for use where async instantiation\n * is not possible. Where possible, prefer the static\n * create method over use of this constructor directly\n * as no initialization (feature detection) is able to\n * be done here\n * @param desiredFeatures The desired feature set\n */\n constructor(desiredFeatures: WasmFeature[]) {\n this.desiredFeatures = desiredFeatures\n }\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\n }\n\n /**\n * Whether or not to allow WASM usage\n */\n set allowWasm(v: boolean) {\n this._allowWasm = v\n }\n\n /**\n * Whether or not Wasm should be used based on the desired\n * feature set, initialization state, or force-use settings\n */\n get canUseWasm(): boolean {\n return (\n // Just force WASM\n this._forceWasm\n // Or if we haven't checked be optimistic\n || (this._allowWasm && !this._isInitialized)\n // Or if we have checked and WASM is not supported, be realistic\n || (this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported)\n )\n }\n\n /**\n * Returns a object containing a property for each desired wasm feature\n * with a boolean value indicating whether or not the feature is supported\n */\n get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>> {\n return { ...this._featureSupport }\n }\n\n /**\n * Force use of Wasm\n */\n get forceWasm(): boolean {\n return this._forceWasm\n }\n\n /**\n * Whether or not to force Wasm usage\n */\n set forceWasm(v: boolean) {\n this._forceWasm = v\n }\n\n /**\n * Whether or not Wasm is supported based\n * on the desired feature set\n */\n get isDesiredFeatureSetSupported(): boolean {\n return this._isWasmFeatureSetSupported\n }\n\n /**\n * Whether or not Wasm detection has been run\n * for the desired feature set\n */\n get isInitialized(): boolean {\n return this._isInitialized\n }\n\n /**\n * Static creation & async initialization for use where\n * async instantiation is possible\n * @param desiredFeatures The desired feature set\n * @returns An initialized instance of the class with detection\n * for the desired feature set\n */\n static async create(desiredFeatures: WasmFeature[]): Promise<WasmSupport> {\n const instance = new WasmSupport(desiredFeatures)\n await instance.initialize()\n return instance\n }\n\n /**\n * Checks for specific wasm features\n * @param features The list of features to check for\n * @returns True if all the features are supported, false otherwise\n */\n async featureCheck(features: WasmFeature[]): Promise<boolean> {\n const results = await Promise.all(features.map(feature => WasmFeatureDetectors[feature]).map(async detector => await detector()))\n return results.every(Boolean)\n }\n\n /**\n * Does feature detection for the desired feature set\n */\n async initialize(): Promise<void> {\n if (this._isInitialized) return\n await this.detectDesiredFeatures()\n this._isInitialized = true\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (
|
|
1
|
+
{"version":3,"sources":["../../src/WasmSupport.ts"],"sourcesContent":["import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n relaxedSimd,\n saturatedFloatToInt,\n signExtensions,\n simd,\n streamingCompilation,\n tailCall,\n threads,\n} from 'wasm-feature-detect'\n\nexport const WasmFeatureDetectors = {\n bigInt: bigInt,\n bulkMemory: bulkMemory,\n exceptions: exceptions,\n extendedConst: extendedConst,\n gc: gc,\n memory64: memory64,\n multiValue: multiValue,\n mutableGlobals: mutableGlobals,\n referenceTypes: () => Promise<boolean>,\n relaxedSimd: relaxedSimd,\n saturatedFloatToInt: saturatedFloatToInt,\n signExtensions: signExtensions,\n simd: simd,\n streamingCompilation: streamingCompilation,\n tailCall: tailCall,\n threads: threads,\n} as const\n\nimport { isTruthy } from '@xylabs/sdk-js'\n\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\n protected desiredFeatures: WasmFeature[]\n\n private _allowWasm = true\n private _featureSupport: Partial<Record<WasmFeature, boolean>> = {}\n private _forceWasm = false\n private _isInitialized = false\n private _isWasmFeatureSetSupported = false\n\n /**\n * Instance constructor for use where async instantiation\n * is not possible. Where possible, prefer the static\n * create method over use of this constructor directly\n * as no initialization (feature detection) is able to\n * be done here\n * @param desiredFeatures The desired feature set\n */\n constructor(desiredFeatures: WasmFeature[]) {\n this.desiredFeatures = desiredFeatures\n }\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\n }\n\n /**\n * Whether or not to allow WASM usage\n */\n set allowWasm(v: boolean) {\n this._allowWasm = v\n }\n\n /**\n * Whether or not Wasm should be used based on the desired\n * feature set, initialization state, or force-use settings\n */\n get canUseWasm(): boolean {\n return (\n // Just force WASM\n this._forceWasm\n // Or if we haven't checked be optimistic\n || (this._allowWasm && !this._isInitialized)\n // Or if we have checked and WASM is not supported, be realistic\n || (this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported)\n )\n }\n\n /**\n * Returns a object containing a property for each desired wasm feature\n * with a boolean value indicating whether or not the feature is supported\n */\n get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>> {\n return { ...this._featureSupport }\n }\n\n /**\n * Force use of Wasm\n */\n get forceWasm(): boolean {\n return this._forceWasm\n }\n\n /**\n * Whether or not to force Wasm usage\n */\n set forceWasm(v: boolean) {\n this._forceWasm = v\n }\n\n /**\n * Whether or not Wasm is supported based\n * on the desired feature set\n */\n get isDesiredFeatureSetSupported(): boolean {\n return this._isWasmFeatureSetSupported\n }\n\n /**\n * Whether or not Wasm detection has been run\n * for the desired feature set\n */\n get isInitialized(): boolean {\n return this._isInitialized\n }\n\n /**\n * Static creation & async initialization for use where\n * async instantiation is possible\n * @param desiredFeatures The desired feature set\n * @returns An initialized instance of the class with detection\n * for the desired feature set\n */\n static async create(desiredFeatures: WasmFeature[]): Promise<WasmSupport> {\n const instance = new WasmSupport(desiredFeatures)\n await instance.initialize()\n return instance\n }\n\n /**\n * Checks for specific wasm features\n * @param features The list of features to check for\n * @returns True if all the features are supported, false otherwise\n */\n async featureCheck(features: WasmFeature[]): Promise<boolean> {\n const results = await Promise.all(features.map(feature => WasmFeatureDetectors[feature]).map(async detector => await detector()))\n return results.every(Boolean)\n }\n\n /**\n * Does feature detection for the desired feature set\n */\n async initialize(): Promise<void> {\n if (this._isInitialized) return\n await this.detectDesiredFeatures()\n this._isInitialized = true\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (const desiredFeature of this.desiredFeatures) {\n const detector = WasmFeatureDetectors[desiredFeature]\n this._featureSupport[desiredFeature] = isTruthy(await detector())\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean)\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqBP,SAAS,gBAAgB;AAnBlB,IAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;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AAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;IAE1C;;;;;;;OAOG;gBACS,eAAe,EAAE,WAAW,EAAE;IAI1C;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,OAAO,CASxB;IAED;;;OAGG;IACH,IAAI,cAAc,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAEpE;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAED;;;OAGG;IACH,IAAI,4BAA4B,IAAI,OAAO,CAE1C;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;;;;OAMG;WACU,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAMzE;;;;OAIG;IACG,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAK7D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;cAMjB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;CAOvD"}
|
package/dist/node/index.mjs
CHANGED
|
@@ -138,8 +138,7 @@ var WasmSupport = class _WasmSupport {
|
|
|
138
138
|
this._isInitialized = true;
|
|
139
139
|
}
|
|
140
140
|
async detectDesiredFeatures() {
|
|
141
|
-
for (
|
|
142
|
-
const desiredFeature = this.desiredFeatures[feature];
|
|
141
|
+
for (const desiredFeature of this.desiredFeatures) {
|
|
143
142
|
const detector = WasmFeatureDetectors[desiredFeature];
|
|
144
143
|
this._featureSupport[desiredFeature] = isTruthy(await detector());
|
|
145
144
|
}
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/WasmSupport.ts"],"sourcesContent":["import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n relaxedSimd,\n saturatedFloatToInt,\n signExtensions,\n simd,\n streamingCompilation,\n tailCall,\n threads,\n} from 'wasm-feature-detect'\n\nexport const WasmFeatureDetectors = {\n bigInt: bigInt,\n bulkMemory: bulkMemory,\n exceptions: exceptions,\n extendedConst: extendedConst,\n gc: gc,\n memory64: memory64,\n multiValue: multiValue,\n mutableGlobals: mutableGlobals,\n referenceTypes: () => Promise<boolean>,\n relaxedSimd: relaxedSimd,\n saturatedFloatToInt: saturatedFloatToInt,\n signExtensions: signExtensions,\n simd: simd,\n streamingCompilation: streamingCompilation,\n tailCall: tailCall,\n threads: threads,\n} as const\n\nimport { isTruthy } from '@xylabs/sdk-js'\n\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\n protected desiredFeatures: WasmFeature[]\n\n private _allowWasm = true\n private _featureSupport: Partial<Record<WasmFeature, boolean>> = {}\n private _forceWasm = false\n private _isInitialized = false\n private _isWasmFeatureSetSupported = false\n\n /**\n * Instance constructor for use where async instantiation\n * is not possible. Where possible, prefer the static\n * create method over use of this constructor directly\n * as no initialization (feature detection) is able to\n * be done here\n * @param desiredFeatures The desired feature set\n */\n constructor(desiredFeatures: WasmFeature[]) {\n this.desiredFeatures = desiredFeatures\n }\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\n }\n\n /**\n * Whether or not to allow WASM usage\n */\n set allowWasm(v: boolean) {\n this._allowWasm = v\n }\n\n /**\n * Whether or not Wasm should be used based on the desired\n * feature set, initialization state, or force-use settings\n */\n get canUseWasm(): boolean {\n return (\n // Just force WASM\n this._forceWasm\n // Or if we haven't checked be optimistic\n || (this._allowWasm && !this._isInitialized)\n // Or if we have checked and WASM is not supported, be realistic\n || (this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported)\n )\n }\n\n /**\n * Returns a object containing a property for each desired wasm feature\n * with a boolean value indicating whether or not the feature is supported\n */\n get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>> {\n return { ...this._featureSupport }\n }\n\n /**\n * Force use of Wasm\n */\n get forceWasm(): boolean {\n return this._forceWasm\n }\n\n /**\n * Whether or not to force Wasm usage\n */\n set forceWasm(v: boolean) {\n this._forceWasm = v\n }\n\n /**\n * Whether or not Wasm is supported based\n * on the desired feature set\n */\n get isDesiredFeatureSetSupported(): boolean {\n return this._isWasmFeatureSetSupported\n }\n\n /**\n * Whether or not Wasm detection has been run\n * for the desired feature set\n */\n get isInitialized(): boolean {\n return this._isInitialized\n }\n\n /**\n * Static creation & async initialization for use where\n * async instantiation is possible\n * @param desiredFeatures The desired feature set\n * @returns An initialized instance of the class with detection\n * for the desired feature set\n */\n static async create(desiredFeatures: WasmFeature[]): Promise<WasmSupport> {\n const instance = new WasmSupport(desiredFeatures)\n await instance.initialize()\n return instance\n }\n\n /**\n * Checks for specific wasm features\n * @param features The list of features to check for\n * @returns True if all the features are supported, false otherwise\n */\n async featureCheck(features: WasmFeature[]): Promise<boolean> {\n const results = await Promise.all(features.map(feature => WasmFeatureDetectors[feature]).map(async detector => await detector()))\n return results.every(Boolean)\n }\n\n /**\n * Does feature detection for the desired feature set\n */\n async initialize(): Promise<void> {\n if (this._isInitialized) return\n await this.detectDesiredFeatures()\n this._isInitialized = true\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (
|
|
1
|
+
{"version":3,"sources":["../../src/WasmSupport.ts"],"sourcesContent":["import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n relaxedSimd,\n saturatedFloatToInt,\n signExtensions,\n simd,\n streamingCompilation,\n tailCall,\n threads,\n} from 'wasm-feature-detect'\n\nexport const WasmFeatureDetectors = {\n bigInt: bigInt,\n bulkMemory: bulkMemory,\n exceptions: exceptions,\n extendedConst: extendedConst,\n gc: gc,\n memory64: memory64,\n multiValue: multiValue,\n mutableGlobals: mutableGlobals,\n referenceTypes: () => Promise<boolean>,\n relaxedSimd: relaxedSimd,\n saturatedFloatToInt: saturatedFloatToInt,\n signExtensions: signExtensions,\n simd: simd,\n streamingCompilation: streamingCompilation,\n tailCall: tailCall,\n threads: threads,\n} as const\n\nimport { isTruthy } from '@xylabs/sdk-js'\n\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\n protected desiredFeatures: WasmFeature[]\n\n private _allowWasm = true\n private _featureSupport: Partial<Record<WasmFeature, boolean>> = {}\n private _forceWasm = false\n private _isInitialized = false\n private _isWasmFeatureSetSupported = false\n\n /**\n * Instance constructor for use where async instantiation\n * is not possible. Where possible, prefer the static\n * create method over use of this constructor directly\n * as no initialization (feature detection) is able to\n * be done here\n * @param desiredFeatures The desired feature set\n */\n constructor(desiredFeatures: WasmFeature[]) {\n this.desiredFeatures = desiredFeatures\n }\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\n }\n\n /**\n * Whether or not to allow WASM usage\n */\n set allowWasm(v: boolean) {\n this._allowWasm = v\n }\n\n /**\n * Whether or not Wasm should be used based on the desired\n * feature set, initialization state, or force-use settings\n */\n get canUseWasm(): boolean {\n return (\n // Just force WASM\n this._forceWasm\n // Or if we haven't checked be optimistic\n || (this._allowWasm && !this._isInitialized)\n // Or if we have checked and WASM is not supported, be realistic\n || (this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported)\n )\n }\n\n /**\n * Returns a object containing a property for each desired wasm feature\n * with a boolean value indicating whether or not the feature is supported\n */\n get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>> {\n return { ...this._featureSupport }\n }\n\n /**\n * Force use of Wasm\n */\n get forceWasm(): boolean {\n return this._forceWasm\n }\n\n /**\n * Whether or not to force Wasm usage\n */\n set forceWasm(v: boolean) {\n this._forceWasm = v\n }\n\n /**\n * Whether or not Wasm is supported based\n * on the desired feature set\n */\n get isDesiredFeatureSetSupported(): boolean {\n return this._isWasmFeatureSetSupported\n }\n\n /**\n * Whether or not Wasm detection has been run\n * for the desired feature set\n */\n get isInitialized(): boolean {\n return this._isInitialized\n }\n\n /**\n * Static creation & async initialization for use where\n * async instantiation is possible\n * @param desiredFeatures The desired feature set\n * @returns An initialized instance of the class with detection\n * for the desired feature set\n */\n static async create(desiredFeatures: WasmFeature[]): Promise<WasmSupport> {\n const instance = new WasmSupport(desiredFeatures)\n await instance.initialize()\n return instance\n }\n\n /**\n * Checks for specific wasm features\n * @param features The list of features to check for\n * @returns True if all the features are supported, false otherwise\n */\n async featureCheck(features: WasmFeature[]): Promise<boolean> {\n const results = await Promise.all(features.map(feature => WasmFeatureDetectors[feature]).map(async detector => await detector()))\n return results.every(Boolean)\n }\n\n /**\n * Does feature detection for the desired feature set\n */\n async initialize(): Promise<void> {\n if (this._isInitialized) return\n await this.detectDesiredFeatures()\n this._isInitialized = true\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (const desiredFeature of this.desiredFeatures) {\n const detector = WasmFeatureDetectors[desiredFeature]\n this._featureSupport[desiredFeature] = isTruthy(await detector())\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean)\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqBP,SAAS,gBAAgB;AAnBlB,IAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,MAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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AM,QAAQ,IAAI,SAAS,IAAI,aAAW,qBAAqB,OAAO,CAAC,EAAE,IAAI,OAAM,aAAY,MAAM,SAAS,CAAC,CAAC;AAChI,WAAO,QAAQ,MAAM,OAAO;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAA4B;AAChC,QAAI,KAAK,eAAgB;AACzB,UAAM,KAAK,sBAAsB;AACjC,SAAK,iBAAiB;AAAA,EACxB;AAAA,EAEA,MAAgB,wBAAuC;AACrD,eAAW,kBAAkB,KAAK,iBAAiB;AACjD,YAAM,WAAW,qBAAqB,cAAc;AACpD,WAAK,gBAAgB,cAAc,IAAI,SAAS,MAAM,SAAS,CAAC;AAAA,IAClE;AACA,SAAK,6BAA6B,OAAO,OAAO,KAAK,eAAe,EAAE,MAAM,OAAO;AAAA,EACrF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/wasm",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -22,12 +22,10 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/neutral/index.d.ts",
|
|
25
|
-
"import": "./dist/neutral/index.mjs",
|
|
26
25
|
"default": "./dist/neutral/index.mjs"
|
|
27
26
|
},
|
|
28
27
|
"./package.json": "./package.json"
|
|
29
28
|
},
|
|
30
|
-
"types": "dist/neutral/index.d.ts",
|
|
31
29
|
"files": [
|
|
32
30
|
"dist",
|
|
33
31
|
"!**/*.bench.*",
|
|
@@ -40,19 +38,18 @@
|
|
|
40
38
|
},
|
|
41
39
|
"devDependencies": {
|
|
42
40
|
"@opentelemetry/api": "^1.9.1",
|
|
43
|
-
"@xylabs/sdk-js": "^5.0.
|
|
44
|
-
"@xylabs/tsconfig": "~7.8
|
|
45
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
46
|
-
"@xylabs/vitest-matchers": "~5.0.
|
|
47
|
-
"axios": "^1.14.0",
|
|
41
|
+
"@xylabs/sdk-js": "^5.0.97",
|
|
42
|
+
"@xylabs/tsconfig": "~7.10.8",
|
|
43
|
+
"@xylabs/vitest-extended": "~5.0.97",
|
|
44
|
+
"@xylabs/vitest-matchers": "~5.0.97",
|
|
48
45
|
"pako": "~2.1.0",
|
|
49
46
|
"typescript": "~5.9.3",
|
|
50
|
-
"vite": "^8.0.
|
|
51
|
-
"vitest": "~4.1.
|
|
47
|
+
"vite": "^8.0.8",
|
|
48
|
+
"vitest": "~4.1.4",
|
|
52
49
|
"zod": "^4.3.6"
|
|
53
50
|
},
|
|
54
51
|
"peerDependencies": {
|
|
55
|
-
"@xylabs/sdk-js": "^5"
|
|
52
|
+
"@xylabs/sdk-js": "^5.0.97"
|
|
56
53
|
},
|
|
57
54
|
"publishConfig": {
|
|
58
55
|
"access": "public"
|