@moltendb-web/core 1.0.0-rc.1 → 1.0.0-rc.4

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
@@ -1,12 +1,12 @@
1
- # MoltenDB Web
1
+ # MoltenDb Web
2
2
 
3
3
  <div align="center">
4
- <img src="../../assets/logo.png" alt="MoltenDB Logo" width="64"/>
4
+ <img src="../../assets/logo.png" alt="MoltenDb Logo" width="64"/>
5
5
 
6
6
  ### 🌋 The Embedded Database for the Modern Web
7
7
  **High-performance Rust engine compiled to WASM. Persistent storage via OPFS.**
8
8
 
9
- [Interactive Demo](https://stackblitz.com/~/github.com/maximilian27/moltendb-wasm-demo?file=package.json) • [Core Engine](https://www.npmjs.com/package/@moltendb-web/core) • [Query Builder](https://www.npmjs.com/package/@moltendb-web/query) • [Original Repository](https://github.com/maximilian27/MoltenDB) • [License](LICENSE.md)
9
+ [Interactive Demo](https://stackblitz.com/~/github.com/maximilian27/moltendb-wasm-demo?file=package.json) • [Core Engine](https://www.npmjs.com/package/@moltendb-web/core) • [Query Builder](https://www.npmjs.com/package/@moltendb-web/query) • [Original Repository](https://github.com/maximilian27/MoltenDb) • [License](LICENSE.md)
10
10
 
11
11
  [![NPM Version](https://img.shields.io/npm/v/@moltendb-web/core?style=flat-square&color=orange)](https://www.npmjs.com/package/@moltendb-web/core)
12
12
  [![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE.md)
@@ -17,15 +17,15 @@
17
17
 
18
18
  ---
19
19
 
20
- ## What is MoltenDB Web?
20
+ ## What is MoltenDb Web?
21
21
 
22
- MoltenDB is a JSON document database written in Rust that runs directly in your browser. Unlike traditional browser databases limited by `localStorage` quotas or IndexedDB's complex API, MoltenDB leverages the **Origin Private File System (OPFS)** to provide a high-performance, append-only storage engine.
22
+ MoltenDb is a JSON document database written in Rust that runs directly in your browser. Unlike traditional browser databases limited by `localStorage` quotas or IndexedDB's complex API, MoltenDb leverages the **Origin Private File System (OPFS)** to provide a high-performance, append-only storage engine.
23
23
 
24
24
  > **🚀 Release Candidate** — The core engine, multi-tab sync, and storage layer are feature-complete and stabilised for v1. Server sync, encryption and analytics are planned for a future release.
25
25
 
26
26
  ### 🎮 Explore the Full Functionality
27
27
 
28
- The best way to experience MoltenDB is through the **[Interactive Demo on StackBlitz](https://stackblitz.com/~/github.com/maximilian27/moltendb-wasm-demo?file=package.json)**. It provides a complete, live environment where you can test query builder expressions, perform mutations, and see real-time events with zero local setup.
28
+ The best way to experience MoltenDb is through the **[Interactive Demo on StackBlitz](https://stackblitz.com/~/github.com/maximilian27/moltendb-wasm-demo?file=package.json)**. It provides a complete, live environment where you can test query builder expressions, perform mutations, and see real-time events with zero local setup.
29
29
 
30
30
  Prefer to run it in your own environment? You can **[clone the demo repository](https://github.com/maximilian27/moltendb-wasm-demo)** to inspect the source code, run the explorers locally, and experiment with your own schema.
31
31
 
@@ -37,7 +37,7 @@ Prefer to run it in your own environment? You can **[clone the demo repository](
37
37
  - **Worker-Threaded:** The database runs entirely inside a Web Worker—zero impact on your UI thread.
38
38
  - **Multi-Tab Sync (stabilised):** Leader election via the Web Locks API ensures only one tab owns the OPFS handle. All other tabs proxy reads and writes through a `BroadcastChannel`. Seamless leader promotion when the active tab closes.
39
39
  - **Automatic Compaction:** The engine automatically compacts the append-only log when it exceeds **500 entries or 5 MB**, keeping storage lean without any manual intervention.
40
- - **Real-Time Pub/Sub:** Every write and delete emits a typed `DBEvent` to all open tabs instantly. The `subscribe()` pattern supports multiple independent listeners per tab — perfect for modern UI frameworks like React and Angular.
40
+ - **Real-Time Pub/Sub:** Every write and delete emits a typed `DbEvent` to all open tabs instantly. The `subscribe()` pattern supports multiple independent listeners per tab — perfect for modern UI frameworks like React and Angular.
41
41
  - **GraphQL-style Selection:** Request only the fields you need (even deeply nested ones) to save memory and CPU.
42
42
  - **Auto-Indexing:** The engine monitors your queries and automatically creates indexes for frequently filtered fields.
43
43
  - **Conflict Resolution:** Incoming writes with `_v ≤ stored _v` are silently skipped.
@@ -47,7 +47,7 @@ Prefer to run it in your own environment? You can **[clone the demo repository](
47
47
 
48
48
  ## Installation
49
49
 
50
- MoltenDB is split into two packages: the core engine and the type-safe, chainable query builder.
50
+ MoltenDb is split into two packages: the core engine and the type-safe, chainable query builder.
51
51
 
52
52
  ```bash
53
53
  # Install the core engine and WASM artifacts
@@ -58,7 +58,7 @@ npm install @moltendb-web/query
58
58
  ```
59
59
  📦 **Bundler Setup**
60
60
 
61
- MoltenDB handles its own Web Workers and WASM loading automatically. However, depending on your build tool, you may need a tiny config tweak to ensure it serves the static files correctly.
61
+ MoltenDb handles its own Web Workers and WASM loading automatically. However, depending on your build tool, you may need a tiny config tweak to ensure it serves the static files correctly.
62
62
 
63
63
  **For Vite:**
64
64
  Exclude the core package from pre-bundling in your vite.config.js:
@@ -85,17 +85,17 @@ module.exports = {
85
85
  # Quick Start
86
86
  1. Initialize the Client
87
87
 
88
- MoltenDB handles the Web Worker and WASM instantiation for you.
88
+ MoltenDb handles the Web Worker and WASM instantiation for you.
89
89
  TypeScript
90
90
  ```ts
91
- import { MoltenDB } from '@moltendb-web/core';
92
- import { MoltenDBClient, WorkerTransport } from '@moltendb-web/query';
91
+ import { MoltenDb } from '@moltendb-web/core';
92
+ import { MoltenDbClient, WorkerTransport } from '@moltendb-web/query';
93
93
 
94
- const db = new MoltenDB('moltendb_demo');
94
+ const db = new MoltenDb('moltendb_demo');
95
95
  await db.init();
96
96
 
97
97
  // Connect the query builder to the WASM worker
98
- const client = new MoltenDBClient(db);
98
+ const client = new MoltenDbClient(db);
99
99
 
100
100
  // 2. Insert and Query
101
101
 
@@ -200,7 +200,7 @@ await client.collection('laptops')
200
200
 
201
201
  // Supported Query Operators
202
202
 
203
- MoltenDB supports a variety of operators in the `where` clause:
203
+ MoltenDb supports a variety of operators in the `where` clause:
204
204
 
205
205
  | Operator | Aliases | Description |
206
206
  |---|---|---|
@@ -248,14 +248,14 @@ await client.collection('laptops')
248
248
 
249
249
  ### How the Log Works
250
250
 
251
- MoltenDB uses an append-only JSON log. Every write is a new line, ensuring your data is safe even if the tab is closed unexpectedly.
251
+ MoltenDb uses an append-only JSON log. Every write is a new line, ensuring your data is safe even if the tab is closed unexpectedly.
252
252
 
253
253
  - **Automatic Compaction:** When the log exceeds **500 entries or 5 MB**, the engine automatically "squashes" the log, removing superseded document versions to reclaim space. No manual `compact()` calls are needed in normal operation.
254
254
  - **Persistence:** All data is stored in the Origin Private File System (OPFS). This is a special file system for web apps that provides much higher performance than IndexedDB.
255
255
 
256
256
  ### Multi-Tab Sync
257
257
 
258
- MoltenDB uses the **Web Locks API** for leader election. The first tab to acquire the lock becomes the *leader* and owns the OPFS file handle directly. Every subsequent tab becomes a *follower* and proxies all reads and writes through a `BroadcastChannel` to the leader.
258
+ MoltenDb uses the **Web Locks API** for leader election. The first tab to acquire the lock becomes the *leader* and owns the OPFS file handle directly. Every subsequent tab becomes a *follower* and proxies all reads and writes through a `BroadcastChannel` to the leader.
259
259
 
260
260
  When the leader tab is closed, the next queued follower automatically acquires the lock and promotes itself to leader — no data loss, no manual reconnection required.
261
261
 
@@ -268,12 +268,12 @@ Tab 1 (Leader) ──owns──▶ Web Worker ──▶ WASM Engine ──▶ OP
268
268
 
269
269
  ### Real-Time Events (Pub/Sub)
270
270
 
271
- MoltenDB has a built-in pub/sub system that automatically notifies **all open tabs** whenever a document is created, updated, or deleted — no polling required.
271
+ MoltenDb has a built-in pub/sub system that automatically notifies **all open tabs** whenever a document is created, updated, or deleted — no polling required.
272
272
 
273
273
  You can attach multiple independent listeners using the subscribe() method, making it trivial to keep different UI components (like React hooks or Angular signals) in sync without memory leaks:
274
274
 
275
275
  ```ts
276
- const db = new MoltenDB('my-app');
276
+ const db = new MoltenDb('my-app');
277
277
  await db.init();
278
278
 
279
279
  // Attach a listener (Returns an unsubscribe function)
@@ -298,21 +298,21 @@ db.subscribe(({ event, collection, key }) => {
298
298
  });
299
299
  ```
300
300
 
301
- The `DBEvent` type is exported from the package for full TypeScript support:
301
+ The `DbEvent` type is exported from the package for full TypeScript support:
302
302
 
303
303
  ```ts
304
- import { MoltenDB, DBEvent } from '@moltendb-web/core';
304
+ import { MoltenDb, DbEvent } from '@moltendb-web/core';
305
305
 
306
- const db = new MoltenDB('my-app');
306
+ const db = new MoltenDb('my-app');
307
307
  await db.init();
308
308
 
309
- db.subscribe((e: DBEvent) => { /* fully typed */ });```
309
+ db.subscribe((e: DbEvent) => { /* fully typed */ });```
310
310
 
311
311
  ---
312
312
 
313
313
  ### Performance Note
314
314
 
315
- Because MoltenDB uses OPFS, your browser must support `SharedArrayBuffer`. Most modern browsers support this, but your server must send the following headers:
315
+ Because MoltenDb uses OPFS, your browser must support `SharedArrayBuffer`. Most modern browsers support this, but your server must send the following headers:
316
316
 
317
317
  ```http
318
318
  Cross-Origin-Opener-Policy: same-origin
@@ -356,7 +356,7 @@ npm run test:coverage # with coverage report
356
356
 
357
357
  This monorepo contains the following packages:
358
358
 
359
- - **`packages/core`:** The core WASM engine, Web Worker logic, and the MoltenDB main client.
359
+ - **`packages/core`:** The core WASM engine, Web Worker logic, and the MoltenDb main client.
360
360
  - **`packages/query`:** The type-safe, chainable Query Builder.
361
361
 
362
362
  ## Roadmap
@@ -366,7 +366,7 @@ This monorepo contains the following packages:
366
366
  - [x] **Rich Test Suite:** 50 unit, integration, and stress tests via Vitest — **stabilised in RC1**.
367
367
  - [ ] **React Adapter:** Official `@moltendb-web/react` package with `useQuery` hooks and real-time context providers.
368
368
  - [ ] **Angular Adapter:** Official `@moltendb-web/angular` package featuring RxJS observables and Signal-based data fetching.
369
- - [ ] **Delta Sync:** Automatic two-way sync with the MoltenDB Rust server.
369
+ - [ ] **Delta Sync:** Automatic two-way sync with the MoltenDb Rust server.
370
370
  - [ ] **Data Encryption:** Transparent encryption-at-rest using hardware-backed keys (Web Crypto API).
371
371
  - [ ] **Analytics Functionality:** Run complex analytics queries straight in the browser without blocking the UI.
372
372
 
@@ -379,8 +379,8 @@ Found a bug or have a feature request? Please open an issue on the [GitHub issue
379
379
 
380
380
  ## License
381
381
 
382
- The MoltenDB Web packages (`@moltendb-web/core` and `@moltendb-web/query`) are licensed under the MIT License.
382
+ The MoltenDb Web packages (`@moltendb-web/core` and `@moltendb-web/query`) are licensed under the MIT License.
383
383
 
384
- The **MoltenDB Server** (Rust backend) remains under the Business Source License 1.1 (Free for organizations under $5M revenue, requires a license for managed services).
384
+ The **MoltenDb Server** (Rust backend) remains under the Business Source License 1.1 (Free for organizations under $5M revenue, requires a license for managed services).
385
385
 
386
386
  For commercial licensing or questions: [maximilian.both27@outlook.com](mailto:maximilian.both27@outlook.com)
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Recursively converts JS Maps (WASM default) into Plain Objects.
3
+ */
4
+ export declare function mapToObj(data: any): any;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Recursively converts JS Maps (WASM default) into Plain Objects.
3
+ */
4
+ export function mapToObj(data) {
5
+ if (data instanceof Map) {
6
+ const obj = {};
7
+ data.forEach((value, key) => {
8
+ obj[key] = mapToObj(value);
9
+ });
10
+ return obj;
11
+ }
12
+ if (Array.isArray(data)) {
13
+ return data.map(mapToObj);
14
+ }
15
+ return data;
16
+ }
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export interface MoltenDBOptions {
1
+ export interface MoltenDbOptions {
2
2
  /** URL or path to moltendb-worker.js. */
3
3
  workerUrl?: string | URL;
4
4
  }
5
- export interface DBEvent {
5
+ export interface DbEvent {
6
6
  type: 'event';
7
7
  event: 'change' | 'delete' | 'drop';
8
8
  collection: string;
9
9
  key: string;
10
10
  new_v: number | null;
11
11
  }
12
- export declare class MoltenDB {
12
+ export declare class MoltenDb {
13
13
  readonly dbName: string;
14
14
  readonly workerUrl?: string | URL;
15
15
  worker: Worker | null;
@@ -17,16 +17,16 @@ export declare class MoltenDB {
17
17
  isLeader: boolean;
18
18
  private bc;
19
19
  /** Legacy global hook. Use `subscribe()` for multi-component listeners. */
20
- onEvent?: (event: DBEvent) => void;
20
+ onEvent?: (event: DbEvent) => void;
21
21
  private eventListeners;
22
- constructor(dbName?: string, options?: MoltenDBOptions);
22
+ constructor(dbName?: string, options?: MoltenDbOptions);
23
23
  /**
24
24
  * ⚡ Subscribe to real-time DB mutations.
25
25
  * @returns An unsubscribe function to prevent memory leaks in UI frameworks.
26
26
  */
27
- subscribe(listener: (event: DBEvent) => void): () => void;
27
+ subscribe(listener: (event: DbEvent) => void): () => void;
28
28
  /** Manually remove a specific listener */
29
- unsubscribe(listener: (event: DBEvent) => void): void;
29
+ unsubscribe(listener: (event: DbEvent) => void): void;
30
30
  private dispatchEvent;
31
31
  private initialized;
32
32
  init(): Promise<void>;
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export class MoltenDB {
1
+ import { mapToObj } from "./helpers";
2
+ export class MoltenDb {
2
3
  dbName;
3
4
  workerUrl;
4
5
  worker = null;
@@ -33,7 +34,7 @@ export class MoltenDB {
33
34
  listener(event);
34
35
  }
35
36
  catch (err) {
36
- console.error('[MoltenDB] Error in subscribed listener', err);
37
+ console.error('[MoltenDb] Error in subscribed listener', err);
37
38
  }
38
39
  }
39
40
  }
@@ -60,7 +61,7 @@ export class MoltenDB {
60
61
  this.startAsFollower();
61
62
  resolveInit();
62
63
  navigator.locks.request(`moltendb_lock_${this.dbName}`, async () => {
63
- console.log(`[MoltenDB] Promoting this tab to Leader.`);
64
+ console.log(`[MoltenDb] Promoting this tab to Leader.`);
64
65
  await this.startAsLeader();
65
66
  return new Promise(() => { }); // Hold lock
66
67
  });
@@ -74,7 +75,7 @@ export class MoltenDB {
74
75
  await navigator.storage.getDirectory();
75
76
  }
76
77
  catch {
77
- throw new Error('[MoltenDB] Origin Private File System (OPFS) is not available in this browser context. ' +
78
+ throw new Error('[MoltenDb] Origin Private File System (OPFS) is not available in this browser context. ' +
78
79
  'Try a non-private window or a browser that supports OPFS (Chrome 102+, Firefox 111+, Safari 15.2+).');
79
80
  }
80
81
  this.isLeader = true;
@@ -138,21 +139,25 @@ export class MoltenDB {
138
139
  };
139
140
  }
140
141
  async sendMessage(action, payload) {
141
- const id = crypto.randomUUID();
142
+ // Generate a unique ID (random fallback for test environments without crypto.randomUUID)
143
+ const id = (typeof crypto !== 'undefined' && crypto.randomUUID)
144
+ ? crypto.randomUUID()
145
+ : Math.random().toString(36).substring(2, 9);
142
146
  return new Promise((resolve, reject) => {
147
+ const successHandler = (res) => resolve(mapToObj(res));
143
148
  if (this.isLeader && this.worker) {
144
- this.pendingRequests.set(id, { resolve, reject });
149
+ this.pendingRequests.set(id, { resolve: successHandler, reject });
145
150
  this.worker.postMessage({ id, action, ...payload });
146
151
  }
147
152
  else {
148
153
  const timer = setTimeout(() => {
149
154
  if (this.pendingRequests.has(id)) {
150
155
  this.pendingRequests.delete(id);
151
- reject(new Error(`[MoltenDB] Request "${action}" timed out.`));
156
+ reject(new Error(`[MoltenDb] Request "${action}" timed out.`));
152
157
  }
153
158
  }, 10000);
154
159
  this.pendingRequests.set(id, {
155
- resolve: (v) => { clearTimeout(timer); resolve(v); },
160
+ resolve: (res) => { clearTimeout(timer); successHandler(res); },
156
161
  reject: (e) => { clearTimeout(timer); reject(e); }
157
162
  });
158
163
  this.bc.postMessage({ type: 'query', id, action, payload });
@@ -1,4 +1,4 @@
1
- import init, { WorkerDb } from './moltendb.js';
1
+ import init, { WorkerDb } from './wasm/moltendb.js';
2
2
  let db = null;
3
3
  let initPromise = null;
4
4
  self.onmessage = async (e) => {
@@ -17,7 +17,7 @@ self.onmessage = async (e) => {
17
17
  self.postMessage({ type: 'event', ...eventData });
18
18
  }
19
19
  catch (err) {
20
- console.error('[MoltenDB Worker] Event parse error', err);
20
+ console.error('[MoltenDb Worker] Event parse error', err);
21
21
  }
22
22
  });
23
23
  db = instance;
@@ -93,9 +93,9 @@ export interface InitOutput {
93
93
  readonly workerdb_handle_message: (a: number, b: number, c: number) => void;
94
94
  readonly workerdb_new: (a: number, b: number) => number;
95
95
  readonly workerdb_subscribe: (a: number, b: number) => void;
96
- readonly __wasm_bindgen_func_elem_3613: (a: number, b: number) => void;
97
- readonly __wasm_bindgen_func_elem_3697: (a: number, b: number, c: number, d: number) => void;
98
- readonly __wasm_bindgen_func_elem_3702: (a: number, b: number, c: number, d: number) => void;
96
+ readonly __wasm_bindgen_func_elem_3628: (a: number, b: number) => void;
97
+ readonly __wasm_bindgen_func_elem_3707: (a: number, b: number, c: number, d: number) => void;
98
+ readonly __wasm_bindgen_func_elem_3718: (a: number, b: number, c: number, d: number) => void;
99
99
  readonly __wbindgen_export: (a: number, b: number) => number;
100
100
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
101
101
  readonly __wbindgen_export3: (a: number) => void;
@@ -389,7 +389,7 @@ function __wbg_get_imports() {
389
389
  const a = state0.a;
390
390
  state0.a = 0;
391
391
  try {
392
- return __wasm_bindgen_func_elem_3702(a, state0.b, arg0, arg1);
392
+ return __wasm_bindgen_func_elem_3718(a, state0.b, arg0, arg1);
393
393
  } finally {
394
394
  state0.a = a;
395
395
  }
@@ -509,8 +509,8 @@ function __wbg_get_imports() {
509
509
  return ret;
510
510
  }, arguments); },
511
511
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
512
- // Cast intrinsic for `Closure(Closure { dtor_idx: 664, function: Function { arguments: [Externref], shim_idx: 677, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
513
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3613, __wasm_bindgen_func_elem_3697);
512
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 664, function: Function { arguments: [Externref], shim_idx: 675, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
513
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3628, __wasm_bindgen_func_elem_3707);
514
514
  return addHeapObject(ret);
515
515
  },
516
516
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -547,10 +547,10 @@ function __wbg_get_imports() {
547
547
  };
548
548
  }
549
549
 
550
- function __wasm_bindgen_func_elem_3697(arg0, arg1, arg2) {
550
+ function __wasm_bindgen_func_elem_3707(arg0, arg1, arg2) {
551
551
  try {
552
552
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
553
- wasm.__wasm_bindgen_func_elem_3697(retptr, arg0, arg1, addHeapObject(arg2));
553
+ wasm.__wasm_bindgen_func_elem_3707(retptr, arg0, arg1, addHeapObject(arg2));
554
554
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
555
555
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
556
556
  if (r1) {
@@ -561,8 +561,8 @@ function __wasm_bindgen_func_elem_3697(arg0, arg1, arg2) {
561
561
  }
562
562
  }
563
563
 
564
- function __wasm_bindgen_func_elem_3702(arg0, arg1, arg2, arg3) {
565
- wasm.__wasm_bindgen_func_elem_3702(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
564
+ function __wasm_bindgen_func_elem_3718(arg0, arg1, arg2, arg3) {
565
+ wasm.__wasm_bindgen_func_elem_3718(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
566
566
  }
567
567
 
568
568
  const WorkerDbFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -6,9 +6,9 @@ export const workerdb_analytics: (a: number, b: number, c: number, d: number) =>
6
6
  export const workerdb_handle_message: (a: number, b: number, c: number) => void;
7
7
  export const workerdb_new: (a: number, b: number) => number;
8
8
  export const workerdb_subscribe: (a: number, b: number) => void;
9
- export const __wasm_bindgen_func_elem_3613: (a: number, b: number) => void;
10
- export const __wasm_bindgen_func_elem_3697: (a: number, b: number, c: number, d: number) => void;
11
- export const __wasm_bindgen_func_elem_3702: (a: number, b: number, c: number, d: number) => void;
9
+ export const __wasm_bindgen_func_elem_3628: (a: number, b: number) => void;
10
+ export const __wasm_bindgen_func_elem_3707: (a: number, b: number, c: number, d: number) => void;
11
+ export const __wasm_bindgen_func_elem_3718: (a: number, b: number, c: number, d: number) => void;
12
12
  export const __wbindgen_export: (a: number, b: number) => number;
13
13
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
14
14
  export const __wbindgen_export3: (a: number) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moltendb-web/core",
3
- "version": "1.0.0-rc.1",
4
- "description": "MoltenDB WASM runtime — the database engine, Web Worker, and main-thread client in one package.",
3
+ "version": "1.0.0-rc.4",
4
+ "description": "MoltenDb WASM runtime — the database engine, Web Worker, and main-thread client in one package.",
5
5
  "type": "module",
6
6
  "author": "Maximilian Both <maximilian.both27@outlook.com>",
7
7
  "license": "MIT",
@@ -23,14 +23,16 @@
23
23
  "import": "./dist/moltendb-worker.js",
24
24
  "types": "./dist/moltendb-worker.d.ts"
25
25
  },
26
- "./wasm": "./dist/moltendb.js",
27
- "./wasm-bg": "./dist/moltendb_bg.wasm"
26
+ "./wasm": "./dist/wasm/moltendb.js",
27
+ "./wasm-bg": "./dist/wasm/moltendb_bg.wasm"
28
28
  },
29
29
  "main": "./dist/index.js",
30
30
  "types": "./dist/index.d.ts",
31
31
  "scripts": {
32
- "build": "tsc",
33
- "dev": "tsc --watch",
32
+ "build": "tsc && npm run copy-wasm",
33
+ "copy-wasm": "copyfiles -u 1 \"src/wasm/**/*\" dist/",
34
+ "dev": "tsc --watch & npm run watch-wasm",
35
+ "watch-wasm": "copyfiles -u 1 -w \"src/wasm/**/*\" dist/",
34
36
  "typecheck": "tsc --noEmit",
35
37
  "test": "vitest run",
36
38
  "test:watch": "vitest",
@@ -41,6 +43,7 @@
41
43
  "devDependencies": {
42
44
  "@playwright/test": "^1.58.2",
43
45
  "@vitest/coverage-v8": "^4.1.1",
46
+ "copyfiles": "^2.4.1",
44
47
  "happy-dom": "^20.8.7",
45
48
  "typescript": "^6.0.2",
46
49
  "vite": "^8.0.2",
Binary file