-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* pack sqljs wasm * update script * lint * bump
- Loading branch information
1 parent
b012153
commit d22fadb
Showing
16 changed files
with
331 additions
and
683 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ executor/ | |
vendor/ | ||
lib/ | ||
dist/ | ||
packages/core/scripts/ | ||
chopsticks.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@acala-network/chopsticks", | ||
"version": "0.8.0-2", | ||
"version": "0.8.0-3", | ||
"author": "Bryan Chen <[email protected]>", | ||
"license": "Apache-2.0", | ||
"bin": "./chopsticks.js", | ||
|
@@ -32,8 +32,8 @@ | |
"devDependencies": { | ||
"@types/global-agent": "^2.1.1", | ||
"@types/js-yaml": "^4.0.5", | ||
"@types/lodash": "^4.14.195", | ||
"@types/node": "^20.4.5", | ||
"@types/lodash": "^4.14.197", | ||
"@types/node": "^20.4.9", | ||
"@types/ws": "^8.5.5", | ||
"@types/yargs": "^17.0.24", | ||
"ts-node": "^10.9.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
{ | ||
"name": "@acala-network/chopsticks-core", | ||
"version": "0.8.0-2", | ||
"version": "0.8.0-3", | ||
"author": "Bryan Chen <[email protected]>", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"clean": "rm -rf lib tsconfig.tsbuildinfo", | ||
"build": "tsc -p ./tsconfig.json" | ||
"pack-wasm": "scripts/pack-wasm.js", | ||
"build": "yarn pack-wasm; tsc -p ./tsconfig.json" | ||
}, | ||
"dependencies": { | ||
"@acala-network/chopsticks-executor": "workspace:*", | ||
|
@@ -14,16 +15,17 @@ | |
"eventemitter3": "^5.0.1", | ||
"localforage": "^1.10.0", | ||
"lodash": "^4.17.21", | ||
"pino": "^8.14.1", | ||
"pino-pretty": "^10.0.1", | ||
"pino": "^8.15.0", | ||
"pino-pretty": "^10.2.0", | ||
"sql.js": "^1.8.0", | ||
"sqlite3": "^5.1.6", | ||
"typeorm": "^0.3.17", | ||
"zod": "^3.21.4" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.195", | ||
"@types/sql.js": "^1", | ||
"@types/lodash": "^4.14.197", | ||
"@types/sql.js": "^1.4.4", | ||
"fflate": "^0.8.0", | ||
"typescript": "^5.1.6" | ||
}, | ||
"files": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('node:fs') | ||
const path = require('node:path') | ||
const { zlibSync } = require('fflate/node') | ||
const { formatNumber } = require('@polkadot/util') | ||
|
||
const data = fs.readFileSync(path.resolve(__dirname, `../../../node_modules/sql.js/dist/sql-wasm.wasm`)) | ||
const compressed = Buffer.from(zlibSync(data, { level: 9 })) | ||
const base64 = compressed.toString('base64') | ||
|
||
console.log( | ||
`*** Compressed WASM: in=${formatNumber(data.length)}, out=${formatNumber(compressed.length)}, opt=${( | ||
(100 * compressed.length) / | ||
data.length | ||
).toFixed(2)}%, base64=${formatNumber(base64.length)}`, | ||
) | ||
|
||
fs.writeFileSync( | ||
path.resolve(__dirname, `../src/db/sql-wasm.ts`), | ||
`// Auto-generated file, do not edit by hand | ||
const LEN_IN = ${compressed.length} | ||
const LEN_OUT = ${data.length} | ||
const BYTES = | ||
'${base64}' | ||
import { base64Decode, unzlibSync } from '@polkadot/wasm-util' | ||
export const SQL_WASM_BYTES = unzlibSync(base64Decode(BYTES, new Uint8Array(LEN_IN)), new Uint8Array(LEN_OUT)) | ||
`, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export const openDb = async (dbPath: string | URL) => { | ||
if (dbPath instanceof URL) { | ||
return (await import('./browser')).openDb(dbPath) | ||
} else { | ||
export const openDb = async (dbPath: string) => { | ||
if (typeof window === 'undefined') { | ||
return (await import('./node')).openDb(dbPath) | ||
} else { | ||
return (await import('./browser')).openDb(dbPath) | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,6 @@ | |
}, | ||
"devDependencies": { | ||
"typescript": "^5.1.6", | ||
"vitest": "^0.33.0" | ||
"vitest": "^0.34.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@acala-network/chopsticks-testing", | ||
"version": "0.8.0-2", | ||
"version": "0.8.0-3", | ||
"author": "Bryan Chen <[email protected]>", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.