@xyo-network/wasm 2.106.0 → 2.107.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/dist/browser/WasmSupport.d.cts +0 -51
- package/dist/browser/WasmSupport.d.cts.map +1 -1
- package/dist/browser/WasmSupport.d.mts +0 -51
- package/dist/browser/WasmSupport.d.mts.map +1 -1
- package/dist/browser/WasmSupport.d.ts +0 -51
- package/dist/browser/WasmSupport.d.ts.map +1 -1
- package/dist/browser/index.cjs +1 -172
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +1 -151
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/WasmSupport.d.cts +0 -51
- package/dist/neutral/WasmSupport.d.cts.map +1 -1
- package/dist/neutral/WasmSupport.d.mts +0 -51
- package/dist/neutral/WasmSupport.d.mts.map +1 -1
- package/dist/neutral/WasmSupport.d.ts +0 -51
- package/dist/neutral/WasmSupport.d.ts.map +1 -1
- package/dist/neutral/index.cjs +1 -172
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +1 -151
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/WasmSupport.d.cts +0 -51
- package/dist/node/WasmSupport.d.cts.map +1 -1
- package/dist/node/WasmSupport.d.mts +0 -51
- package/dist/node/WasmSupport.d.mts.map +1 -1
- package/dist/node/WasmSupport.d.ts +0 -51
- package/dist/node/WasmSupport.d.ts.map +1 -1
- package/dist/node/index.cjs +1 -176
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -150
- package/dist/node/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -24,68 +24,17 @@ export declare class WasmSupport {
|
|
|
24
24
|
private _forceWasm;
|
|
25
25
|
private _isInitialized;
|
|
26
26
|
private _isWasmFeatureSetSupported;
|
|
27
|
-
/**
|
|
28
|
-
* Instance constructor for use where async instantiation
|
|
29
|
-
* is not possible. Where possible, prefer the static
|
|
30
|
-
* create method over use of this constructor directly
|
|
31
|
-
* as no initialization (feature detection) is able to
|
|
32
|
-
* be done here
|
|
33
|
-
* @param desiredFeatures The desired feature set
|
|
34
|
-
*/
|
|
35
27
|
constructor(desiredFeatures: WasmFeature[]);
|
|
36
|
-
/**
|
|
37
|
-
* Is Wasm allowed
|
|
38
|
-
*/
|
|
39
28
|
get allowWasm(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Whether or not to allow WASM usage
|
|
42
|
-
*/
|
|
43
29
|
set allowWasm(v: boolean);
|
|
44
|
-
/**
|
|
45
|
-
* Whether or not Wasm should be used based on the desired
|
|
46
|
-
* feature set, initialization state, or force-use settings
|
|
47
|
-
*/
|
|
48
30
|
get canUseWasm(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Returns a object containing a property for each desired wasm feature
|
|
51
|
-
* with a boolean value indicating whether or not the feature is supported
|
|
52
|
-
*/
|
|
53
31
|
get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>>;
|
|
54
|
-
/**
|
|
55
|
-
* Force use of Wasm
|
|
56
|
-
*/
|
|
57
32
|
get forceWasm(): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Whether or not to force Wasm usage
|
|
60
|
-
*/
|
|
61
33
|
set forceWasm(v: boolean);
|
|
62
|
-
/**
|
|
63
|
-
* Whether or not Wasm is supported based
|
|
64
|
-
* on the desired feature set
|
|
65
|
-
*/
|
|
66
34
|
get isDesiredFeatureSetSupported(): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Whether or not Wasm detection has been run
|
|
69
|
-
* for the desired feature set
|
|
70
|
-
*/
|
|
71
35
|
get isInitialized(): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Static creation & async initialization for use where
|
|
74
|
-
* async instantiation is possible
|
|
75
|
-
* @param desiredFeatures The desired feature set
|
|
76
|
-
* @returns An initialized instance of the class with detection
|
|
77
|
-
* for the desired feature set
|
|
78
|
-
*/
|
|
79
36
|
static create(desiredFeatures: WasmFeature[]): Promise<WasmSupport>;
|
|
80
|
-
/**
|
|
81
|
-
* Checks for specific wasm features
|
|
82
|
-
* @param features The list of features to check for
|
|
83
|
-
* @returns True if all the features are supported, false otherwise
|
|
84
|
-
*/
|
|
85
37
|
featureCheck(features: WasmFeature[]): Promise<boolean>;
|
|
86
|
-
/**
|
|
87
|
-
* Does feature detection for the desired feature set
|
|
88
|
-
*/
|
|
89
38
|
initialize(): Promise<void>;
|
|
90
39
|
protected detectDesiredFeatures(): Promise<void>;
|
|
91
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiBvB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAE3D,qBAAa,WAAW;IAeV,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE;IAdpD,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;
|
|
1
|
+
{"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiBvB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAE3D,qBAAa,WAAW;IAeV,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE;IAdpD,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;gBAUpB,eAAe,EAAE,WAAW,EAAE;IAKpD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAMD,IAAI,UAAU,IAAI,OAAO,CASxB;IAMD,IAAI,cAAc,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAEpE;IAKD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAMD,IAAI,4BAA4B,IAAI,OAAO,CAE1C;IAMD,IAAI,aAAa,IAAI,OAAO,CAE3B;WASY,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAWnE,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAQvD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;cAOjB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;CAQvD"}
|
|
@@ -24,68 +24,17 @@ export declare class WasmSupport {
|
|
|
24
24
|
private _forceWasm;
|
|
25
25
|
private _isInitialized;
|
|
26
26
|
private _isWasmFeatureSetSupported;
|
|
27
|
-
/**
|
|
28
|
-
* Instance constructor for use where async instantiation
|
|
29
|
-
* is not possible. Where possible, prefer the static
|
|
30
|
-
* create method over use of this constructor directly
|
|
31
|
-
* as no initialization (feature detection) is able to
|
|
32
|
-
* be done here
|
|
33
|
-
* @param desiredFeatures The desired feature set
|
|
34
|
-
*/
|
|
35
27
|
constructor(desiredFeatures: WasmFeature[]);
|
|
36
|
-
/**
|
|
37
|
-
* Is Wasm allowed
|
|
38
|
-
*/
|
|
39
28
|
get allowWasm(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Whether or not to allow WASM usage
|
|
42
|
-
*/
|
|
43
29
|
set allowWasm(v: boolean);
|
|
44
|
-
/**
|
|
45
|
-
* Whether or not Wasm should be used based on the desired
|
|
46
|
-
* feature set, initialization state, or force-use settings
|
|
47
|
-
*/
|
|
48
30
|
get canUseWasm(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Returns a object containing a property for each desired wasm feature
|
|
51
|
-
* with a boolean value indicating whether or not the feature is supported
|
|
52
|
-
*/
|
|
53
31
|
get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>>;
|
|
54
|
-
/**
|
|
55
|
-
* Force use of Wasm
|
|
56
|
-
*/
|
|
57
32
|
get forceWasm(): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Whether or not to force Wasm usage
|
|
60
|
-
*/
|
|
61
33
|
set forceWasm(v: boolean);
|
|
62
|
-
/**
|
|
63
|
-
* Whether or not Wasm is supported based
|
|
64
|
-
* on the desired feature set
|
|
65
|
-
*/
|
|
66
34
|
get isDesiredFeatureSetSupported(): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Whether or not Wasm detection has been run
|
|
69
|
-
* for the desired feature set
|
|
70
|
-
*/
|
|
71
35
|
get isInitialized(): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Static creation & async initialization for use where
|
|
74
|
-
* async instantiation is possible
|
|
75
|
-
* @param desiredFeatures The desired feature set
|
|
76
|
-
* @returns An initialized instance of the class with detection
|
|
77
|
-
* for the desired feature set
|
|
78
|
-
*/
|
|
79
36
|
static create(desiredFeatures: WasmFeature[]): Promise<WasmSupport>;
|
|
80
|
-
/**
|
|
81
|
-
* Checks for specific wasm features
|
|
82
|
-
* @param features The list of features to check for
|
|
83
|
-
* @returns True if all the features are supported, false otherwise
|
|
84
|
-
*/
|
|
85
37
|
featureCheck(features: WasmFeature[]): Promise<boolean>;
|
|
86
|
-
/**
|
|
87
|
-
* Does feature detection for the desired feature set
|
|
88
|
-
*/
|
|
89
38
|
initialize(): Promise<void>;
|
|
90
39
|
protected detectDesiredFeatures(): Promise<void>;
|
|
91
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiBvB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAE3D,qBAAa,WAAW;IAeV,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE;IAdpD,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;
|
|
1
|
+
{"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiBvB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAE3D,qBAAa,WAAW;IAeV,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE;IAdpD,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;gBAUpB,eAAe,EAAE,WAAW,EAAE;IAKpD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAMD,IAAI,UAAU,IAAI,OAAO,CASxB;IAMD,IAAI,cAAc,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAEpE;IAKD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAMD,IAAI,4BAA4B,IAAI,OAAO,CAE1C;IAMD,IAAI,aAAa,IAAI,OAAO,CAE3B;WASY,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAWnE,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAQvD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;cAOjB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;CAQvD"}
|
|
@@ -24,68 +24,17 @@ export declare class WasmSupport {
|
|
|
24
24
|
private _forceWasm;
|
|
25
25
|
private _isInitialized;
|
|
26
26
|
private _isWasmFeatureSetSupported;
|
|
27
|
-
/**
|
|
28
|
-
* Instance constructor for use where async instantiation
|
|
29
|
-
* is not possible. Where possible, prefer the static
|
|
30
|
-
* create method over use of this constructor directly
|
|
31
|
-
* as no initialization (feature detection) is able to
|
|
32
|
-
* be done here
|
|
33
|
-
* @param desiredFeatures The desired feature set
|
|
34
|
-
*/
|
|
35
27
|
constructor(desiredFeatures: WasmFeature[]);
|
|
36
|
-
/**
|
|
37
|
-
* Is Wasm allowed
|
|
38
|
-
*/
|
|
39
28
|
get allowWasm(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Whether or not to allow WASM usage
|
|
42
|
-
*/
|
|
43
29
|
set allowWasm(v: boolean);
|
|
44
|
-
/**
|
|
45
|
-
* Whether or not Wasm should be used based on the desired
|
|
46
|
-
* feature set, initialization state, or force-use settings
|
|
47
|
-
*/
|
|
48
30
|
get canUseWasm(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Returns a object containing a property for each desired wasm feature
|
|
51
|
-
* with a boolean value indicating whether or not the feature is supported
|
|
52
|
-
*/
|
|
53
31
|
get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>>;
|
|
54
|
-
/**
|
|
55
|
-
* Force use of Wasm
|
|
56
|
-
*/
|
|
57
32
|
get forceWasm(): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Whether or not to force Wasm usage
|
|
60
|
-
*/
|
|
61
33
|
set forceWasm(v: boolean);
|
|
62
|
-
/**
|
|
63
|
-
* Whether or not Wasm is supported based
|
|
64
|
-
* on the desired feature set
|
|
65
|
-
*/
|
|
66
34
|
get isDesiredFeatureSetSupported(): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Whether or not Wasm detection has been run
|
|
69
|
-
* for the desired feature set
|
|
70
|
-
*/
|
|
71
35
|
get isInitialized(): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Static creation & async initialization for use where
|
|
74
|
-
* async instantiation is possible
|
|
75
|
-
* @param desiredFeatures The desired feature set
|
|
76
|
-
* @returns An initialized instance of the class with detection
|
|
77
|
-
* for the desired feature set
|
|
78
|
-
*/
|
|
79
36
|
static create(desiredFeatures: WasmFeature[]): Promise<WasmSupport>;
|
|
80
|
-
/**
|
|
81
|
-
* Checks for specific wasm features
|
|
82
|
-
* @param features The list of features to check for
|
|
83
|
-
* @returns True if all the features are supported, false otherwise
|
|
84
|
-
*/
|
|
85
37
|
featureCheck(features: WasmFeature[]): Promise<boolean>;
|
|
86
|
-
/**
|
|
87
|
-
* Does feature detection for the desired feature set
|
|
88
|
-
*/
|
|
89
38
|
initialize(): Promise<void>;
|
|
90
39
|
protected detectDesiredFeatures(): Promise<void>;
|
|
91
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiBvB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAE3D,qBAAa,WAAW;IAeV,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE;IAdpD,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;
|
|
1
|
+
{"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiBvB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAE3D,qBAAa,WAAW;IAeV,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE;IAdpD,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,0BAA0B,CAAQ;gBAUpB,eAAe,EAAE,WAAW,EAAE;IAKpD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAMD,IAAI,UAAU,IAAI,OAAO,CASxB;IAMD,IAAI,cAAc,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAEpE;IAKD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,EAEvB;IAMD,IAAI,4BAA4B,IAAI,OAAO,CAE1C;IAMD,IAAI,aAAa,IAAI,OAAO,CAE3B;WASY,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAWnE,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAQvD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;cAOjB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;CAQvD"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -1,173 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var src_exports = {};
|
|
23
|
-
__export(src_exports, {
|
|
24
|
-
WasmFeatureDetectors: () => WasmFeatureDetectors,
|
|
25
|
-
WasmSupport: () => WasmSupport
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(src_exports);
|
|
28
|
-
|
|
29
|
-
// src/WasmSupport.ts
|
|
30
|
-
var import_wasm_feature_detect = require("wasm-feature-detect");
|
|
31
|
-
var WasmFeatureDetectors = {
|
|
32
|
-
bigInt: import_wasm_feature_detect.bigInt,
|
|
33
|
-
bulkMemory: import_wasm_feature_detect.bulkMemory,
|
|
34
|
-
exceptions: import_wasm_feature_detect.exceptions,
|
|
35
|
-
extendedConst: import_wasm_feature_detect.extendedConst,
|
|
36
|
-
gc: import_wasm_feature_detect.gc,
|
|
37
|
-
memory64: import_wasm_feature_detect.memory64,
|
|
38
|
-
multiValue: import_wasm_feature_detect.multiValue,
|
|
39
|
-
mutableGlobals: import_wasm_feature_detect.mutableGlobals,
|
|
40
|
-
referenceTypes: import_wasm_feature_detect.referenceTypes,
|
|
41
|
-
relaxedSimd: import_wasm_feature_detect.relaxedSimd,
|
|
42
|
-
saturatedFloatToInt: import_wasm_feature_detect.saturatedFloatToInt,
|
|
43
|
-
signExtensions: import_wasm_feature_detect.signExtensions,
|
|
44
|
-
simd: import_wasm_feature_detect.simd,
|
|
45
|
-
streamingCompilation: import_wasm_feature_detect.streamingCompilation,
|
|
46
|
-
tailCall: import_wasm_feature_detect.tailCall,
|
|
47
|
-
threads: import_wasm_feature_detect.threads
|
|
48
|
-
};
|
|
49
|
-
var WasmSupport = class _WasmSupport {
|
|
50
|
-
static {
|
|
51
|
-
__name(this, "WasmSupport");
|
|
52
|
-
}
|
|
53
|
-
desiredFeatures;
|
|
54
|
-
_allowWasm;
|
|
55
|
-
_featureSupport;
|
|
56
|
-
_forceWasm;
|
|
57
|
-
_isInitialized;
|
|
58
|
-
_isWasmFeatureSetSupported;
|
|
59
|
-
/**
|
|
60
|
-
* Instance constructor for use where async instantiation
|
|
61
|
-
* is not possible. Where possible, prefer the static
|
|
62
|
-
* create method over use of this constructor directly
|
|
63
|
-
* as no initialization (feature detection) is able to
|
|
64
|
-
* be done here
|
|
65
|
-
* @param desiredFeatures The desired feature set
|
|
66
|
-
*/
|
|
67
|
-
constructor(desiredFeatures) {
|
|
68
|
-
this.desiredFeatures = desiredFeatures;
|
|
69
|
-
this._allowWasm = true;
|
|
70
|
-
this._featureSupport = {};
|
|
71
|
-
this._forceWasm = false;
|
|
72
|
-
this._isInitialized = false;
|
|
73
|
-
this._isWasmFeatureSetSupported = false;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Is Wasm allowed
|
|
77
|
-
*/
|
|
78
|
-
get allowWasm() {
|
|
79
|
-
return this._allowWasm;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Whether or not to allow WASM usage
|
|
83
|
-
*/
|
|
84
|
-
set allowWasm(v) {
|
|
85
|
-
this._allowWasm = v;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Whether or not Wasm should be used based on the desired
|
|
89
|
-
* feature set, initialization state, or force-use settings
|
|
90
|
-
*/
|
|
91
|
-
get canUseWasm() {
|
|
92
|
-
return (
|
|
93
|
-
// Just force WASM
|
|
94
|
-
this._forceWasm || // Or if we haven't checked be optimistic
|
|
95
|
-
this._allowWasm && !this._isInitialized || // Or if we have checked and WASM is not supported, be realistic
|
|
96
|
-
this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Returns a object containing a property for each desired wasm feature
|
|
101
|
-
* with a boolean value indicating whether or not the feature is supported
|
|
102
|
-
*/
|
|
103
|
-
get featureSupport() {
|
|
104
|
-
return {
|
|
105
|
-
...this._featureSupport
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Force use of Wasm
|
|
110
|
-
*/
|
|
111
|
-
get forceWasm() {
|
|
112
|
-
return this._forceWasm;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Whether or not to force Wasm usage
|
|
116
|
-
*/
|
|
117
|
-
set forceWasm(v) {
|
|
118
|
-
this._forceWasm = v;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Whether or not Wasm is supported based
|
|
122
|
-
* on the desired feature set
|
|
123
|
-
*/
|
|
124
|
-
get isDesiredFeatureSetSupported() {
|
|
125
|
-
return this._isWasmFeatureSetSupported;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Whether or not Wasm detection has been run
|
|
129
|
-
* for the desired feature set
|
|
130
|
-
*/
|
|
131
|
-
get isInitialized() {
|
|
132
|
-
return this._isInitialized;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Static creation & async initialization for use where
|
|
136
|
-
* async instantiation is possible
|
|
137
|
-
* @param desiredFeatures The desired feature set
|
|
138
|
-
* @returns An initialized instance of the class with detection
|
|
139
|
-
* for the desired feature set
|
|
140
|
-
*/
|
|
141
|
-
static async create(desiredFeatures) {
|
|
142
|
-
const instance = new _WasmSupport(desiredFeatures);
|
|
143
|
-
await instance.initialize();
|
|
144
|
-
return instance;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Checks for specific wasm features
|
|
148
|
-
* @param features The list of features to check for
|
|
149
|
-
* @returns True if all the features are supported, false otherwise
|
|
150
|
-
*/
|
|
151
|
-
async featureCheck(features) {
|
|
152
|
-
const results = await Promise.all(features.map((feature) => WasmFeatureDetectors[feature]).map(async (detector) => await detector()));
|
|
153
|
-
return results.every(Boolean);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Does feature detection for the desired feature set
|
|
157
|
-
*/
|
|
158
|
-
async initialize() {
|
|
159
|
-
if (this._isInitialized) return;
|
|
160
|
-
await this.detectDesiredFeatures();
|
|
161
|
-
this._isInitialized = true;
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
async detectDesiredFeatures() {
|
|
165
|
-
for (let feature = 0; feature < this.desiredFeatures.length; feature++) {
|
|
166
|
-
const desiredFeature = this.desiredFeatures[feature];
|
|
167
|
-
const detector = WasmFeatureDetectors[desiredFeature];
|
|
168
|
-
this._featureSupport[desiredFeature] = await detector() ? true : false;
|
|
169
|
-
}
|
|
170
|
-
this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
1
|
+
"use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var u=(s,t)=>o(s,"name",{value:t,configurable:!0});var p=(s,t)=>{for(var a in t)o(s,a,{get:t[a],enumerable:!0})},h=(s,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!c.call(s,r)&&r!==a&&o(s,r,{get:()=>t[r],enumerable:!(i=m(t,r))||i.enumerable});return s};var _=s=>h(o({},"__esModule",{value:!0}),s);var f={};p(f,{WasmFeatureDetectors:()=>l,WasmSupport:()=>n});module.exports=_(f);var e=require("wasm-feature-detect");var l={bigInt:e.bigInt,bulkMemory:e.bulkMemory,exceptions:e.exceptions,extendedConst:e.extendedConst,gc:e.gc,memory64:e.memory64,multiValue:e.multiValue,mutableGlobals:e.mutableGlobals,referenceTypes:e.referenceTypes,relaxedSimd:e.relaxedSimd,saturatedFloatToInt:e.saturatedFloatToInt,signExtensions:e.signExtensions,simd:e.simd,streamingCompilation:e.streamingCompilation,tailCall:e.tailCall,threads:e.threads},n=class s{static{u(this,"WasmSupport")}desiredFeatures;_allowWasm;_featureSupport;_forceWasm;_isInitialized;_isWasmFeatureSetSupported;constructor(t){this.desiredFeatures=t,this._allowWasm=!0,this._featureSupport={},this._forceWasm=!1,this._isInitialized=!1,this._isWasmFeatureSetSupported=!1}get allowWasm(){return this._allowWasm}set allowWasm(t){this._allowWasm=t}get canUseWasm(){return this._forceWasm||this._allowWasm&&!this._isInitialized||this._allowWasm&&this._isInitialized&&this._isWasmFeatureSetSupported}get featureSupport(){return{...this._featureSupport}}get forceWasm(){return this._forceWasm}set forceWasm(t){this._forceWasm=t}get isDesiredFeatureSetSupported(){return this._isWasmFeatureSetSupported}get isInitialized(){return this._isInitialized}static async create(t){let a=new s(t);return await a.initialize(),a}async featureCheck(t){return(await Promise.all(t.map(i=>l[i]).map(async i=>await i()))).every(Boolean)}async initialize(){this._isInitialized||(await this.detectDesiredFeatures(),this._isInitialized=!0)}async detectDesiredFeatures(){for(let t=0;t<this.desiredFeatures.length;t++){let a=this.desiredFeatures[t],i=l[a];this._featureSupport[a]=!!await i()}this._isWasmFeatureSetSupported=Object.values(this._featureSupport).every(Boolean)}};
|
|
173
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/WasmSupport.ts"],"sourcesContent":["export * from './WasmSupport'\n","import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n referenceTypes,\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: referenceTypes,\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\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\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(protected desiredFeatures: WasmFeature[]) {}\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\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 * 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 return\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (let feature = 0; feature < this.desiredFeatures.length; feature++) {\n const desiredFeature = this.desiredFeatures[feature]\n const detector = WasmFeatureDetectors[desiredFeature]\n this._featureSupport[desiredFeature] = (await detector()) ? true : false\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/WasmSupport.ts"],"sourcesContent":["export * from './WasmSupport'\n","import {\n bigInt,\n bulkMemory,\n exceptions,\n extendedConst,\n gc,\n memory64,\n multiValue,\n mutableGlobals,\n referenceTypes,\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: referenceTypes,\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\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\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(protected desiredFeatures: WasmFeature[]) {}\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\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 * 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 return\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (let feature = 0; feature < this.desiredFeatures.length; feature++) {\n const desiredFeature = this.desiredFeatures[feature]\n const detector = WasmFeatureDetectors[desiredFeature]\n this._featureSupport[desiredFeature] = (await detector()) ? true : false\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean)\n }\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,gBAAAC,IAAA,eAAAC,EAAAJ,GCAA,IAAAK,EAiBO,+BAEA,IAAMC,EAAuB,CAClCC,OAAQA,SACRC,WAAYA,aACZC,WAAYA,aACZC,cAAeA,gBACfC,GAAIA,KACJC,SAAUA,WACVC,WAAYA,aACZC,eAAgBA,iBAChBC,eAAgBA,iBAChBC,YAAaA,cACbC,oBAAqBA,sBACrBC,eAAgBA,iBAChBC,KAAMA,OACNC,qBAAsBA,uBACtBC,SAAUA,WACVC,QAASA,SACX,EAIaC,EAAN,MAAMA,CAAAA,CAxCb,MAwCaA,CAAAA,EAAAA,oCACHC,WACAC,gBACAC,WACAC,eACAC,2BAURC,YAAsBC,EAAgC,MAAhCA,gBAAAA,OAddN,WAAa,QACbC,gBAAyD,CAAC,OAC1DC,WAAa,QACbC,eAAiB,QACjBC,2BAA6B,EAUkB,CAKvD,IAAIG,WAAqB,CACvB,OAAO,KAAKP,UACd,CAIA,IAAIO,UAAUC,EAAY,CACxB,KAAKR,WAAaQ,CACpB,CAMA,IAAIC,YAAsB,CACxB,OAEE,KAAKP,YAEJ,KAAKF,YAAc,CAAC,KAAKG,gBAEzB,KAAKH,YAAc,KAAKG,gBAAkB,KAAKC,0BAEpD,CAMA,IAAIM,gBAAkE,CACpE,MAAO,CAAE,GAAG,KAAKT,eAAgB,CACnC,CAKA,IAAIU,WAAqB,CACvB,OAAO,KAAKT,UACd,CAIA,IAAIS,UAAUH,EAAY,CACxB,KAAKN,WAAaM,CACpB,CAMA,IAAII,8BAAwC,CAC1C,OAAO,KAAKR,0BACd,CAMA,IAAIS,eAAyB,CAC3B,OAAO,KAAKV,cACd,CASA,aAAaW,OAAOR,EAAsD,CACxE,IAAMS,EAAW,IAAIhB,EAAYO,CAAAA,EACjC,aAAMS,EAASC,WAAU,EAClBD,CACT,CAOA,MAAME,aAAaC,EAA2C,CAE5D,OADgB,MAAMC,QAAQC,IAAIF,EAASG,IAAKC,GAAYxC,EAAqBwC,CAAAA,CAAQ,EAAED,IAAI,MAAOE,GAAa,MAAMA,EAAAA,CAAAA,CAAAA,GAC1GC,MAAMC,OAAAA,CACvB,CAKA,MAAMT,YAA4B,CAC5B,KAAKb,iBACT,MAAM,KAAKuB,sBAAqB,EAChC,KAAKvB,eAAiB,GAExB,CAEA,MAAgBuB,uBAAuC,CACrD,QAASJ,EAAU,EAAGA,EAAU,KAAKhB,gBAAgBqB,OAAQL,IAAW,CACtE,IAAMM,EAAiB,KAAKtB,gBAAgBgB,CAAAA,EACtCC,EAAWzC,EAAqB8C,CAAAA,EACtC,KAAK3B,gBAAgB2B,CAAAA,EAAmB,QAAML,EAAAA,CAChD,CACA,KAAKnB,2BAA6ByB,OAAOC,OAAO,KAAK7B,eAAe,EAAEuB,MAAMC,OAAAA,CAC9E,CACF","names":["src_exports","__export","WasmFeatureDetectors","WasmSupport","__toCommonJS","import_wasm_feature_detect","WasmFeatureDetectors","bigInt","bulkMemory","exceptions","extendedConst","gc","memory64","multiValue","mutableGlobals","referenceTypes","relaxedSimd","saturatedFloatToInt","signExtensions","simd","streamingCompilation","tailCall","threads","WasmSupport","_allowWasm","_featureSupport","_forceWasm","_isInitialized","_isWasmFeatureSetSupported","constructor","desiredFeatures","allowWasm","v","canUseWasm","featureSupport","forceWasm","isDesiredFeatureSetSupported","isInitialized","create","instance","initialize","featureCheck","features","Promise","all","map","feature","detector","every","Boolean","detectDesiredFeatures","length","desiredFeature","Object","values"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,152 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/WasmSupport.ts
|
|
5
|
-
import { bigInt, bulkMemory, exceptions, extendedConst, gc, memory64, multiValue, mutableGlobals, referenceTypes, relaxedSimd, saturatedFloatToInt, signExtensions, simd, streamingCompilation, tailCall, threads } from "wasm-feature-detect";
|
|
6
|
-
var WasmFeatureDetectors = {
|
|
7
|
-
bigInt,
|
|
8
|
-
bulkMemory,
|
|
9
|
-
exceptions,
|
|
10
|
-
extendedConst,
|
|
11
|
-
gc,
|
|
12
|
-
memory64,
|
|
13
|
-
multiValue,
|
|
14
|
-
mutableGlobals,
|
|
15
|
-
referenceTypes,
|
|
16
|
-
relaxedSimd,
|
|
17
|
-
saturatedFloatToInt,
|
|
18
|
-
signExtensions,
|
|
19
|
-
simd,
|
|
20
|
-
streamingCompilation,
|
|
21
|
-
tailCall,
|
|
22
|
-
threads
|
|
23
|
-
};
|
|
24
|
-
var WasmSupport = class _WasmSupport {
|
|
25
|
-
static {
|
|
26
|
-
__name(this, "WasmSupport");
|
|
27
|
-
}
|
|
28
|
-
desiredFeatures;
|
|
29
|
-
_allowWasm;
|
|
30
|
-
_featureSupport;
|
|
31
|
-
_forceWasm;
|
|
32
|
-
_isInitialized;
|
|
33
|
-
_isWasmFeatureSetSupported;
|
|
34
|
-
/**
|
|
35
|
-
* Instance constructor for use where async instantiation
|
|
36
|
-
* is not possible. Where possible, prefer the static
|
|
37
|
-
* create method over use of this constructor directly
|
|
38
|
-
* as no initialization (feature detection) is able to
|
|
39
|
-
* be done here
|
|
40
|
-
* @param desiredFeatures The desired feature set
|
|
41
|
-
*/
|
|
42
|
-
constructor(desiredFeatures) {
|
|
43
|
-
this.desiredFeatures = desiredFeatures;
|
|
44
|
-
this._allowWasm = true;
|
|
45
|
-
this._featureSupport = {};
|
|
46
|
-
this._forceWasm = false;
|
|
47
|
-
this._isInitialized = false;
|
|
48
|
-
this._isWasmFeatureSetSupported = false;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Is Wasm allowed
|
|
52
|
-
*/
|
|
53
|
-
get allowWasm() {
|
|
54
|
-
return this._allowWasm;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Whether or not to allow WASM usage
|
|
58
|
-
*/
|
|
59
|
-
set allowWasm(v) {
|
|
60
|
-
this._allowWasm = v;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Whether or not Wasm should be used based on the desired
|
|
64
|
-
* feature set, initialization state, or force-use settings
|
|
65
|
-
*/
|
|
66
|
-
get canUseWasm() {
|
|
67
|
-
return (
|
|
68
|
-
// Just force WASM
|
|
69
|
-
this._forceWasm || // Or if we haven't checked be optimistic
|
|
70
|
-
this._allowWasm && !this._isInitialized || // Or if we have checked and WASM is not supported, be realistic
|
|
71
|
-
this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Returns a object containing a property for each desired wasm feature
|
|
76
|
-
* with a boolean value indicating whether or not the feature is supported
|
|
77
|
-
*/
|
|
78
|
-
get featureSupport() {
|
|
79
|
-
return {
|
|
80
|
-
...this._featureSupport
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Force use of Wasm
|
|
85
|
-
*/
|
|
86
|
-
get forceWasm() {
|
|
87
|
-
return this._forceWasm;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Whether or not to force Wasm usage
|
|
91
|
-
*/
|
|
92
|
-
set forceWasm(v) {
|
|
93
|
-
this._forceWasm = v;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Whether or not Wasm is supported based
|
|
97
|
-
* on the desired feature set
|
|
98
|
-
*/
|
|
99
|
-
get isDesiredFeatureSetSupported() {
|
|
100
|
-
return this._isWasmFeatureSetSupported;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Whether or not Wasm detection has been run
|
|
104
|
-
* for the desired feature set
|
|
105
|
-
*/
|
|
106
|
-
get isInitialized() {
|
|
107
|
-
return this._isInitialized;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Static creation & async initialization for use where
|
|
111
|
-
* async instantiation is possible
|
|
112
|
-
* @param desiredFeatures The desired feature set
|
|
113
|
-
* @returns An initialized instance of the class with detection
|
|
114
|
-
* for the desired feature set
|
|
115
|
-
*/
|
|
116
|
-
static async create(desiredFeatures) {
|
|
117
|
-
const instance = new _WasmSupport(desiredFeatures);
|
|
118
|
-
await instance.initialize();
|
|
119
|
-
return instance;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Checks for specific wasm features
|
|
123
|
-
* @param features The list of features to check for
|
|
124
|
-
* @returns True if all the features are supported, false otherwise
|
|
125
|
-
*/
|
|
126
|
-
async featureCheck(features) {
|
|
127
|
-
const results = await Promise.all(features.map((feature) => WasmFeatureDetectors[feature]).map(async (detector) => await detector()));
|
|
128
|
-
return results.every(Boolean);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Does feature detection for the desired feature set
|
|
132
|
-
*/
|
|
133
|
-
async initialize() {
|
|
134
|
-
if (this._isInitialized) return;
|
|
135
|
-
await this.detectDesiredFeatures();
|
|
136
|
-
this._isInitialized = true;
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
async detectDesiredFeatures() {
|
|
140
|
-
for (let feature = 0; feature < this.desiredFeatures.length; feature++) {
|
|
141
|
-
const desiredFeature = this.desiredFeatures[feature];
|
|
142
|
-
const detector = WasmFeatureDetectors[desiredFeature];
|
|
143
|
-
this._featureSupport[desiredFeature] = await detector() ? true : false;
|
|
144
|
-
}
|
|
145
|
-
this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
export {
|
|
149
|
-
WasmFeatureDetectors,
|
|
150
|
-
WasmSupport
|
|
151
|
-
};
|
|
1
|
+
var l=Object.defineProperty;var i=(a,e)=>l(a,"name",{value:e,configurable:!0});import{bigInt as n,bulkMemory as u,exceptions as m,extendedConst as d,gc as c,memory64 as p,multiValue as h,mutableGlobals as _,referenceTypes as f,relaxedSimd as W,saturatedFloatToInt as S,signExtensions as F,simd as g,streamingCompilation as w,tailCall as y,threads as I}from"wasm-feature-detect";var r={bigInt:n,bulkMemory:u,exceptions:m,extendedConst:d,gc:c,memory64:p,multiValue:h,mutableGlobals:_,referenceTypes:f,relaxedSimd:W,saturatedFloatToInt:S,signExtensions:F,simd:g,streamingCompilation:w,tailCall:y,threads:I},o=class a{static{i(this,"WasmSupport")}desiredFeatures;_allowWasm;_featureSupport;_forceWasm;_isInitialized;_isWasmFeatureSetSupported;constructor(e){this.desiredFeatures=e,this._allowWasm=!0,this._featureSupport={},this._forceWasm=!1,this._isInitialized=!1,this._isWasmFeatureSetSupported=!1}get allowWasm(){return this._allowWasm}set allowWasm(e){this._allowWasm=e}get canUseWasm(){return this._forceWasm||this._allowWasm&&!this._isInitialized||this._allowWasm&&this._isInitialized&&this._isWasmFeatureSetSupported}get featureSupport(){return{...this._featureSupport}}get forceWasm(){return this._forceWasm}set forceWasm(e){this._forceWasm=e}get isDesiredFeatureSetSupported(){return this._isWasmFeatureSetSupported}get isInitialized(){return this._isInitialized}static async create(e){let t=new a(e);return await t.initialize(),t}async featureCheck(e){return(await Promise.all(e.map(s=>r[s]).map(async s=>await s()))).every(Boolean)}async initialize(){this._isInitialized||(await this.detectDesiredFeatures(),this._isInitialized=!0)}async detectDesiredFeatures(){for(let e=0;e<this.desiredFeatures.length;e++){let t=this.desiredFeatures[e],s=r[t];this._featureSupport[t]=!!await s()}this._isWasmFeatureSetSupported=Object.values(this._featureSupport).every(Boolean)}};export{r as WasmFeatureDetectors,o as WasmSupport};
|
|
152
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -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 referenceTypes,\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: referenceTypes,\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\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\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(protected desiredFeatures: WasmFeature[]) {}\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\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 * 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 return\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (let feature = 0; feature < this.desiredFeatures.length; feature++) {\n const desiredFeature = this.desiredFeatures[feature]\n const detector = WasmFeatureDetectors[desiredFeature]\n this._featureSupport[desiredFeature] = (await detector()) ? true : false\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean)\n }\n}\n"],"mappings":"
|
|
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 referenceTypes,\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: referenceTypes,\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\nexport type WasmFeature = keyof typeof WasmFeatureDetectors\n\nexport class WasmSupport {\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(protected desiredFeatures: WasmFeature[]) {}\n\n /**\n * Is Wasm allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\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 * 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 return\n }\n\n protected async detectDesiredFeatures(): Promise<void> {\n for (let feature = 0; feature < this.desiredFeatures.length; feature++) {\n const desiredFeature = this.desiredFeatures[feature]\n const detector = WasmFeatureDetectors[desiredFeature]\n this._featureSupport[desiredFeature] = (await detector()) ? true : false\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean)\n }\n}\n"],"mappings":"+EAAA,OACEA,UAAAA,EACAC,cAAAA,EACAC,cAAAA,EACAC,iBAAAA,EACAC,MAAAA,EACAC,YAAAA,EACAC,cAAAA,EACAC,kBAAAA,EACAC,kBAAAA,EACAC,eAAAA,EACAC,uBAAAA,EACAC,kBAAAA,EACAC,QAAAA,EACAC,wBAAAA,EACAC,YAAAA,EACAC,WAAAA,MACK,sBAEA,IAAMC,EAAuB,CAClCC,OAAQA,EACRC,WAAYA,EACZC,WAAYA,EACZC,cAAeA,EACfC,GAAIA,EACJC,SAAUA,EACVC,WAAYA,EACZC,eAAgBA,EAChBC,eAAgBA,EAChBC,YAAaA,EACbC,oBAAqBA,EACrBC,eAAgBA,EAChBC,KAAMA,EACNC,qBAAsBA,EACtBC,SAAUA,EACVC,QAASA,CACX,EAIaC,EAAN,MAAMA,CAAAA,CAxCb,MAwCaA,CAAAA,EAAAA,oCACHC,WACAC,gBACAC,WACAC,eACAC,2BAURC,YAAsBC,EAAgC,MAAhCA,gBAAAA,OAddN,WAAa,QACbC,gBAAyD,CAAC,OAC1DC,WAAa,QACbC,eAAiB,QACjBC,2BAA6B,EAUkB,CAKvD,IAAIG,WAAqB,CACvB,OAAO,KAAKP,UACd,CAIA,IAAIO,UAAUC,EAAY,CACxB,KAAKR,WAAaQ,CACpB,CAMA,IAAIC,YAAsB,CACxB,OAEE,KAAKP,YAEJ,KAAKF,YAAc,CAAC,KAAKG,gBAEzB,KAAKH,YAAc,KAAKG,gBAAkB,KAAKC,0BAEpD,CAMA,IAAIM,gBAAkE,CACpE,MAAO,CAAE,GAAG,KAAKT,eAAgB,CACnC,CAKA,IAAIU,WAAqB,CACvB,OAAO,KAAKT,UACd,CAIA,IAAIS,UAAUH,EAAY,CACxB,KAAKN,WAAaM,CACpB,CAMA,IAAII,8BAAwC,CAC1C,OAAO,KAAKR,0BACd,CAMA,IAAIS,eAAyB,CAC3B,OAAO,KAAKV,cACd,CASA,aAAaW,OAAOR,EAAsD,CACxE,IAAMS,EAAW,IAAIhB,EAAYO,CAAAA,EACjC,aAAMS,EAASC,WAAU,EAClBD,CACT,CAOA,MAAME,aAAaC,EAA2C,CAE5D,OADgB,MAAMC,QAAQC,IAAIF,EAASG,IAAKC,GAAYxC,EAAqBwC,CAAAA,CAAQ,EAAED,IAAI,MAAOE,GAAa,MAAMA,EAAAA,CAAAA,CAAAA,GAC1GC,MAAMC,OAAAA,CACvB,CAKA,MAAMT,YAA4B,CAC5B,KAAKb,iBACT,MAAM,KAAKuB,sBAAqB,EAChC,KAAKvB,eAAiB,GAExB,CAEA,MAAgBuB,uBAAuC,CACrD,QAASJ,EAAU,EAAGA,EAAU,KAAKhB,gBAAgBqB,OAAQL,IAAW,CACtE,IAAMM,EAAiB,KAAKtB,gBAAgBgB,CAAAA,EACtCC,EAAWzC,EAAqB8C,CAAAA,EACtC,KAAK3B,gBAAgB2B,CAAAA,EAAmB,QAAML,EAAAA,CAChD,CACA,KAAKnB,2BAA6ByB,OAAOC,OAAO,KAAK7B,eAAe,EAAEuB,MAAMC,OAAAA,CAC9E,CACF","names":["bigInt","bulkMemory","exceptions","extendedConst","gc","memory64","multiValue","mutableGlobals","referenceTypes","relaxedSimd","saturatedFloatToInt","signExtensions","simd","streamingCompilation","tailCall","threads","WasmFeatureDetectors","bigInt","bulkMemory","exceptions","extendedConst","gc","memory64","multiValue","mutableGlobals","referenceTypes","relaxedSimd","saturatedFloatToInt","signExtensions","simd","streamingCompilation","tailCall","threads","WasmSupport","_allowWasm","_featureSupport","_forceWasm","_isInitialized","_isWasmFeatureSetSupported","constructor","desiredFeatures","allowWasm","v","canUseWasm","featureSupport","forceWasm","isDesiredFeatureSetSupported","isInitialized","create","instance","initialize","featureCheck","features","Promise","all","map","feature","detector","every","Boolean","detectDesiredFeatures","length","desiredFeature","Object","values"]}
|