Skip to content

Commit 1fa1dc4

Browse files
authored
fix: mf-6765 update json-stable-stringify and use default export (#12325)
bump dependency across packages, remove @types/json-stable-stringify, replace import * as stringify with default import and call stringify(...). also enable dotenv dev loading in build script.
1 parent 59c788d commit 1fa1dc4

File tree

9 files changed

+48
-75
lines changed

9 files changed

+48
-75
lines changed

packages/mask/background/services/site-adaptors/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,5 @@ export async function connectSite(
131131
persona: identifier.toText(),
132132
username: profile?.userId,
133133
tabId: targetTab.id,
134-
})
134+
}) as string
135135
}

packages/mask/content-script/site-adaptor-infra/ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export async function activateSiteAdaptorUIInner(ui_deferred: SiteAdaptorUI.Defe
136136
currentSetupGuideStatus[activatedSiteAdaptorUI!.networkIdentifier].value = stringify({
137137
status: SetupGuideStep.FindUsername,
138138
persona: currentPersonaIdentifier?.toText(),
139-
})
139+
}) as string
140140
}
141141

142142
setupUIContext()

packages/mask/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
"@tanstack/react-query-devtools": "^5.48.0",
9595
"@tanstack/react-query-persist-client": "^5.48.0",
9696
"@types/elliptic": "^6.4.18",
97-
"@types/json-stable-stringify": "^1.0.36",
9897
"@types/react-avatar-editor": "^13.0.2",
9998
"@types/react-highlight-words": "^0.20.0",
10099
"@types/use-subscription": "^1.0.2",
@@ -115,7 +114,7 @@
115114
"https-browserify": "^1.0.0",
116115
"idb": "^8.0.0",
117116
"immer": "^10.1.1",
118-
"json-stable-stringify": "^1.1.1",
117+
"json-stable-stringify": "1.3.0",
119118
"react-avatar-editor": "^13.0.2",
120119
"react-draggable": "^4.4.6",
121120
"react-highlight-words": "^0.20.0",

packages/plugins/Transak/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"@masknet/shared-base-ui": "workspace:^",
2424
"@masknet/theme": "workspace:^",
2525
"@masknet/web3-shared-evm": "workspace:^",
26-
"@types/json-stable-stringify": "^1.0.36",
27-
"json-stable-stringify": "^1.1.1",
26+
"json-stable-stringify": "1.3.0",
2827
"react-use": "^17.5.0"
2928
}
30-
}
29+
}

packages/scripts/src/extension/dotenv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { BuildFlags } from './flags.ts'
44
import { ManifestFile } from '../../../mask/.webpack/flags.ts'
55

66
export function applyDotEnv(flags: BuildFlags) {
7-
if (flags.mode === 'production') return
7+
// if (flags.mode === 'production') return
88

99
const { parsed, error } = config({ path: new URL('./.env/dev-preference', ROOT_PATH) })
1010
if (error && !error.message.includes('no such file or directory')) {

packages/shared-base/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
"@masknet/typed-message": "workspace:^",
2424
"@servie/events": "^3.0.0",
2525
"@types/dompurify": "^3.0.5",
26-
"@types/json-stable-stringify": "^1.0.36",
2726
"async-call-rpc": "^6.4.2",
2827
"bignumber.js": "9.1.2",
2928
"dompurify": "^3.1.5",
3029
"idb": "^8.0.0",
31-
"json-stable-stringify": "^1.1.1",
30+
"json-stable-stringify": "1.3.0",
3231
"pvtsutils": "^1.3.5",
3332
"typeson": "^9.0.3",
3433
"typeson-registry": "^11.1.1"

packages/shared-base/src/helpers/ValueRef.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// All imports must be deferred. This file loads in the very early stage.
22
import defer * as lodash from 'lodash-es'
33
import defer * as constants from '../constants.js'
4-
import defer * as stringify from 'json-stable-stringify'
4+
import stringify from 'json-stable-stringify'
55

66
export type ValueComparer<T> = (a: T, b: T) => boolean
77
const defaultComparer: ValueComparer<any> = (a, b) => a === b
@@ -64,7 +64,7 @@ export class ValueRefWithReady<T> extends ValueRef<T> {
6464
*/
6565
export class ValueRefJSON<T extends object> extends ValueRefWithReady<string> {
6666
constructor(defaultValue: T) {
67-
super(stringify.default(defaultValue), lodash.isEqual)
67+
super(stringify(defaultValue), lodash.isEqual)
6868
}
6969
override get value(): string {
7070
return super.value
@@ -76,7 +76,7 @@ export class ValueRefJSON<T extends object> extends ValueRefWithReady<string> {
7676
}
7777
if (lodash.isEqual(this.asJSON, value)) return
7878
this.json = value
79-
super.value = stringify.default(value)
79+
super.value = stringify(value) as string
8080
}
8181
private json: Readonly<T> | undefined
8282
get asJSON(): Readonly<T> {

packages/shared/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@
3434
"@masknet/web3-telemetry": "workspace:^",
3535
"@react-hookz/web": "^24.0.4",
3636
"@types/d3": "5.16.4",
37-
"@types/json-stable-stringify": "^1.0.36",
3837
"bignumber.js": "9.1.2",
3938
"d3": "^5.16.0",
4039
"date-fns": "^3.6.0",
4140
"fuse.js": "^7.0.0",
4241
"immer": "^10.1.1",
43-
"json-stable-stringify": "^1.1.1",
42+
"json-stable-stringify": "1.3.0",
4443
"lodash-es": "^4.17.21",
4544
"pure-react-carousel": "^1.30.1",
4645
"qrcode": "^1.5.4",

0 commit comments

Comments
 (0)