@denmeh/easyplanner 0.0.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/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # @denmeh/easyplanner
2
+
3
+ Generated by boltffi.
4
+
5
+ Enabled wasm npm targets: bundler, web, nodejs
6
+
7
+ ```ts
8
+ import { initialized } from "@denmeh/easyplanner";
9
+ await initialized;
10
+ ```
package/bundler.js ADDED
@@ -0,0 +1,9 @@
1
+
2
+ import init from "./easyplanner_app.js";
3
+ export * from "./easyplanner_app.js";
4
+ export { default as init } from "./easyplanner_app.js";
5
+ export const initialized = (async () => {
6
+ const response = await fetch(new URL("./easyplanner_app_bg.wasm", import.meta.url));
7
+ await init(response);
8
+ })();
9
+
@@ -0,0 +1,13 @@
1
+ export default function init(source: BufferSource | Response): Promise<void>;
2
+ export interface Point {
3
+ readonly x: number;
4
+ readonly y: number;
5
+ }
6
+ export declare function distance(a: Point, b: Point): number;
7
+ export interface WasmExports {
8
+ boltffi_wasm_abi_version(): number;
9
+ boltffi_wasm_alloc(size: number): number;
10
+ boltffi_wasm_free(ptr: number, size: number): void;
11
+ boltffi_free_buf(ptr: number): void;
12
+ boltffi_distance(a: number, b: number): number;
13
+ }
@@ -0,0 +1,38 @@
1
+ import { instantiateBoltFFI } from "@boltffi/runtime";
2
+ const EXPECTED_ABI_VERSION = 1;
3
+ const _callback_handle_js_namespace_start = 0x80000000;
4
+ const _callback_handle_key = (handle) => handle >>> 0;
5
+ let _module;
6
+ let _exports;
7
+ const _callbackImports = {};
8
+ export default async function init(source) {
9
+ _module = await instantiateBoltFFI(source, EXPECTED_ABI_VERSION, { env: _callbackImports });
10
+ _exports = _module.exports;
11
+ }
12
+ const PointCodec = {
13
+ size: (_v) => 16,
14
+ encode: (writer, v) => {
15
+ writer.writeF64(v.x);
16
+ writer.writeF64(v.y);
17
+ },
18
+ decode: (reader) => {
19
+ return {
20
+ x: reader.readF64(),
21
+ y: reader.readF64(),
22
+ };
23
+ },
24
+ };
25
+ export function distance(a, b) {
26
+ const a_writer = _module.allocWriter(PointCodec.size(a));
27
+ PointCodec.encode(a_writer, a);
28
+ const b_writer = _module.allocWriter(PointCodec.size(b));
29
+ PointCodec.encode(b_writer, b);
30
+ try {
31
+ return _exports.boltffi_distance(a_writer.ptr, b_writer.ptr);
32
+ }
33
+ finally {
34
+ _module.freeWriter(a_writer);
35
+ _module.freeWriter(b_writer);
36
+ }
37
+ }
38
+ //# sourceMappingURL=easyplanner_app.js.map
Binary file
package/node.js ADDED
@@ -0,0 +1,4 @@
1
+
2
+ export * from "./easyplanner_app_node.js";
3
+ export { default, initialized } from "./easyplanner_app_node.js";
4
+
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@denmeh/easyplanner",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./easyplanner_app.d.ts",
8
+ "browser": "./web.js",
9
+ "node": "./node.js",
10
+ "default": "./bundler.js"
11
+ }
12
+ },
13
+ "types": "./easyplanner_app.d.ts",
14
+ "files": [
15
+ "easyplanner_app.js",
16
+ "easyplanner_app.d.ts",
17
+ "easyplanner_app_bg.wasm",
18
+ "bundler.js",
19
+ "web.js",
20
+ "node.js"
21
+ ],
22
+ "dependencies": {
23
+ "@boltffi/runtime": "*"
24
+ },
25
+ "repository": "https://github.com/denmeh/easyplanner"
26
+ }
package/web.js ADDED
@@ -0,0 +1,9 @@
1
+
2
+ import init from "./easyplanner_app.js";
3
+ export * from "./easyplanner_app.js";
4
+ export { default as init } from "./easyplanner_app.js";
5
+ export const initialized = (async () => {
6
+ const response = await fetch(new URL("./easyplanner_app_bg.wasm", import.meta.url));
7
+ await init(response);
8
+ })();
9
+