mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-24 05:52:07 +08:00
Revert "fix: update js-yaml imports for v5"
This reverts commit250198d547. Revert "chore(deps): update dependency js-yaml to v5 (#7331)" This reverts commitb44f671fc2.
This commit is contained in:
@@ -32,7 +32,7 @@ import {
|
||||
cancelIdleCallback,
|
||||
requestIdleCallback,
|
||||
} from 'foxact/request-idle-callback'
|
||||
import { dump, load } from 'js-yaml'
|
||||
import yaml from 'js-yaml'
|
||||
import {
|
||||
startTransition,
|
||||
useCallback,
|
||||
@@ -126,7 +126,7 @@ const buildGroupsYaml = (
|
||||
append: IProxyGroupConfig[],
|
||||
deleteList: string[],
|
||||
) => {
|
||||
return dump(
|
||||
return yaml.dump(
|
||||
{
|
||||
prepend,
|
||||
append,
|
||||
@@ -334,7 +334,7 @@ export const GroupsEditorViewer = (props: Props) => {
|
||||
}
|
||||
const fetchContent = useCallback(async () => {
|
||||
const data = await readProfileFile(property)
|
||||
const obj = load(data) as ISeqProfileConfig | null
|
||||
const obj = yaml.load(data) as ISeqProfileConfig | null
|
||||
|
||||
setPrependSeq(obj?.prepend || [])
|
||||
setAppendSeq(obj?.append || [])
|
||||
@@ -358,7 +358,7 @@ export const GroupsEditorViewer = (props: Props) => {
|
||||
return
|
||||
}
|
||||
|
||||
const obj = load(currData) as ISeqProfileConfig | null
|
||||
const obj = yaml.load(currData) as ISeqProfileConfig | null
|
||||
startTransition(() => {
|
||||
setPrependSeq(obj?.prepend ?? [])
|
||||
setAppendSeq(obj?.append ?? [])
|
||||
@@ -397,13 +397,13 @@ export const GroupsEditorViewer = (props: Props) => {
|
||||
const fetchProxyPolicy = useCallback(async () => {
|
||||
const data = await readProfileFile(profileUid)
|
||||
const proxiesData = await readProfileFile(proxiesUid)
|
||||
const originGroupsObj = load(data) as {
|
||||
const originGroupsObj = yaml.load(data) as {
|
||||
'proxy-groups': IProxyGroupConfig[]
|
||||
} | null
|
||||
|
||||
const originProxiesObj = load(data) as { proxies: [] } | null
|
||||
const originProxiesObj = yaml.load(data) as { proxies: [] } | null
|
||||
const originProxies = originProxiesObj?.proxies || []
|
||||
const moreProxiesObj = load(proxiesData) as ISeqProfileConfig | null
|
||||
const moreProxiesObj = yaml.load(proxiesData) as ISeqProfileConfig | null
|
||||
const morePrependProxies = moreProxiesObj?.prepend || []
|
||||
const moreAppendProxies = moreProxiesObj?.append || []
|
||||
const moreDeleteProxies = normalizeDeleteSeq(moreProxiesObj?.delete)
|
||||
@@ -443,21 +443,21 @@ export const GroupsEditorViewer = (props: Props) => {
|
||||
const mergeData = await readProfileFile(mergeUid)
|
||||
const globalMergeData = await readProfileFile('Merge')
|
||||
|
||||
const originGroupsObj = load(data) as {
|
||||
const originGroupsObj = yaml.load(data) as {
|
||||
'proxy-groups': IProxyGroupConfig[]
|
||||
} | null
|
||||
|
||||
const originProviderObj = load(data) as {
|
||||
const originProviderObj = yaml.load(data) as {
|
||||
'proxy-providers': Record<string, unknown>
|
||||
} | null
|
||||
const originProvider = originProviderObj?.['proxy-providers'] || {}
|
||||
|
||||
const moreProviderObj = load(mergeData) as {
|
||||
const moreProviderObj = yaml.load(mergeData) as {
|
||||
'proxy-providers': Record<string, unknown>
|
||||
} | null
|
||||
const moreProvider = moreProviderObj?.['proxy-providers'] || {}
|
||||
|
||||
const globalProviderObj = load(globalMergeData) as {
|
||||
const globalProviderObj = yaml.load(globalMergeData) as {
|
||||
'proxy-providers': Record<string, unknown>
|
||||
} | null
|
||||
const globalProvider = globalProviderObj?.['proxy-providers'] || {}
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
styled,
|
||||
} from '@mui/material'
|
||||
import { useLockFn } from 'ahooks'
|
||||
import { dump, load } from 'js-yaml'
|
||||
import yaml from 'js-yaml'
|
||||
import {
|
||||
startTransition,
|
||||
useCallback,
|
||||
@@ -272,7 +272,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
||||
const fetchProfile = useCallback(async () => {
|
||||
const data = await readProfileFile(profileUid)
|
||||
|
||||
const originProxiesObj = load(data) as {
|
||||
const originProxiesObj = yaml.load(data) as {
|
||||
proxies: IProxyConfig[]
|
||||
} | null
|
||||
|
||||
@@ -281,7 +281,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
||||
|
||||
const fetchContent = useCallback(async () => {
|
||||
const data = await readProfileFile(property)
|
||||
const obj = load(data) as ISeqProfileConfig | null
|
||||
const obj = yaml.load(data) as ISeqProfileConfig | null
|
||||
|
||||
setPrependSeq(obj?.prepend || [])
|
||||
setAppendSeq(obj?.append || [])
|
||||
@@ -296,7 +296,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
||||
return
|
||||
}
|
||||
|
||||
const obj = load(currData) as ISeqProfileConfig | null
|
||||
const obj = yaml.load(currData) as ISeqProfileConfig | null
|
||||
startTransition(() => {
|
||||
setPrependSeq(obj?.prepend ?? [])
|
||||
setAppendSeq(obj?.append ?? [])
|
||||
@@ -312,7 +312,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
||||
const serialize = () => {
|
||||
try {
|
||||
setCurrData(
|
||||
dump(
|
||||
yaml.dump(
|
||||
{ prepend: prependSeq, append: appendSeq, delete: deleteSeq },
|
||||
{ forceQuotes: true },
|
||||
),
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
styled,
|
||||
} from '@mui/material'
|
||||
import { useLockFn } from 'ahooks'
|
||||
import { dump, load } from 'js-yaml'
|
||||
import yaml from 'js-yaml'
|
||||
import {
|
||||
startTransition,
|
||||
useCallback,
|
||||
@@ -407,7 +407,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
}
|
||||
const fetchContent = useCallback(async () => {
|
||||
const data = await readProfileFile(property)
|
||||
const obj = load(data) as ISeqProfileConfig | null
|
||||
const obj = yaml.load(data) as ISeqProfileConfig | null
|
||||
|
||||
setPrependSeq(obj?.prepend || [])
|
||||
setAppendSeq(obj?.append || [])
|
||||
@@ -422,7 +422,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
return
|
||||
}
|
||||
|
||||
const obj = load(currData) as ISeqProfileConfig | null
|
||||
const obj = yaml.load(currData) as ISeqProfileConfig | null
|
||||
startTransition(() => {
|
||||
setPrependSeq(obj?.prepend ?? [])
|
||||
setAppendSeq(obj?.append ?? [])
|
||||
@@ -439,7 +439,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
const serialize = () => {
|
||||
try {
|
||||
setCurrData(
|
||||
dump(
|
||||
yaml.dump(
|
||||
{ prepend: prependSeq, append: appendSeq, delete: deleteSeq },
|
||||
{ forceQuotes: true },
|
||||
),
|
||||
@@ -471,13 +471,13 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
const mergeData = await readProfileFile(mergeUid) // merge配置文件
|
||||
const globalMergeData = await readProfileFile('Merge') // global merge配置文件
|
||||
|
||||
const rulesObj = load(data) as { rules: [] } | null
|
||||
const rulesObj = yaml.load(data) as { rules: [] } | null
|
||||
|
||||
const originGroupsObj = load(data) as {
|
||||
const originGroupsObj = yaml.load(data) as {
|
||||
'proxy-groups': IProxyGroupConfig[]
|
||||
} | null
|
||||
const originGroups = originGroupsObj?.['proxy-groups'] || []
|
||||
const moreGroupsObj = load(groupsData) as ISeqProfileConfig | null
|
||||
const moreGroupsObj = yaml.load(groupsData) as ISeqProfileConfig | null
|
||||
const rawPrependGroups = moreGroupsObj?.['prepend']
|
||||
const morePrependGroups = Array.isArray(rawPrependGroups)
|
||||
? (rawPrependGroups as IProxyGroupConfig[])
|
||||
@@ -503,29 +503,29 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
moreAppendGroups,
|
||||
)
|
||||
|
||||
const originRuleSetObj = load(data) as {
|
||||
const originRuleSetObj = yaml.load(data) as {
|
||||
'rule-providers': Record<string, unknown>
|
||||
} | null
|
||||
const originRuleSet = originRuleSetObj?.['rule-providers'] || {}
|
||||
const moreRuleSetObj = load(mergeData) as {
|
||||
const moreRuleSetObj = yaml.load(mergeData) as {
|
||||
'rule-providers': Record<string, unknown>
|
||||
} | null
|
||||
const moreRuleSet = moreRuleSetObj?.['rule-providers'] || {}
|
||||
const globalRuleSetObj = load(globalMergeData) as {
|
||||
const globalRuleSetObj = yaml.load(globalMergeData) as {
|
||||
'rule-providers': Record<string, unknown>
|
||||
} | null
|
||||
const globalRuleSet = globalRuleSetObj?.['rule-providers'] || {}
|
||||
const ruleSet = Object.assign({}, originRuleSet, moreRuleSet, globalRuleSet)
|
||||
|
||||
const originSubRuleObj = load(data) as {
|
||||
const originSubRuleObj = yaml.load(data) as {
|
||||
'sub-rules': Record<string, unknown>
|
||||
} | null
|
||||
const originSubRule = originSubRuleObj?.['sub-rules'] || {}
|
||||
const moreSubRuleObj = load(mergeData) as {
|
||||
const moreSubRuleObj = yaml.load(mergeData) as {
|
||||
'sub-rules': Record<string, unknown>
|
||||
} | null
|
||||
const moreSubRule = moreSubRuleObj?.['sub-rules'] || {}
|
||||
const globalSubRuleObj = load(globalMergeData) as {
|
||||
const globalSubRuleObj = yaml.load(globalMergeData) as {
|
||||
'sub-rules': Record<string, unknown>
|
||||
} | null
|
||||
const globalSubRule = globalSubRuleObj?.['sub-rules'] || {}
|
||||
|
||||
Reference in New Issue
Block a user