@xyo-network/wasm 7.0.13 → 7.0.15

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.
@@ -1,2 +1,2 @@
1
- export * from './WasmSupport.ts';
1
+ export * from '@xyo-network/sdk-protocol/wasm';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gCAAgC,CAAA"}
@@ -1,178 +1,3 @@
1
- // src/wasmFeatureDetect.ts
2
- var validate = (bytes) => Promise.resolve(WebAssembly.validate(new Uint8Array(bytes)));
3
- var bigInt = async () => {
4
- try {
5
- const mod = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 126, 1, 126, 3, 2, 1, 0, 7, 5, 1, 1, 98, 0, 0, 10, 6, 1, 4, 0, 32, 0, 11]);
6
- const { instance } = await WebAssembly.instantiate(mod);
7
- const fn = instance.exports.b;
8
- return fn(0n) === 0n;
9
- } catch {
10
- return false;
11
- }
12
- };
13
- var bulkMemory = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 1, 10, 14, 1, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11]);
14
- var exceptions = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 8, 1, 6, 0, 6, 64, 25, 11, 11]);
15
- var extendedConst = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 5, 3, 1, 0, 1, 11, 9, 1, 0, 65, 1, 65, 2, 106, 11, 0]);
16
- var gc = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 95, 1, 120, 0]);
17
- var memory64 = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 5, 3, 1, 4, 1]);
18
- var multiValue = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 0, 2, 127, 127, 3, 2, 1, 0, 10, 8, 1, 6, 0, 65, 0, 65, 0, 11]);
19
- var mutableGlobals = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 2, 8, 1, 1, 97, 1, 98, 3, 127, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 5, 1, 1, 97, 3, 1]);
20
- var relaxedSimd = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 15, 1, 13, 0, 65, 1, 253, 15, 65, 2, 253, 15, 253, 128, 2, 11]);
21
- var saturatedFloatToInt = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 12, 1, 10, 0, 67, 0, 0, 0, 0, 252, 0, 26, 11]);
22
- var signExtensions = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 8, 1, 6, 0, 65, 0, 192, 26, 11]);
23
- var simd = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11]);
24
- var streamingCompilation = () => Promise.resolve("compileStreaming" in WebAssembly);
25
- var tailCall = () => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 6, 1, 4, 0, 18, 0, 11]);
26
- var threads = async () => {
27
- try {
28
- const sharedAvailable = typeof MessageChannel !== "undefined" && (() => {
29
- try {
30
- const channel = new MessageChannel();
31
- channel.port1.postMessage(new SharedArrayBuffer(1));
32
- return true;
33
- } catch {
34
- return false;
35
- }
36
- })();
37
- if (!sharedAvailable) return false;
38
- return WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11]));
39
- } catch {
40
- return false;
41
- }
42
- };
43
-
44
- // src/WasmSupport.ts
45
- import { isTruthy } from "@ariestools/sdk";
46
- var WasmFeatureDetectors = {
47
- bigInt,
48
- bulkMemory,
49
- exceptions,
50
- extendedConst,
51
- gc,
52
- memory64,
53
- multiValue,
54
- mutableGlobals,
55
- referenceTypes: () => Promise,
56
- relaxedSimd,
57
- saturatedFloatToInt,
58
- signExtensions,
59
- simd,
60
- streamingCompilation,
61
- tailCall,
62
- threads
63
- };
64
- var WasmSupport = class _WasmSupport {
65
- _allowWasm = true;
66
- _featureSupport = {};
67
- _forceWasm = false;
68
- _isInitialized = false;
69
- _isWasmFeatureSetSupported = false;
70
- desiredFeatures;
71
- /**
72
- * Instance constructor for use where async instantiation
73
- * is not possible. Where possible, prefer the static
74
- * create method over use of this constructor directly
75
- * as no initialization (feature detection) is able to
76
- * be done here
77
- * @param desiredFeatures The desired feature set
78
- */
79
- constructor(desiredFeatures) {
80
- this.desiredFeatures = desiredFeatures;
81
- }
82
- /**
83
- * Static creation & async initialization for use where
84
- * async instantiation is possible
85
- * @param desiredFeatures The desired feature set
86
- * @returns An initialized instance of the class with detection
87
- * for the desired feature set
88
- */
89
- static async create(desiredFeatures) {
90
- const instance = new _WasmSupport(desiredFeatures);
91
- await instance.initialize();
92
- return instance;
93
- }
94
- /**
95
- * Is WebAssembly allowed
96
- */
97
- get allowWasm() {
98
- return this._allowWasm;
99
- }
100
- /**
101
- * Whether or not to allow WebAssembly usage
102
- */
103
- set allowWasm(v) {
104
- this._allowWasm = v;
105
- }
106
- /**
107
- * Whether or not WebAssembly should be used based on the desired
108
- * feature set, initialization state, or force-use settings
109
- */
110
- get canUseWasm() {
111
- return (
112
- // Just force WebAssembly
113
- this._forceWasm || this._allowWasm && !this._isInitialized || this._allowWasm && this._isInitialized && this._isWasmFeatureSetSupported
114
- );
115
- }
116
- /**
117
- * Returns a object containing a property for each desired WebAssembly feature
118
- * with a boolean value indicating whether or not the feature is supported
119
- */
120
- get featureSupport() {
121
- return { ...this._featureSupport };
122
- }
123
- /**
124
- * Force use of WebAssembly
125
- */
126
- get forceWasm() {
127
- return this._forceWasm;
128
- }
129
- /**
130
- * Whether or not to force WebAssembly usage
131
- */
132
- set forceWasm(v) {
133
- this._forceWasm = v;
134
- }
135
- /**
136
- * Whether or not WebAssembly is supported based
137
- * on the desired feature set
138
- */
139
- get isDesiredFeatureSetSupported() {
140
- return this._isWasmFeatureSetSupported;
141
- }
142
- /**
143
- * Whether or not WebAssembly detection has been run
144
- * for the desired feature set
145
- */
146
- get isInitialized() {
147
- return this._isInitialized;
148
- }
149
- async detectDesiredFeatures() {
150
- for (const desiredFeature of this.desiredFeatures) {
151
- const detector = WasmFeatureDetectors[desiredFeature];
152
- this._featureSupport[desiredFeature] = isTruthy(await detector());
153
- }
154
- this._isWasmFeatureSetSupported = Object.values(this._featureSupport).every(Boolean);
155
- }
156
- /**
157
- * Checks for specific WebAssembly features
158
- * @param features The list of features to check for
159
- * @returns True if all the features are supported, false otherwise
160
- */
161
- async featureCheck(features) {
162
- const results = await Promise.all(features.map((feature) => WasmFeatureDetectors[feature]).map(async (detector) => await detector()));
163
- return results.every(Boolean);
164
- }
165
- /**
166
- * Does feature detection for the desired feature set
167
- */
168
- async initialize() {
169
- if (this._isInitialized) return;
170
- await this.detectDesiredFeatures();
171
- this._isInitialized = true;
172
- }
173
- };
174
- export {
175
- WasmFeatureDetectors,
176
- WasmSupport
177
- };
1
+ // src/index.ts
2
+ export * from "@xyo-network/sdk-protocol/wasm";
178
3
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/wasmFeatureDetect.ts", "../../src/WasmSupport.ts"],
4
- "sourcesContent": ["/*\n * Vendored from wasm-feature-detect (MIT, https://github.com/GoogleChromeLabs/wasm-feature-detect)\n * Each detector validates a small precompiled WebAssembly module that exercises one feature.\n */\n\nconst validate = (bytes: number[]): Promise<boolean> => Promise.resolve(WebAssembly.validate(new Uint8Array(bytes)))\n\nexport const bigInt = async (): Promise<boolean> => {\n try {\n const mod = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 126, 1, 126, 3, 2, 1, 0, 7, 5, 1, 1, 98, 0, 0, 10, 6, 1, 4, 0, 32, 0, 11])\n const { instance } = await WebAssembly.instantiate(mod)\n const fn = instance.exports.b as (x: bigint) => bigint\n return fn(0n) === 0n\n } catch {\n return false\n }\n}\n\nexport const bulkMemory = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 1, 10, 14, 1, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11])\n\nexport const exceptions = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 8, 1, 6, 0, 6, 64, 25, 11, 11])\n\nexport const extendedConst = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 5, 3, 1, 0, 1, 11, 9, 1, 0, 65, 1, 65, 2, 106, 11, 0])\n\nexport const gc = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 95, 1, 120, 0])\n\nexport const memory64 = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 5, 3, 1, 4, 1])\n\nexport const multiValue = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 0, 2, 127, 127, 3, 2, 1, 0, 10, 8, 1, 6, 0, 65, 0, 65, 0, 11])\n\nexport const mutableGlobals = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 2, 8, 1, 1, 97, 1, 98, 3, 127, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 5, 1, 1, 97, 3, 1])\n\nexport const relaxedSimd = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 15, 1, 13, 0, 65, 1, 253, 15, 65, 2, 253, 15, 253, 128, 2, 11])\n\nexport const saturatedFloatToInt = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 12, 1, 10, 0, 67, 0, 0, 0, 0, 252, 0, 26, 11])\n\nexport const signExtensions = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 8, 1, 6, 0, 65, 0, 192, 26, 11])\n\nexport const simd = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11])\n\nexport const streamingCompilation = (): Promise<boolean> => Promise.resolve('compileStreaming' in WebAssembly)\n\nexport const tailCall = (): Promise<boolean> => validate([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 6, 1, 4, 0, 18, 0, 11])\n\nexport const threads = async (): Promise<boolean> => {\n try {\n const sharedAvailable = typeof MessageChannel !== 'undefined'\n && (() => {\n try {\n const channel = new MessageChannel()\n channel.port1.postMessage(new SharedArrayBuffer(1))\n return true\n } catch {\n return false\n }\n })()\n if (!sharedAvailable) return false\n return WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11]))\n } catch {\n return false\n }\n}\n", "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 './wasmFeatureDetect.ts'\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 '@ariestools/sdk'\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 protected desiredFeatures: WasmFeature[]\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 * 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 * Is WebAssembly allowed\n */\n get allowWasm(): boolean {\n return this._allowWasm\n }\n\n /**\n * Whether or not to allow WebAssembly usage\n */\n set allowWasm(v: boolean) {\n this._allowWasm = v\n }\n\n /**\n * Whether or not WebAssembly 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 WebAssembly\n this._forceWasm\n // Or if we haven't checked be optimistic\n || (this._allowWasm && !this._isInitialized)\n // Or if we have checked and WebAssembly 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 WebAssembly 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 WebAssembly\n */\n get forceWasm(): boolean {\n return this._forceWasm\n }\n\n /**\n * Whether or not to force WebAssembly usage\n */\n set forceWasm(v: boolean) {\n this._forceWasm = v\n }\n\n /**\n * Whether or not WebAssembly 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 WebAssembly detection has been run\n * for the desired feature set\n */\n get isInitialized(): boolean {\n return this._isInitialized\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 /**\n * Checks for specific WebAssembly 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"],
5
- "mappings": ";AAKA,IAAM,WAAW,CAAC,UAAsC,QAAQ,QAAQ,YAAY,SAAS,IAAI,WAAW,KAAK,CAAC,CAAC;AAE5G,IAAM,SAAS,YAA8B;AAClD,MAAI;AACF,UAAM,MAAM,IAAI,WAAW,CAAC,GAAG,I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AMA,IAAI,gBAAyB;AAC3B,WAAO,KAAK;AAAA,EACd;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,aAAa,UAA2C;AAC5D,UAAM,UAAU,MAAM,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;AACF;",
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["// Compatibility shim: this package re-exports from @xyo-network/sdk-protocol.\nexport * from '@xyo-network/sdk-protocol/wasm'\n"],
5
+ "mappings": ";AACA,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/wasm",
3
- "version": "7.0.13",
3
+ "version": "7.0.15",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -33,23 +33,49 @@
33
33
  "!**/*.test.*",
