build bundles for browser libs

This commit is contained in:
Nikita Sivukhin
2025-09-12 14:15:28 +04:00
parent b086cba669
commit 1c38344f4f
6 changed files with 1387 additions and 3441 deletions

View File

@@ -198,3 +198,4 @@ Cargo.lock
*.wasm
npm
bundle

View File

@@ -1137,45 +1137,6 @@
"resolved": "packages/common",
"link": true
},
"node_modules/@tursodatabase/database-linux-arm64-gnu": {
"version": "0.2.0-pre.1",
"resolved": "https://registry.npmjs.org/@tursodatabase/database-linux-arm64-gnu/-/database-linux-arm64-gnu-0.2.0-pre.1.tgz",
"integrity": "sha512-MHytlbbOQhSbxjm1JwnH9zlCXBN/9jOUHHVlBX5tUchf99eYGmL7sWKR96DslEnUHuXGg3C+OxaHO7PAhI7XOg==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@tursodatabase/database-linux-x64-gnu": {
"version": "0.2.0-pre.1",
"resolved": "https://registry.npmjs.org/@tursodatabase/database-linux-x64-gnu/-/database-linux-x64-gnu-0.2.0-pre.1.tgz",
"integrity": "sha512-Y/8RysL2zEllIQ352i8yfPahaSQbDJnel0pHo0ddr6zZIkL6c3bJ5bADhLMOFbq/oR60UmHhRTa6wbjVYd/sFA==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@tursodatabase/database-win32-x64-msvc": {
"version": "0.2.0-pre.1",
"resolved": "https://registry.npmjs.org/@tursodatabase/database-win32-x64-msvc/-/database-win32-x64-msvc-0.2.0-pre.1.tgz",
"integrity": "sha512-TNXA/FtGJYr6WhDs7rIgnoE2IKggfLGhNyBcbkAjnEVVNCm9otYg2KM0pDbIRujy3vaOlQNh9CPbEaGLlhinHg==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@tursodatabase/sync": {
"resolved": "sync/packages/native",
"link": true
@@ -1188,45 +1149,6 @@
"resolved": "sync/packages/common",
"link": true
},
"node_modules/@tursodatabase/sync-linux-arm64-gnu": {
"version": "0.2.0-pre.1",
"resolved": "https://registry.npmjs.org/@tursodatabase/sync-linux-arm64-gnu/-/sync-linux-arm64-gnu-0.2.0-pre.1.tgz",
"integrity": "sha512-kq9/qOTbsK0P1uxT/Tv07rW4Mu/NiYAHhJmb0/aUVem7BQJBPTb2+bCx/0jP7NzXMXT+/w+TtGp6FNqYZpfO1Q==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@tursodatabase/sync-linux-x64-gnu": {
"version": "0.2.0-pre.1",
"resolved": "https://registry.npmjs.org/@tursodatabase/sync-linux-x64-gnu/-/sync-linux-x64-gnu-0.2.0-pre.1.tgz",
"integrity": "sha512-FKRpVe6ckxO3T/y3j4OdZNdNdQ1ChIMp42gPxHqmK7LZWEj2ACxrkh4q6HeMZWajt5PKuJSYhom2QCGA15RQOw==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@tursodatabase/sync-win32-x64-msvc": {
"version": "0.2.0-pre.1",
"resolved": "https://registry.npmjs.org/@tursodatabase/sync-win32-x64-msvc/-/sync-win32-x64-msvc-0.2.0-pre.1.tgz",
"integrity": "sha512-piWLmgk0sDG14Ymj/1R5bmi1xqnndcFKonnv99ionguwx3Z+N0bT4/IMe9qFuYW7cULkOyJGVThdCrGaaCy4ZQ==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@tursodatabase/wasm-runtime": {
"resolved": "packages/wasm-runtime",
"link": true
@@ -1864,6 +1786,21 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@@ -2104,6 +2041,21 @@
"node": ">=18"
}
},
"node_modules/playwright/node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/postcss": {
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
@@ -2739,6 +2691,7 @@
"@vitest/browser": "^3.2.4",
"playwright": "^1.55.0",
"typescript": "^5.9.2",
"vite": "^7.1.5",
"vitest": "^3.2.4"
}
},
@@ -2773,12 +2726,6 @@
"@types/node": "^24.3.1",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
},
"optionalDependencies": {
"@tursodatabase/database-darwin-universal": "0.2.0-pre.1",
"@tursodatabase/database-linux-arm64-gnu": "0.2.0-pre.1",
"@tursodatabase/database-linux-x64-gnu": "0.2.0-pre.1",
"@tursodatabase/database-win32-x64-msvc": "0.2.0-pre.1"
}
},
"packages/wasm-runtime": {
@@ -2842,12 +2789,6 @@
"@types/node": "^24.3.1",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
},
"optionalDependencies": {
"@tursodatabase/sync-darwin-universal": "0.2.0-pre.1",
"@tursodatabase/sync-linux-arm64-gnu": "0.2.0-pre.1",
"@tursodatabase/sync-linux-x64-gnu": "0.2.0-pre.1",
"@tursodatabase/sync-win32-x64-msvc": "0.2.0-pre.1"
}
}
}

View File

@@ -7,16 +7,20 @@
},
"type": "module",
"license": "MIT",
"main": "dist/promise.js",
"main": "./dist/promise-default.js",
"packageManager": "yarn@4.9.2",
"files": [
"dist/**",
"bundle/**",
"README.md"
],
"exports": {
".": {
"default": "./dist/promise-default.js"
},
"./bundled": {
"default": "./bundle/main.js"
},
"./vite": {
"development": "./dist/promise-vite-dev-hack.js",
"default": "./dist/promise-default.js"
@@ -30,12 +34,14 @@
"@vitest/browser": "^3.2.4",
"playwright": "^1.55.0",
"typescript": "^5.9.2",
"vite": "^7.1.5",
"vitest": "^3.2.4"
},
"scripts": {
"napi-build": "napi build --features browser --release --platform --target wasm32-wasip1-threads --no-js --manifest-path ../../Cargo.toml --output-dir . && rm index.d.ts turso.wasi* wasi* browser.js",
"tsc-build": "npm exec tsc && cp turso.wasm32-wasi.wasm ./dist/turso.wasm32-wasi.wasm && WASM_FILE=turso.wasm32-wasi.wasm JS_FILE=./dist/wasm-inline.js node ../../scripts/inline-wasm-base64.js",
"build": "npm run napi-build && npm run tsc-build",
"bundle": "vite build",
"build": "npm run napi-build && npm run tsc-build && npm run bundle",
"test": "CI=1 vitest --browser=chromium --run && CI=1 vitest --browser=firefox --run"
},
"napi": {

View File

@@ -0,0 +1,17 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
export default defineConfig({
base: './',
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'promise-default.ts'),
},
output: {
dir: 'bundle',
entryFileNames: '[name].js',
}
},
},
});

File diff suppressed because it is too large Load Diff