@danielsimonjr/mathts-wasm 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ npm run asbuild
30
30
  The published entry is AssemblyScript-generated glue in `build/mathts.js` (see
31
31
  `package.json` `exports["."]`). Import named functions directly:
32
32
 
33
- ```typescript
33
+ ```typescript node
34
34
  import { add_f64, sqrt_f64, sin_f64 } from '@danielsimonjr/mathts-wasm';
35
35
 
36
36
  console.log(add_f64(2, 3)); // 5
@@ -1,5 +1,9 @@
1
+ /** `WebAssembly.Memory` when the project has that type, else an object with its `buffer`. */
2
+ export type WasmMemory = typeof globalThis extends { WebAssembly: { Memory: { prototype: infer Instance } } }
3
+ ? Instance
4
+ : { readonly buffer: ArrayBufferLike };
1
5
  /** Exported memory */
2
- export declare const memory: WebAssembly.Memory;
6
+ export declare const memory: WasmMemory;
3
7
  // Exported runtime interface
4
8
  export declare function __new(size: number, id: number): number;
5
9
  export declare function __pin(ptr: number): number;
package/build/mathts.d.ts CHANGED
@@ -1,5 +1,9 @@
1
+ /** `WebAssembly.Memory` when the project has that type, else an object with its `buffer`. */
2
+ export type WasmMemory = typeof globalThis extends { WebAssembly: { Memory: { prototype: infer Instance } } }
3
+ ? Instance
4
+ : { readonly buffer: ArrayBufferLike };
1
5
  /** Exported memory */
2
- export declare const memory: WebAssembly.Memory;
6
+ export declare const memory: WasmMemory;
3
7
  // Exported runtime interface
4
8
  export declare function __new(size: number, id: number): number;
5
9
  export declare function __pin(ptr: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-wasm",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "MathTS WebAssembly module - high-performance numerical computing",
5
5
  "type": "module",
6
6
  "main": "build/mathts.js",
@@ -8,7 +8,8 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./build/mathts.js",
11
- "types": "./build/mathts.d.ts"
11
+ "types": "./build/mathts.d.ts",
12
+ "default": "./build/mathts.js"
12
13
  },
13
14
  "./wasm": {
14
15
  "import": "./build/mathts.wasm"
@@ -26,7 +27,7 @@
26
27
  "asbuild:debug": "asc src/index.ts --target debug",
27
28
  "asbuild:release": "asc src/index.ts --target release",
28
29
  "asbuild": "bun run asbuild:debug && bun run asbuild:release && bun run gen:manifest",
29
- "gen:manifest": "node scripts/gen-wasm-manifest.mjs",
30
+ "gen:manifest": "node scripts/gen-wasm-manifest.mjs && node scripts/patch-dts.mjs",
30
31
  "build": "bun run asbuild && node ../tools/ensure-js-sourcemaps.mjs",
31
32
  "clean": "rm -rf build/",
32
33
  "test": "node tests/run.js && node tests/f64-buffer-clone.test.mjs && node tests/special-numtheory.test.mjs && node tests/polynomial.test.mjs && node tests/signal.test.mjs && node tests/linalg.test.mjs && node tests/curvefit.test.mjs && node tests/optimization.test.mjs && node tests/approx.test.mjs && node tests/tensor.test.mjs && node tests/phase2-kernels.test.mjs && bun run test:diff",
@@ -64,5 +65,8 @@
64
65
  "access": "public"
65
66
  },
66
67
  "homepage": "https://github.com/danielsimonjr/MathTS#readme",
67
- "sideEffects": true
68
+ "sideEffects": true,
69
+ "engines": {
70
+ "node": ">=22.12"
71
+ }
68
72
  }