diff --git a/public_configs/fast-pr-url-rules.js b/public_configs/fast-pr-url-rules.cjs similarity index 98% rename from public_configs/fast-pr-url-rules.js rename to public_configs/fast-pr-url-rules.cjs index 8c33e537..f80664a3 100644 --- a/public_configs/fast-pr-url-rules.js +++ b/public_configs/fast-pr-url-rules.cjs @@ -1,5 +1,4 @@ -// remote-code.js -export const urlRules = [ +const urlRules = [ { domains: ['open-digger.cn', 'open-digger'], ruleFunction: (url) => { @@ -159,4 +158,6 @@ function matchFastPrUrl(url) { // Make the function globally available if needed if (typeof window !== 'undefined' && typeof window.document !== 'undefined') { window.matchFastPrUrl = matchFastPrUrl; +} else { + module.exports = { urlRules }; } diff --git a/scripts/test_configs.js b/scripts/test_configs.js index af534799..6524a90c 100644 --- a/scripts/test_configs.js +++ b/scripts/test_configs.js @@ -1,6 +1,5 @@ -import { urlRules } from '../public_configs/fast-pr-url-rules.js'; - (async () => { + const { urlRules } = await import('../public_configs/fast-pr-url-rules.cjs'); let hasError = false; for (const rule of urlRules) { const tests = rule.tests; diff --git a/src/constant.ts b/src/constant.ts index a0575bfd..c1b67491 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -9,4 +9,4 @@ export const OSS_XLAB_ENDPOINT = 'https://oss.open-digger.cn'; export const HYPERTRONS_CRX_NEW_ISSUE = 'https://github.com/hypertrons/hypertrons-crx/issues/new/choose'; export const HYPERCRX_GITHUB = 'https://github.com/hypertrons/hypertrons-crx'; -export const OSS_URL = 'https://hypercrx-fastpr.oss-cn-beijing.aliyuncs.com/fastPR-url-rules.js'; +export const OSS_URL = 'https://hypercrx-fastpr.oss-cn-beijing.aliyuncs.com/fast-pr-url-rules.cjs';