Skip to content

Commit

Permalink
πŸš‘οΈ fix(core): Minify whitespaces when compiling setup files (#1105)
Browse files Browse the repository at this point in the history
* πŸš‘οΈ fix(core): Minify whitespaces when compiling setup files

* βœ… chore: update cache hash for defineWalletSetup

* βœ… chore: update cache hash for getWalletSetupFuncHash

---------

Co-authored-by: drptbl <jakub.mucha@icloud.com>
  • Loading branch information
duckception and drptbl authored Feb 20, 2024
1 parent f368fd8 commit 3a8730d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/core/src/utils/getWalletSetupFuncHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function getWalletSetupFuncHash(walletSetupFunc: AnyFunction) {
// Different execution engines -> different codes -> different hashes.
const { code } = esbuild.transformSync(walletSetupFunc.toString(), {
format: 'esm',
minifyWhitespace: true,
drop: ['console', 'debugger'],
loader: 'ts',
logLevel: 'silent'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/defineWalletSetup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
import { defineWalletSetup } from '../src/defineWalletSetup'

const PASSWORD = 'Quack Quack! πŸ¦†'
const EXPECTED_HASH = '69620d59802a61c6900f'
const EXPECTED_HASH = 'f9c5ea5bb2c3aac96ff4'

const testWalletSetupFunction = async (): Promise<void> => {
const result = 1 + 2
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/utils/getWalletSetupFuncHash.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { WALLET_SETUP_FUNC_HASH_LENGTH, getWalletSetupFuncHash } from '../../src/utils/getWalletSetupFuncHash'

const EXPECTED_HASH = 'c339a616cd86dc167b68'
const EXPECTED_HASH = 'b940c886be3c1a041ddd'

const testFunction = async (name: string) => {
return `Hello ${name}!`
Expand Down

0 comments on commit 3a8730d

Please sign in to comment.