fix(convert): avoid bundling node crypto
Some checks failed
Tests / test-node (node22) (push) Successful in 1m27s
Tests / test-deno (push) Successful in 1m33s
Tests / test-bun (push) Successful in 1m49s
Tests / test-node (node20) (push) Successful in 2m7s
Tests / test-web (chromium) (push) Successful in 1m59s
Tests / test-node (node18) (push) Successful in 2m11s
Tests / test-web (firefox) (push) Successful in 1m22s
Docs / build (push) Successful in 6m5s
Tests / lint (push) Failing after 6m20s
Tests / e2e (push) Has been skipped
Tests / e2e-deno (push) Has been skipped
Some checks failed
Tests / test-node (node22) (push) Successful in 1m27s
Tests / test-deno (push) Successful in 1m33s
Tests / test-bun (push) Successful in 1m49s
Tests / test-node (node20) (push) Successful in 2m7s
Tests / test-web (chromium) (push) Successful in 1m59s
Tests / test-node (node18) (push) Successful in 2m11s
Tests / test-web (firefox) (push) Successful in 1m22s
Docs / build (push) Successful in 6m5s
Tests / lint (push) Failing after 6m20s
Tests / e2e (push) Has been skipped
Tests / e2e-deno (push) Has been skipped
This commit is contained in:
parent
2c0b89089d
commit
5b98b1d0b2
2 changed files with 12 additions and 2 deletions
|
@ -14,6 +14,14 @@
|
|||
"@fuman/net": "0.0.9",
|
||||
"@fuman/io": "0.0.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@mtcute/node": "workspace:^"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@mtcute/node": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mtcute/test": "workspace:^",
|
||||
"@mtcute/node": "workspace:^"
|
||||
|
|
|
@ -10,9 +10,11 @@ export interface IExtendedCryptoProvider extends ICryptoProvider {
|
|||
|
||||
export async function getDefaultCryptoProvider(): Promise<IExtendedCryptoProvider> {
|
||||
const crypto = /* @vite-ignore */ await import('node:crypto')
|
||||
const { NodeCryptoProvider } = /* @vite-ignore */ await import('@mtcute/node/utils.js')
|
||||
const nodeModule = '@mtcute/node/utils.js'
|
||||
const { NodeCryptoProvider } = await import(/* @vite-ignore */ nodeModule)
|
||||
|
||||
// <deno-tsignore>
|
||||
// eslint-disable-next-line ts/ban-ts-comment
|
||||
// @ts-ignore typescript complains because of the dynamic import
|
||||
return new (class extends NodeCryptoProvider implements IExtendedCryptoProvider {
|
||||
createHash(algorithm: 'md5' | 'sha512') {
|
||||
const hasher = crypto.createHash(algorithm)
|
||||
|
|
Loading…
Reference in a new issue