-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to vitest, make the package work in node and in the browser
- Loading branch information
Showing
27 changed files
with
686 additions
and
3,393 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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,10 @@ | ||
export * from "./pkg/matrix_sdk_crypto_wasm.d"; | ||
|
||
/** | ||
* Load the WebAssembly module in the background, if it has not already been loaded. | ||
* | ||
* Returns a promise which will resolve once the other methods are ready. | ||
* | ||
* @returns {Promise<void>} | ||
*/ | ||
export function initAsync(): Promise<void>; |
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,2 @@ | ||
export * from "./pkg/matrix_sdk_crypto_wasm.js"; | ||
export { default as initAsync } from "./pkg/matrix_sdk_crypto_wasm.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export * from "./pkg/matrix_sdk_crypto_wasm.js"; | ||
|
||
import { initSync } from "./pkg/matrix_sdk_crypto_wasm.js"; | ||
|
||
import { readFile } from "node:fs/promises"; | ||
|
||
export const initAsync = async () => { | ||
const bytes = await readFile("./pkg/matrix_sdk_crypto_wasm_bg.wasm"); | ||
const module = await WebAssembly.compile(bytes); | ||
initSync({ module }); | ||
}; |
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 |
---|---|---|
|
@@ -19,32 +19,33 @@ | |
"ruma", | ||
"nio" | ||
], | ||
"main": "pkg/index.js", | ||
"types": "pkg/index.d.ts", | ||
"exports": { | ||
".": { | ||
"node": "./node.js", | ||
"import": "./index.js", | ||
"types": "./index.d.ts" | ||
} | ||
}, | ||
"files": [ | ||
"pkg/matrix_sdk_crypto_wasm_bg.wasm.js", | ||
"index.js", | ||
"index.d.ts", | ||
"node.js", | ||
"pkg/matrix_sdk_crypto_wasm.js", | ||
"pkg/matrix_sdk_crypto_wasm.js", | ||
"pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts", | ||
"pkg/index.js", | ||
"pkg/index.d.ts" | ||
"pkg/matrix_sdk_crypto_wasm_bg.wasm" | ||
], | ||
"devDependencies": { | ||
"@babel/core": "^7.23.5", | ||
"@babel/preset-env": "^7.23.5", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@types/jest": "^29.5.10", | ||
"babel-jest": "^29.7.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.55.0", | ||
"fake-indexeddb": "^4.0", | ||
"jest": "^28.1.0", | ||
"prettier": "^2.8.3", | ||
"typedoc": "^0.22.17", | ||
"typescript": "4.7", | ||
"wasm-pack": "^0.12.1", | ||
"yargs-parser": "~21.0.1" | ||
"vitest": "^2.1.5", | ||
"wasm-pack": "^0.13.1" | ||
}, | ||
"engines": { | ||
"node": ">= 10" | ||
"node": ">= 18" | ||
}, | ||
"scripts": { | ||
"lint": "npm run lint:eslint && npm run lint:prettier && npm run lint:types", | ||
|
@@ -53,9 +54,8 @@ | |
"lint:types": "tsc --noEmit", | ||
"build": "WASM_PACK_ARGS=--release ./scripts/build.sh", | ||
"build:dev": "WASM_PACK_ARGS=--dev ./scripts/build.sh", | ||
"test": "jest --verbose && yarn run wasm-pack test --node", | ||
"test": "vitest run && yarn run wasm-pack test --node", | ||
"doc": "typedoc --tsconfig .", | ||
"prepack": "npm run build && npm run test" | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} | ||
} |
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 was deleted.
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
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
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.