34
34
  "README.md"
35
35
  ],
36
+ "dependencies": {
37
+ "@xyo-network/sdk-protocol": "~7.0.15"
38
+ },
36
39
  "devDependencies": {
37
- "@ariestools/sdk": "~7.0.8",
40
+ "@ariestools/sdk": "~8.0.2",
41
+ "@ariestools/threads": "~8.0.2",
42
+ "@bitauth/libauth": "~3.0.0",
43
+ "@metamask/providers": "~22.1.1",
44
+ "@noble/post-quantum": "~0.6.1",
38
45
  "@opentelemetry/api": "~1.9.1",
39
46
  "@opentelemetry/sdk-trace-base": "~2.9.0",
40
- "@xylabs/tsconfig": "~8.6.2",
41
- "@xylabs/vitest-extended": "~7.0.8",
47
+ "@scure/base": "~2.2.0",
48
+ "@scure/bip39": "~2.2.0",
49
+ "@xylabs/tsconfig": "~8.6.7",
50
+ "ajv": "~8.20.0",
42
51
  "async-mutex": "~0.5.0",
52
+ "debug": "~4.4.3",
53
+ "ethers": "~6.17.0",
54
+ "hash-wasm": "~4.12.0",
55
+ "idb": "~8.0.3",
56
+ "observable-fns": "~0.6.1",
43
57
  "typescript": "~6.0.3",
44
- "vite": "~8.1.3",
45
- "vitest": "~4.1.9",
58
+ "webextension-polyfill": "~0.12.0",
46
59
  "zod": "~4.4.3"
47
60
  },
