mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Refactor: make Node.js run compatible
This commit is contained in:
@@ -22,8 +22,8 @@ export const createRulesetForStreamService = (span: Span, fileId: string, title:
|
||||
new Date(),
|
||||
streamServices.flatMap((i) => i.rules),
|
||||
'ruleset',
|
||||
path.resolve(import.meta.dir, `../List/non_ip/${fileId}.conf`),
|
||||
path.resolve(import.meta.dir, `../Clash/non_ip/${fileId}.txt`)
|
||||
path.resolve(__dirname, `../List/non_ip/${fileId}.conf`),
|
||||
path.resolve(__dirname, `../Clash/non_ip/${fileId}.txt`)
|
||||
),
|
||||
// IP
|
||||
createRuleset(
|
||||
@@ -44,13 +44,13 @@ export const createRulesetForStreamService = (span: Span, fileId: string, title:
|
||||
: []
|
||||
)),
|
||||
'ruleset',
|
||||
path.resolve(import.meta.dir, `../List/ip/${fileId}.conf`),
|
||||
path.resolve(import.meta.dir, `../Clash/ip/${fileId}.txt`)
|
||||
path.resolve(__dirname, `../List/ip/${fileId}.conf`),
|
||||
path.resolve(__dirname, `../Clash/ip/${fileId}.txt`)
|
||||
)
|
||||
]));
|
||||
};
|
||||
|
||||
export const buildStreamService = task(import.meta.main, import.meta.path)(async (span) => {
|
||||
export const buildStreamService = task(typeof Bun !== 'undefined' ? Bun.main === __filename : require.main === module, __filename)(async (span) => {
|
||||
return Promise.all([
|
||||
createRulesetForStreamService(span, 'stream', 'All', ALL),
|
||||
createRulesetForStreamService(span, 'stream_us', 'North America', NORTH_AMERICA),
|
||||
|
||||
Reference in New Issue
Block a user