mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-04-18 08:00:31 +08:00
fix: improve Node 16 compatibility for Win7 legacy build
This commit is contained in:
parent
7600f82c34
commit
3270e47a7b
@ -17,7 +17,7 @@ const monacoEditorPlugin = isObjectWithDefaultFunction(monacoEditorPluginModule)
|
|||||||
|
|
||||||
// Win7 build: bundle all deps (Vite converts ESM→CJS), only externalize native modules
|
// Win7 build: bundle all deps (Vite converts ESM→CJS), only externalize native modules
|
||||||
const isLegacyBuild = process.env.LEGACY_BUILD === 'true'
|
const isLegacyBuild = process.env.LEGACY_BUILD === 'true'
|
||||||
const legacyExternal = ['sysproxy-rs', 'electron']
|
const legacyExternal = ['sysproxy-rs', 'electron', 'utf-8-validate', 'bufferutil']
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
main: {
|
main: {
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export async function getProfileConfig(force = false): Promise<IProfileConfig> {
|
|||||||
}
|
}
|
||||||
if (typeof profileConfig !== 'object') profileConfig = { items: [] }
|
if (typeof profileConfig !== 'object') profileConfig = { items: [] }
|
||||||
if (!Array.isArray(profileConfig.items)) profileConfig.items = []
|
if (!Array.isArray(profileConfig.items)) profileConfig.items = []
|
||||||
return structuredClone(profileConfig)
|
return JSON.parse(JSON.stringify(profileConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setProfileConfig(config: IProfileConfig): Promise<void> {
|
export async function setProfileConfig(config: IProfileConfig): Promise<void> {
|
||||||
@ -48,12 +48,12 @@ export async function updateProfileConfig(
|
|||||||
profileConfig = parse(data) || { items: [] }
|
profileConfig = parse(data) || { items: [] }
|
||||||
if (typeof profileConfig !== 'object') profileConfig = { items: [] }
|
if (typeof profileConfig !== 'object') profileConfig = { items: [] }
|
||||||
if (!Array.isArray(profileConfig.items)) profileConfig.items = []
|
if (!Array.isArray(profileConfig.items)) profileConfig.items = []
|
||||||
profileConfig = await updater(structuredClone(profileConfig))
|
profileConfig = await updater(JSON.parse(JSON.stringify(profileConfig)))
|
||||||
result = profileConfig
|
result = profileConfig
|
||||||
await writeFile(profileConfigPath(), stringify(profileConfig), 'utf-8')
|
await writeFile(profileConfigPath(), stringify(profileConfig), 'utf-8')
|
||||||
})
|
})
|
||||||
await profileConfigWriteQueue
|
await profileConfigWriteQueue
|
||||||
return structuredClone(result ?? profileConfig)
|
return JSON.parse(JSON.stringify(result ?? profileConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getProfileItem(id: string | undefined): Promise<IProfileItem | undefined> {
|
export async function getProfileItem(id: string | undefined): Promise<IProfileItem | undefined> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user