Skip to content

Commit

Permalink
rename + bump
Browse files Browse the repository at this point in the history
  • Loading branch information
kearfy committed Aug 13, 2024
1 parent b4d33e6 commit 21c66f7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
<a href="https://www.youtube.com/channel/UCjf2teVEuYVvvVC-gFZNq6w"><img src="https://img.shields.io/badge/youtube-subscribe-fc1c1c.svg?style=flat-square"></a>
</p>

# surrealdb.wasm
# @surrealdb/wasm

A WebAssembly engine for the SurrealDB [JavaScript SDK](https://github.com/surrealdb/surrealdb.js).

This library is a plugin for the SurrealDB JavaScript SDK, which can be used to run SurrealDB as an embedded database within a browser environment, not server side environments.

It enables SurrealDB to be run in-memory, or to persist data by running on top of IndexedDB. It allows for a consistent JavaScript and TypeScript API when using the `surrealdb.js` library by adding support for embedded storage engines (`memory`, `indxdb`) alongside the remote connection protocols (`http`, `https`, `ws`, `wss`).
It enables SurrealDB to be run in-memory, or to persist data by running on top of IndexedDB. It allows for a consistent JavaScript and TypeScript API when using the `surrealdb.js` library by adding support for embedded storage engines (`memory`, `indxdb`) alongside the remote connection protocols (`http`, `https`, `ws`, `wss`).

This library works with ES modules (`import`), not CommonJS (`require`).

## Example usage

```js
import { Surreal } from 'surrealdb.js';
import { surrealdbWasmEngines } from 'surrealdb.wasm';
import { Surreal } from 'surrealdb';
import { surrealdbWasmEngines } from '@surrealdb/wasm';

// Enable the WebAssembly engines
const db = new Surreal({
Expand All @@ -63,7 +63,7 @@ When using [Vite](https://vitejs.dev/) the following configuration is recommende

```js
optimizeDeps: {
exclude: ['surrealdb.wasm', 'surrealql.wasm'],
exclude: ['@surrealdb/wasm', 'surrealql.wasm'],
esbuildOptions: {
target: 'esnext',
},
Expand Down
2 changes: 1 addition & 1 deletion build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function bundle(target) {
format: "esm",
platform: "node",
outfile: `dist/${target}/esm.js`,
external: ["surrealdb.js"],
external: ["surrealdb"],
plugins: [
copyFilePlugin({
after: Object.fromEntries(
Expand Down
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
</head>
<body>
<p>
All exports from surrealdb.js and surrealdb.wasm are assigned to the
window, and under "surreal", a new Surreal instance was created with
the wasm engine already installed. You can play around with it in
the browser console!
All exports from the surrealdb and @surrealdb/wasm packages are
assigned to the window, and under "surreal", a new Surreal instance
was created with the wasm engine already installed. You can play
around with it in the browser console!
</p>
<script type="module">
import * as surrealdb from "./node_modules/surrealdb.js/dist/esm.bundled.js";
import * as surrealdb from "./node_modules/surrealdb/dist/esm.bundled.js";
import * as wasm from "./dist/embedded/esm.bundled.js";
if (typeof window !== "undefined") {
Object.assign(window, surrealdb);
Expand Down
2 changes: 1 addition & 1 deletion lib/embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type RpcRequest,
type RpcResponse,
UnexpectedConnectionError,
} from "surrealdb.js";
} from "surrealdb";

export function surrealdbWasmEngines(opts?: ConnectionOptions) {
class WasmEmbeddedEngine extends AbstractEngine {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "surrealdb.wasm",
"version": "1.0.0-beta.15",
"name": "@surrealdb/wasm",
"version": "1.0.0-beta.16",
"description": "WebAssembly driver for SurrealDB",
"repository": {
"type": "git",
Expand Down Expand Up @@ -34,9 +34,9 @@
"typescript": "^5.4.5"
},
"dependencies": {
"surrealdb.js": "^1.0.0-beta.11"
"surrealdb": "^1.0.0-beta.20"
},
"peerDependencies": {
"surrealdb.js": "^1.0.0-beta.11"
"surrealdb": "^1.0.0-beta.20"
}
}
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21c66f7

Please sign in to comment.