@weapp-sqlite/wasm 0.1.0 → 0.1.2
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/package.json +13 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ice breaker
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @weapp-sqlite/wasm
|
|
2
2
|
|
|
3
|
-
可注入 SQLite WASM 引擎和持久化回调的宿主无关 adapter
|
|
3
|
+
可注入 SQLite WASM 引擎和持久化回调的宿主无关 adapter。它连接 sql.js 一类的 WASM 引擎与 `@weapp-sqlite/core`,本身不选择存储宿主。
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
pnpm add @weapp-sqlite/wasm @weapp-sqlite/core
|
|
@@ -18,6 +18,8 @@ const database = await openSqliteWasmDatabase(
|
|
|
18
18
|
)
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
`storage` 至少实现 `load(name)` 和 `save(name, bytes)`;连接的 `flush()` 会在写入后导出最新数据库快照。需要自定义资源路径时传入 `locateFile`。
|
|
22
|
+
|
|
21
23
|
本包不直接访问 IndexedDB、小程序文件系统或平台 runtime。Web 使用 `@weapp-sqlite/web`,小程序使用 `@weapp-sqlite/miniprogram`,weapp-vite 项目优先使用 `@weapp-sqlite/weapp-vite`。
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
通常不需要直接配置 WASM adapter:weapp-vite 会为当前目标自动选择资源。详见 [WASM API](https://sqlite.weapp.dev/docs/api/wasm)。
|
package/dist/index.d.cts
CHANGED
|
@@ -29,7 +29,7 @@ interface SqliteWasmDriverOptions {
|
|
|
29
29
|
type SqliteWasmParameters = SqliteParameters;
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/driver.d.ts
|
|
32
|
-
declare function createSqliteWasmDriver(initializer: SqlJsInitializer, options: SqliteWasmDriverOptions): SqliteDriver;
|
|
33
|
-
declare function openSqliteWasmDatabase(initializer: SqlJsInitializer, name: string, options: SqliteWasmDriverOptions): Promise<SqliteDatabase>;
|
|
32
|
+
export declare function createSqliteWasmDriver(initializer: SqlJsInitializer, options: SqliteWasmDriverOptions): SqliteDriver;
|
|
33
|
+
export declare function openSqliteWasmDatabase(initializer: SqlJsInitializer, name: string, options: SqliteWasmDriverOptions): Promise<SqliteDatabase>;
|
|
34
34
|
//#endregion
|
|
35
|
-
export {
|
|
35
|
+
export type { SqlJsDatabase, SqlJsInitializer, SqlJsModule, SqlJsParameters, SqlJsResult, SqlJsScalar, SqliteWasmDriverOptions, SqliteWasmParameters, SqliteWasmStorage };
|
package/dist/index.d.mts
CHANGED
|
@@ -29,7 +29,7 @@ interface SqliteWasmDriverOptions {
|
|
|
29
29
|
type SqliteWasmParameters = SqliteParameters;
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/driver.d.ts
|
|
32
|
-
declare function createSqliteWasmDriver(initializer: SqlJsInitializer, options: SqliteWasmDriverOptions): SqliteDriver;
|
|
33
|
-
declare function openSqliteWasmDatabase(initializer: SqlJsInitializer, name: string, options: SqliteWasmDriverOptions): Promise<SqliteDatabase>;
|
|
32
|
+
export declare function createSqliteWasmDriver(initializer: SqlJsInitializer, options: SqliteWasmDriverOptions): SqliteDriver;
|
|
33
|
+
export declare function openSqliteWasmDatabase(initializer: SqlJsInitializer, name: string, options: SqliteWasmDriverOptions): Promise<SqliteDatabase>;
|
|
34
34
|
//#endregion
|
|
35
|
-
export {
|
|
35
|
+
export type { SqlJsDatabase, SqlJsInitializer, SqlJsModule, SqlJsParameters, SqlJsResult, SqlJsScalar, SqliteWasmDriverOptions, SqliteWasmParameters, SqliteWasmStorage };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-sqlite/wasm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "基于可注入 WASM SQLite 引擎的跨宿主 adapter",
|
|
6
6
|
"author": "weapp-sqlite contributors",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,6 +44,17 @@
|
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=18.0.0"
|
|
46
46
|
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@weapp-sqlite/core": "0.1.2"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"registry": "https://registry.npmjs.org/"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/sql.js": "^1.4.11",
|
|
56
|
+
"sql.js": "^1.14.2"
|
|
57
|
+
},
|
|
47
58
|
"scripts": {
|
|
48
59
|
"dev": "tsdown -w",
|
|
49
60
|
"build": "tsdown",
|
|
@@ -54,16 +65,5 @@
|
|
|
54
65
|
"lint:fix": "eslint . --fix",
|
|
55
66
|
"typecheck": "tsc -p tsconfig.json",
|
|
56
67
|
"tsd": "pnpm build && tsd --files test-d/**/*.test-d.ts"
|
|
57
|
-
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"@weapp-sqlite/core": "workspace:*"
|
|
60
|
-
},
|
|
61
|
-
"publishConfig": {
|
|
62
|
-
"access": "public",
|
|
63
|
-
"registry": "https://registry.npmjs.org/"
|
|
64
|
-
},
|
|
65
|
-
"devDependencies": {
|
|
66
|
-
"@types/sql.js": "^1.4.11",
|
|
67
|
-
"sql.js": "^1.14.2"
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|