@xyo-network/wasm 2.74.4 → 2.75.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.
Files changed (38) hide show
  1. package/dist/browser/WasmSupport.cjs +164 -0
  2. package/dist/browser/WasmSupport.cjs.map +1 -0
  3. package/dist/browser/WasmSupport.d.mts.map +1 -0
  4. package/dist/browser/WasmSupport.d.ts.map +1 -0
  5. package/dist/browser/WasmSupport.js +160 -0
  6. package/dist/browser/WasmSupport.js.map +1 -0
  7. package/dist/{index.js → browser/index.cjs} +1 -6
  8. package/dist/browser/index.cjs.map +1 -0
  9. package/dist/{index.d.mts.map → browser/index.d.mts.map} +1 -1
  10. package/dist/{index.d.ts.map → browser/index.d.ts.map} +1 -1
  11. package/dist/{index.mjs → browser/index.js} +1 -1
  12. package/dist/browser/index.js.map +1 -0
  13. package/dist/node/WasmSupport.d.mts +92 -0
  14. package/dist/node/WasmSupport.d.mts.map +1 -0
  15. package/dist/node/WasmSupport.d.ts +92 -0
  16. package/dist/node/WasmSupport.d.ts.map +1 -0
  17. package/dist/node/WasmSupport.js +167 -0
  18. package/dist/node/WasmSupport.js.map +1 -0
  19. package/dist/node/WasmSupport.mjs +159 -0
  20. package/dist/node/WasmSupport.mjs.map +1 -0
  21. package/dist/node/index.d.mts +2 -0
  22. package/dist/node/index.d.mts.map +1 -0
  23. package/dist/node/index.d.ts +2 -0
  24. package/dist/node/index.d.ts.map +1 -0
  25. package/dist/node/index.js +23 -0
  26. package/dist/node/index.js.map +1 -0
  27. package/dist/node/index.mjs +2 -0
  28. package/dist/node/index.mjs.map +1 -0
  29. package/package.json +24 -21
  30. package/dist/WasmSupport.d.mts.map +0 -1
  31. package/dist/WasmSupport.d.ts.map +0 -1
  32. package/dist/docs.json +0 -2888
  33. package/dist/index.js.map +0 -1
  34. package/dist/index.mjs.map +0 -1
  35. /package/dist/{WasmSupport.d.mts → browser/WasmSupport.d.mts} +0 -0
  36. /package/dist/{WasmSupport.d.ts → browser/WasmSupport.d.ts} +0 -0
  37. /package/dist/{index.d.mts → browser/index.d.mts} +0 -0
  38. /package/dist/{index.d.ts → browser/index.d.ts} +0 -0