48
61
  "peerDependencies": {
49
- "@ariestools/sdk": "^7.0.8",
62
+ "@ariestools/sdk": "^8.0.2",
63
+ "@ariestools/threads": "^8.0.2",
64
+ "@bitauth/libauth": "^3.0.0",
65
+ "@metamask/providers": "^22.1.1",
66
+ "@noble/post-quantum": "^0.6.1",
50
67
  "@opentelemetry/api": "^1.9.1",
51
68
  "@opentelemetry/sdk-trace-base": "^2.9.0",
69
+ "@scure/base": "^2.2.0",
70
+ "@scure/bip39": "^2.2.0",
71
+ "ajv": "^8.20.0",
52
72
  "async-mutex": "^0.5.0",
73
+ "debug": "^4.4.3",
74
+ "ethers": "^6.17.0",
75
+ "hash-wasm": "^4.12.0",
76
+ "idb": "^8.0.3",
77
+ "observable-fns": "^0.6.1",
78
+ "webextension-polyfill": "^0.12.0",
53
79
  "zod": "^4.4.3"
54
80
  },
55
81
  "engines": {
@@ -57,5 +83,6 @@
57
83
  },
58
84
  "publishConfig": {
59
85
  "access": "public"
60
- }
86
+ },
87
+ "deprecated": "Use @xyo-network/sdk-protocol/wasm instead. Replace @xyo-network/wasm with @xyo-network/sdk-protocol/wasm. This package is a compatibility shim only and will not receive further updates."
61
88
  }