@@ -0,0 +1,167 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var WasmSupport_exports = {};
20
+ __export(WasmSupport_exports, {
21
+ WasmFeatureDetectors: () => WasmFeatureDetectors,
22
+ WasmSupport: () => WasmSupport
23
+ });
24
+ module.exports = __toCommonJS(WasmSupport_exports);
25
+ var import_wasm_feature_detect = require("wasm-feature-detect");
26
+ const WasmFeatureDetectors = {
27
+ bigInt: import_wasm_feature_detect.bigInt,
28
+ bulkMemory: import_wasm_feature_detect.bulkMemory,
29
+ exceptions: import_wasm_feature_detect.exceptions,
30
+ extendedConst: import_wasm_feature_detect.extendedConst,
31
+ gc: import_wasm_feature_detect.gc,
32
+ memory64: import_wasm_feature_detect.memory64,
33
+ multiValue: import_wasm_feature_detect.multiValue,
34
+ mutableGlobals: import_wasm_feature_detect.mutableGlobals,
35
+ referenceTypes: import_wasm_feature_detect.referenceTypes,
36
+ relaxedSimd: import_wasm_feature_detect.relaxedSimd,
37
+ saturatedFloatToInt: import_wasm_feature_detect.saturatedFloatToInt,
38
+ signExtensions: import_wasm_feature_detect.signExtensions,
39
+ simd: import_wasm_feature_detect.simd,
40
+ streamingCompilation: import_wasm_feature_detect.streamingCompilation,
41
+ tailCall: import_wasm_feature_detect.tailCall,
42
+ threads: import_wasm_feature_detect.threads
43
+ };
44
+ class WasmSupport {
45
+ /**
46
+ * Instance constructor for use where async instantiation
47
+ * is not possible. Where possible, prefer the static
48
+ * create method over use of this constructor directly
49
+ * as no initialization (feature detection) is able to
50
+ * be done here
51
+ * @param desiredFeatures The desired feature set
52
+ */
53
+ constructor(desiredFeatures) {
54
+ this.desiredFeatures = desiredFeatures;
55
+ }
56
+ _allowWasm = true;
57
+ _featureSupport = {};
58
+ _forceWasm = false;
59
+ _isInitialized = false;
60
+ _isWasmFeatureSetSupported = false;
61
+ /**
62
+ * Is Wasm allowed
63
+ */
64
+ get allowWasm() {
65
+ return this._allowWasm;
66
+ }
67
+ /**
68
+ * Whether or not to allow WASM usage
69
+ */
70
+ set allowWasm(v) {
71
+ this._allowWasm = v;
72
+ }
73
+ /**
74
+ * Whether or not Wasm should be used based on the desired
75
+ * feature set, initialization state, or force-use settings
76
+ */
77
+ get canUseWasm() {
78
+ return (
79
+ // Just force WASM
80
+ this._forceWasm || // Or if we haven't checked be optimistic
81
+ this._allowWasm && !this._isInitialized || // Or if we have checked and WASM is not supported, be realistic
82
+ this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported
83
+ );
84
+ }
85
+ /**
86
+ * Returns a object containing a property for each desired wasm feature
87
+ * with a boolean value indicating whether or not the feature is supported
88
+ */
89
+ get featureSupport() {
90
+ return { ...this._featureSupport };
91
+ }
92
+ /**
93
+ * Force use of Wasm
94
+ */
95
+ get forceWasm() {
96
+ return this._forceWasm;
97
+ }
98
+ /**
99
+ * Whether or not to force Wasm usage
100
+ */
101
+ set forceWasm(v) {
102
+ this._forceWasm = v;
103
+ }
104
+ /**
105
+ * Whether or not Wasm is supported based
106
+ * on the desired feature set
107
+ */
108
+ get isDesiredFeatureSetSupported() {
109
+ return this._isWasmFeatureSetSupported;
110
+ }
111
+ /**
112
+ * Whether or not Wasm detection has been run
113
+ * for the desired feature set
114
+ */
115
+ get isInitialized() {
116
+ return this._isInitialized;
117
+ }
118
+ /**
119
+ * Static creation & async initialization for use where
120
+ * async instantiation is possible
121
+ * @param desiredFeatures The desired feature set
122
+ * @returns An initialized instance of the class with detection
123
+ * for the desired feature set
124
+ */
125
+ static async create(desiredFeatures) {
126
+ const instance = new WasmSupport(desiredFeatures);
127
+ await instance.initialize();
128
+ return Promise.resolve(instance);
129
+ }
130
+ /**
131
+ * Checks for specific wasm features
132
+ * @param features The list of features to check for
133
+ * @returns True if all the features are supported, false otherwise
134
+ */
135
+ async featureCheck(features) {
136
+ const results = await Promise.all(features.map((feature) => WasmFeatureDetectors[feature]).map(async (detector) => await detector()));
137
+ return results.every((result) => result);
138
+ }
139
+ /**
140
+ * Does feature detection for the desired feature set
141
+ */
142
+ async initialize() {
143
+ if (this._isInitialized)
144
+ return;
145
+ await this.detectDesiredFeatures();
146
+ this._isInitialized = true;
147
+ return;
148
+ }
149
+ async detectDesiredFeatures() {
150
+ for (let feature = 0; feature < this.desiredFeatures.length; feature++) {
151
+ const desiredFeature = this.desiredFeatures[feature];
152
+ const detector = WasmFeatureDetectors[desiredFeature];
153
+ if (!await detector()) {
154
+ this._featureSupport[desiredFeature] = false;
155
+ } else {
156
+ this._featureSupport[desiredFeature] = true;
157
+ }
158
+ }
159
+ this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every((v) => v);
160
+ }
161
+ }
162
+ // Annotate the CommonJS export names for ESM import in node:
163
+ 0 && (module.exports = {
164
+ WasmFeatureDetectors,
165
+ WasmSupport
166
+ });
167
+ //# sourceMappingURL=WasmSupport.js.map
@@ -0,0 +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 Promise.resolve(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((result) => result)\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 if (!(await detector())) {\n this._featureSupport[desiredFeature] = false\n } else {\n this._featureSupport[desiredFeature] = true\n }\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every((v) => v)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAiBO;AAEA,MAAM,uBAAuB;AAAA,EAClC,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB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,QAAQ,QAAQ,QAAQ;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,aAAa,UAA2C;AAC5D,UAAM,UAAU,MAAM,QAAQ,IAAI,SAAS,IAAI,CAAC,YAAY,qBAAqB,OAAO,CAAC,EAAE,IAAI,OAAO,aAAa,MAAM,SAAS,CAAC,CAAC;AACpI,WAAO,QAAQ,MAAM,CAAC,WAAW,MAAM;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAA4B;AAChC,QAAI,KAAK;AAAgB;AACzB,UAAM,KAAK,sBAAsB;AACjC,SAAK,iBAAiB;AACtB;AAAA,EACF;AAAA,EAEA,MAAgB,wBAAuC;AACrD,aAAS,UAAU,GAAG,UAAU,KAAK,gBAAgB,QAAQ,WAAW;AACtE,YAAM,iBAAiB,KAAK,gBAAgB,OAAO;AACnD,YAAM,WAAW,qBAAqB,cAAc;AACpD,UAAI,CAAE,MAAM,SAAS,GAAI;AACvB,aAAK,gBAAgB,cAAc,IAAI;AAAA,MACzC,OAAO;AACL,aAAK,gBAAgB,cAAc,IAAI;AAAA,MACzC;AAAA,IACF;AACA,SAAK,6BAA6B,OAAO,OAAO,KAAK,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC;AAAA,EACtF;AACF;","names":[]}
@@ -0,0 +1,159 @@
1
+ import {
2
+ bigInt,
3
+ bulkMemory,
4
+ exceptions,
5
+ extendedConst,
6
+ gc,
7
+ memory64,
8
+ multiValue,
9
+ mutableGlobals,
10
+ referenceTypes,
11
+ relaxedSimd,
12
+ saturatedFloatToInt,
13
+ signExtensions,
14
+ simd,
15
+ streamingCompilation,
16
+ tailCall,
17
+ threads
18
+ } from "wasm-feature-detect";
19
+ const WasmFeatureDetectors = {
20
+ bigInt,
21
+ bulkMemory,
22
+ exceptions,
23
+ extendedConst,
24
+ gc,
25
+ memory64,
26
+ multiValue,
27
+ mutableGlobals,
28
+ referenceTypes,
29
+ relaxedSimd,
30
+ saturatedFloatToInt,
31
+ signExtensions,
32
+ simd,
33
+ streamingCompilation,
34
+ tailCall,
35
+ threads
36
+ };
37
+ class WasmSupport {
38
+ /**
39
+ * Instance constructor for use where async instantiation
40
+ * is not possible. Where possible, prefer the static
41
+ * create method over use of this constructor directly
42
+ * as no initialization (feature detection) is able to
43
+ * be done here
44
+ * @param desiredFeatures The desired feature set
45
+ */
46
+ constructor(desiredFeatures) {
47
+ this.desiredFeatures = desiredFeatures;
48
+ }
49
+ _allowWasm = true;
50
+ _featureSupport = {};
51
+ _forceWasm = false;
52
+ _isInitialized = false;
53
+ _isWasmFeatureSetSupported = false;
54
+ /**
55
+ * Is Wasm allowed
56
+ */
57
+ get allowWasm() {
58
+ return this._allowWasm;
59
+ }
60
+ /**
61
+ * Whether or not to allow WASM usage
62
+ */
63
+ set allowWasm(v) {
64
+ this._allowWasm = v;
65
+ }
66
+ /**
67
+ * Whether or not Wasm should be used based on the desired
68
+ * feature set, initialization state, or force-use settings
69
+ */
70
+ get canUseWasm() {
71
+ return (
72
+ // Just force WASM
73
+ this._forceWasm || // Or if we haven't checked be optimistic
74
+ this._allowWasm && !this._isInitialized || // Or if we have checked and WASM is not supported, be realistic
75
+ this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported
76
+ );
77
+ }
78
+ /**
79
+ * Returns a object containing a property for each desired wasm feature
80
+ * with a boolean value indicating whether or not the feature is supported
81
+ */
82
+ get featureSupport() {
83
+ return { ...this._featureSupport };
84
+ }
85
+ /**
86
+ * Force use of Wasm
87
+ */
88
+ get forceWasm() {
89
+ return this._forceWasm;
90
+ }
91
+ /**
92
+ * Whether or not to force Wasm usage
93
+ */
94
+ set forceWasm(v) {
95
+ this._forceWasm = v;
96
+ }
97
+ /**
98
+ * Whether or not Wasm is supported based
99
+ * on the desired feature set
100
+ */
101
+ get isDesiredFeatureSetSupported() {
102
+ return this._isWasmFeatureSetSupported;
103
+ }
104
+ /**
105
+ * Whether or not Wasm detection has been run
106
+ * for the desired feature set
107
+ */
108
+ get isInitialized() {
109
+ return this._isInitialized;
110
+ }
111
+ /**
112
+ * Static creation & async initialization for use where
113
+ * async instantiation is possible
114
+ * @param desiredFeatures The desired feature set
115
+ * @returns An initialized instance of the class with detection
116
+ * for the desired feature set
117
+ */
118
+ static async create(desiredFeatures) {
119
+ const instance = new WasmSupport(desiredFeatures);
120
+ await instance.initialize();
121
+ return Promise.resolve(instance);
122
+ }
123
+ /**
124
+ * Checks for specific wasm features
125
+ * @param features The list of features to check for
126
+ * @returns True if all the features are supported, false otherwise
127
+ */
128
+ async featureCheck(features) {
129
+ const results = await Promise.all(features.map((feature) => WasmFeatureDetectors[feature]).map(async (detector) => await detector()));
130
+ return results.every((result) => result);
131
+ }
132
+ /**
133
+ * Does feature detection for the desired feature set
134
+ */
135
+ async initialize() {
136
+ if (this._isInitialized)
137
+ return;
138
+ await this.detectDesiredFeatures();
139
+ this._isInitialized = true;
140
+ return;
141
+ }
142
+ async detectDesiredFeatures() {
143
+ for (let feature = 0; feature < this.desiredFeatures.length; feature++) {
144
+ const desiredFeature = this.desiredFeatures[feature];
145
+ const detector = WasmFeatureDetectors[desiredFeature];
146
+ if (!await detector()) {
147
+ this._featureSupport[desiredFeature] = false;
148
+ } else {
149
+ this._featureSupport[desiredFeature] = true;
150
+ }
151
+ }
152
+ this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every((v) => v);
153
+ }
154
+ }
155
+ export {
156
+ WasmFeatureDetectors,
157
+ WasmSupport
158
+ };
159
+ //# sourceMappingURL=WasmSupport.mjs.map
@@ -0,0 +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 Promise.resolve(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((result) => result)\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 if (!(await detector())) {\n this._featureSupport[desiredFeature] = false\n } else {\n this._featureSupport[desiredFeature] = true\n }\n }\n this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every((v) => v)\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,EACA;AAAA,OACK;AAEA,MAAM,uBAAuB;AAAA,EAClC;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,EACA;AACF;AAI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,IAAI,SAAS,IAAI,CAAC,YAAY,qBAAqB,OAAO,CAAC,EAAE,IAAI,OAAO,aAAa,MAAM,SAAS,CAAC,CAAC;AACpI,WAAO,QAAQ,MAAM,CAAC,WAAW,MAAM;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAA4B;AAChC,QAAI,KAAK;AAAgB;AACzB,UAAM,KAAK,sBAAsB;AACjC,SAAK,iBAAiB;AACtB;AAAA,EACF;AAAA,EAEA,MAAgB,wBAAuC;AACrD,aAAS,UAAU,GAAG,UAAU,KAAK,gBAAgB,QAAQ,WAAW;AACtE,YAAM,iBAAiB,KAAK,gBAAgB,OAAO;AACnD,YAAM,WAAW,qBAAqB,cAAc;AACpD,UAAI,CAAE,MAAM,SAAS,GAAI;AACvB,aAAK,gBAAgB,cAAc,IAAI;AAAA,MACzC,OAAO;AACL,aAAK,gBAAgB,cAAc,IAAI;AAAA,MACzC;AAAA,IACF;AACA,SAAK,6BAA6B,OAAO,OAAO,KAAK,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC;AAAA,EACtF;AACF;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './WasmSupport';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './WasmSupport';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,23 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./WasmSupport"), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require("./WasmSupport")
22
+ });
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './WasmSupport'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./WasmSupport";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './WasmSupport'\n"],"mappings":"AAAA,cAAc;","names":[]}
package/package.json CHANGED
@@ -14,38 +14,41 @@
14
14
  },
15
15
  "description": "Primary SDK for using XYO Protocol 2.0",
16
16
  "devDependencies": {
17
- "@xylabs/ts-scripts-yarn3": "^3.0.28",
18
- "@xylabs/tsconfig": "^3.0.28",
17
+ "@xylabs/ts-scripts-yarn3": "^3.0.70",
18
+ "@xylabs/tsconfig": "^3.0.70",
19
19
  "typescript": "^5.2.2"
20
20
  },
21
21
  "docs": "dist/docs.json",
22
22
  "exports": {
23
23
  ".": {
24
- "require": {
25
- "types": "./dist/index.d.ts",
26
- "default": "./dist/index.js"
24
+ "browser": {
25
+ "require": {
26
+ "types": "./dist/browser/index.d.ts",
27
+ "default": "./dist/browser/index.cjs"
28
+ },
29
+ "import": {
30
+ "types": "./dist/browser/index.d.mts",
31
+ "default": "./dist/browser/index.js"
32
+ }
27
33
  },
28
- "import": {
29
- "types": "./dist/index.d.mts",
30
- "default": "./dist/index.mjs"
34
+ "node": {
35
+ "require": {
36
+ "types": "./dist/node/index.d.ts",
37
+ "default": "./dist/node/index.js"
38
+ },
39
+ "import": {
40
+ "types": "./dist/node/index.d.mts",
41
+ "default": "./dist/node/index.mjs"
42
+ }
31
43
  }
32
44
  },
33
- "./dist/docs.json": {
34
- "default": "./dist/docs.json"
35
- },
36
- "./cjs": {
37
- "default": "./dist/index.js"
38
- },
39
45
  "./docs": {
40
46
  "default": "./dist/docs.json"
41
47
  },
42
- "./esm": {
43
- "default": "./dist/index.mjs"
44
- },
45
48
  "./package.json": "./package.json"
46
49
  },
47
- "main": "dist/index.js",
48
- "module": "dist/index.mjs",
50
+ "main": "dist/node/index.js",
51
+ "module": "dist/node/index.mjs",
49
52
  "homepage": "https://xyo.network",
50
53
  "license": "LGPL-3.0-or-later",
51
54
  "publishConfig": {
@@ -56,6 +59,6 @@
56
59
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
57
60
  },
58
61
  "sideEffects": false,
59
- "types": "dist/index.d.ts",
60
- "version": "2.74.4"
62
+ "types": "dist/node/index.d.ts",
63
+ "version": "2.75.0"
61
64
  }
@@ -1 +0,0 @@
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,C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