@@ -1,110 +0,0 @@
1
- export declare const WasmFeatureDetectors: {
2
- readonly bigInt: () => Promise<boolean>;
3
- readonly bulkMemory: () => Promise<boolean>;
4
- readonly exceptions: () => Promise<boolean>;
5
- readonly extendedConst: () => Promise<boolean>;
6
- readonly gc: () => Promise<boolean>;
7
- readonly memory64: () => Promise<boolean>;
8
- readonly multiValue: () => Promise<boolean>;
9
- readonly mutableGlobals: () => Promise<boolean>;
10
- readonly referenceTypes: () => {
11
- new (executor: (resolve: (value: boolean | PromiseLike<boolean>) => void, reject: (reason?: any) => void) => void): Promise<boolean>;
12
- all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
13
- all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>;
14
- race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
15
- race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
16
- readonly prototype: Promise<any>;
17
- reject<T = never>(reason?: any): Promise<T>;
18
- resolve(): Promise<void>;
19
- resolve<T>(value: T): Promise<Awaited<T>>;
20
- resolve<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
21
- allSettled<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>>; }>;
22
- allSettled<T>(values: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<Awaited<T>>[]>;
23
- any<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
24
- any<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
25
- withResolvers<T>(): PromiseWithResolvers<T>;
26
- try<T, U extends unknown[]>(callbackFn: (...args: U) => T | PromiseLike<T>, ...args: U): Promise<Awaited<T>>;
27
- readonly [Symbol.species]: PromiseConstructor;
28
- };
29
- readonly relaxedSimd: () => Promise<boolean>;
30
- readonly saturatedFloatToInt: () => Promise<boolean>;
31
- readonly signExtensions: () => Promise<boolean>;
32
- readonly simd: () => Promise<boolean>;
33
- readonly streamingCompilation: () => Promise<boolean>;
34
- readonly tailCall: () => Promise<boolean>;
35
- readonly threads: () => Promise<boolean>;
36
- };
37
- export type WasmFeature = keyof typeof WasmFeatureDetectors;
38
- export declare class WasmSupport {
39
- private _allowWasm;
40
- private _featureSupport;
41
- private _forceWasm;
42
- private _isInitialized;
43
- private _isWasmFeatureSetSupported;
44
- protected desiredFeatures: WasmFeature[];
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: WasmFeature[]);
54
- /**
55
- * Static creation & async initialization for use where
56
- * async instantiation is possible
57
- * @param desiredFeatures The desired feature set
58
- * @returns An initialized instance of the class with detection
59
- * for the desired feature set
60
- */
61
- static create(desiredFeatures: WasmFeature[]): Promise<WasmSupport>;
62
- /**
63
- * Is WebAssembly allowed
64
- */
65
- get allowWasm(): boolean;
66
- /**
67
- * Whether or not to allow WebAssembly usage
68
- */
69
- set allowWasm(v: boolean);
70
- /**
71
- * Whether or not WebAssembly should be used based on the desired
72
- * feature set, initialization state, or force-use settings
73
- */
74
- get canUseWasm(): boolean;
75
- /**
76
- * Returns a object containing a property for each desired WebAssembly feature
77
- * with a boolean value indicating whether or not the feature is supported
78
- */
79
- get featureSupport(): Readonly<Partial<Record<WasmFeature, boolean>>>;
80
- /**
81
- * Force use of WebAssembly
82
- */
83
- get forceWasm(): boolean;
84
- /**
85
- * Whether or not to force WebAssembly usage
86
- */
87
- set forceWasm(v: boolean);
88
- /**
89
- * Whether or not WebAssembly is supported based
90
- * on the desired feature set
91
- */
92
- get isDesiredFeatureSetSupported(): boolean;
93
- /**
94
- * Whether or not WebAssembly detection has been run
95
- * for the desired feature set
96
- */
97
- get isInitialized(): boolean;
98
- protected detectDesiredFeatures(): Promise<void>;
99
- /**
100
- * Checks for specific WebAssembly features
101
- * @param features The list of features to check for
102
- * @returns True if all the features are supported, false otherwise
103
- */
104
- featureCheck(features: WasmFeature[]): Promise<boolean>;
105
- /**
106
- * Does feature detection for the desired feature set
107
- */
108
- initialize(): Promise<void>;
109
- }
110
- //# sourceMappingURL=WasmSupport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WasmSupport.d.ts","sourceRoot":"","sources":["../../src/WasmSupport.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,oBAAoB;;;;;;;;;;iGAoCgB,CAAC;;qEAY9B,CAAE;;;;;;;;4EAXjB,CAAC;;;;;iDAQH,GAAA;;;;;;;;;;CA5BO,CAAA;AAIV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAE3D,qBAAa,WAAW;IACtB,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,SAAS,CAAC,eAAe,EAAE,WAAW,EAAE,CAAA;IAExC;;;;;;;OAOG;gBACS,eAAe,EAAE,WAAW,EAAE;IAI1C;;;;;;OAMG;WACU,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAMzE;;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;cAEe,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtD;;;;OAIG;IACG,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAK7D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAKlC"}
@@ -1,16 +0,0 @@
1
- export declare const bigInt: () => Promise<boolean>;
2
- export declare const bulkMemory: () => Promise<boolean>;
3
- export declare const exceptions: () => Promise<boolean>;
4
- export declare const extendedConst: () => Promise<boolean>;
5
- export declare const gc: () => Promise<boolean>;
6
- export declare const memory64: () => Promise<boolean>;
7
- export declare const multiValue: () => Promise<boolean>;
8
- export declare const mutableGlobals: () => Promise<boolean>;
9
- export declare const relaxedSimd: () => Promise<boolean>;
10
- export declare const saturatedFloatToInt: () => Promise<boolean>;
11
- export declare const signExtensions: () => Promise<boolean>;
12
- export declare const simd: () => Promise<boolean>;
13
- export declare const streamingCompilation: () => Promise<boolean>;
14
- export declare const tailCall: () => Promise<boolean>;
15
- export declare const threads: () => Promise<boolean>;
16
- //# sourceMappingURL=wasmFeatureDetect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wasmFeatureDetect.d.ts","sourceRoot":"","sources":["../../src/wasmFeatureDetect.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM,QAAa,OAAO,CAAC,OAAO,CAS9C,CAAA;AAED,eAAO,MAAM,UAAU,QAAO,OAAO,CAAC,OAAO,CAAoJ,CAAA;AAEjM,eAAO,MAAM,UAAU,QAAO,OAAO,CAAC,OAAO,CAA8G,CAAA;AAE3J,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,OAAO,CAAkG,CAAA;AAElJ,eAAO,MAAM,EAAE,QAAO,OAAO,CAAC,OAAO,CAAoE,CAAA;AAEzG,eAAO,MAAM,QAAQ,QAAO,OAAO,CAAC,OAAO,CAA2D,CAAA;AAEtG,eAAO,MAAM,UAAU,QAAO,OAAO,CAAC,OAAO,CAAuH,CAAA;AAEpK,eAAO,MAAM,cAAc,QAAO,OAAO,CAAC,OAAO,CAAgI,CAAA;AAEjL,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,OAAO,CAAmJ,CAAA;AAEjM,eAAO,MAAM,mBAAmB,QAAO,OAAO,CAAC,OAAO,CAA6H,CAAA;AAEnL,eAAO,MAAM,cAAc,QAAO,OAAO,CAAC,OAAO,CAA+G,CAAA;AAEhK,eAAO,MAAM,IAAI,QAAO,OAAO,CAAC,OAAO,CAA8H,CAAA;AAErK,eAAO,MAAM,oBAAoB,QAAO,OAAO,CAAC,OAAO,CAAuD,CAAA;AAE9G,eAAO,MAAM,QAAQ,QAAO,OAAO,CAAC,OAAO,CAAsG,CAAA;AAEjJ,eAAO,MAAM,OAAO,QAAa,OAAO,CAAC,OAAO,CAiB/C,CAAA"}