@fudrouter/fsrouter 0.6.63 → 0.6.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,10 +39,14 @@ function rewrite(file) {
39
39
  const resolved = imp.endsWith(".js") ? imp : imp + ".js";
40
40
  return `from '${prefix}services/${resolved}'`;
41
41
  })
42
- .replace(/import\s+['\"]@\/lib\/([^'"]+)['"]/g, (m, imp) => {
42
+ .replace(/import\s+['"]@\/lib\/([^'"]+)['"]/g, (m, imp) => {
43
43
  const resolved = imp.endsWith(".js") ? imp : imp + ".js";
44
44
  return `import '${prefix}lib/${resolved}'`;
45
45
  })
46
+ .replace(/import\(\s*['"]@\/lib\/([^'"]+)['"]\s*\)/g, (m, imp) => {
47
+ const resolved = imp.endsWith(".js") ? imp : imp + ".js";
48
+ return `import('${prefix}lib/${resolved}')`;
49
+ })
46
50
  // Fix relative imports pointing to ../../../src/lib → ../../dist/lib
47
51
  // For open-sse/services/*.js (depth=2): ../../../src/lib/ = open-sse/src/lib/ (wrong)
48
52
  // correct: ../../dist/lib/
@@ -79,7 +79,7 @@ function clearCliproxyapiUrlCache() {
79
79
  }
80
80
  (async () => {
81
81
  try {
82
- const { getSettings } = await import("@/lib/db/settings");
82
+ const { getSettings } = await import('../../../dist/lib/db/settings.js');
83
83
  const settings = await getSettings();
84
84
  if (typeof settings.cliproxyapi_url === "string" && settings.cliproxyapi_url.trim()) {
85
85
  _cachedSettingsUrl = { url: settings.cliproxyapi_url.trim(), ts: Date.now() };
@@ -92,7 +92,7 @@ async function resolveCliproxyapiBaseUrl() {
92
92
  return _cachedSettingsUrl.url;
93
93
  }
94
94
  try {
95
- const { getSettings } = await import("@/lib/db/settings");
95
+ const { getSettings } = await import('../../../dist/lib/db/settings.js');
96
96
  const settings = await getSettings();
97
97
  if (typeof settings.cliproxyapi_url === "string" && settings.cliproxyapi_url.trim()) {
98
98
  const url2 = settings.cliproxyapi_url.trim();
@@ -192,7 +192,7 @@ async function initializeRateLimits() {
192
192
  if (initialized) return;
193
193
  initialized = true;
194
194
  try {
195
- const { getProviderConnections, getSettings } = await import("@/lib/localDb");
195
+ const { getProviderConnections, getSettings } = await import('../../../dist/lib/localDb.js');
196
196
  const [connections, settings] = await Promise.all([getProviderConnections(), getSettings()]);
197
197
  const resilience = resolveResilienceSettings(settings);
198
198
  currentRequestQueueSettings = { ...resilience.requestQueue };
@@ -221,7 +221,7 @@ async function initializeRateLimits() {
221
221
  }
222
222
  async function applyRequestQueueSettings(nextSettings) {
223
223
  currentRequestQueueSettings = { ...nextSettings };
224
- const { getProviderConnections } = await import("@/lib/localDb");
224
+ const { getProviderConnections } = await import('../../../dist/lib/localDb.js');
225
225
  const connections = await getProviderConnections();
226
226
  reconcileEnabledConnections(connections, currentRequestQueueSettings);
227
227
  updateAllLimiterSettings();
@@ -465,7 +465,7 @@ function getLearnedLimits() {
465
465
  }
466
466
  async function persistLearnedLimitsNow() {
467
467
  try {
468
- const { updateSettings } = await import("@/lib/db/settings");
468
+ const { updateSettings } = await import('../../../dist/lib/db/settings.js');
469
469
  await updateSettings({ learnedRateLimits: JSON.stringify(learnedLimits) });
470
470
  logRateLimit(
471
471
  `\u{1F4BE} [RATE-LIMIT] Persisted learned limits for ${Object.keys(learnedLimits).length} provider(s)`
@@ -541,7 +541,7 @@ async function __getLimiterStateForTests(provider, connectionId, model = null) {
541
541
  }
542
542
  async function loadPersistedLimits() {
543
543
  try {
544
- const { getSettings } = await import("@/lib/db/settings");
544
+ const { getSettings } = await import('../../../dist/lib/db/settings.js');
545
545
  const settings = await getSettings();
546
546
  const raw = settings?.learnedRateLimits;
547
547
  if (typeof raw !== "string" || raw.trim().length === 0) return;
@@ -79,7 +79,7 @@ function clearCliproxyapiUrlCache() {
79
79
  }
80
80
  (async () => {
81
81
  try {
82
- const { getSettings } = await import("@/lib/db/settings");
82
+ const { getSettings } = await import('../../../dist/lib/db/settings.js');
83
83
  const settings = await getSettings();
84
84
  if (typeof settings.cliproxyapi_url === "string" && settings.cliproxyapi_url.trim()) {
85
85
  _cachedSettingsUrl = { url: settings.cliproxyapi_url.trim(), ts: Date.now() };
@@ -92,7 +92,7 @@ async function resolveCliproxyapiBaseUrl() {
92
92
  return _cachedSettingsUrl.url;
93
93
  }
94
94
  try {
95
- const { getSettings } = await import("@/lib/db/settings");
95
+ const { getSettings } = await import('../../../dist/lib/db/settings.js');
96
96
  const settings = await getSettings();
97
97
  if (typeof settings.cliproxyapi_url === "string" && settings.cliproxyapi_url.trim()) {
98
98
  const url2 = settings.cliproxyapi_url.trim();
@@ -192,7 +192,7 @@ async function initializeRateLimits() {
192
192
  if (initialized) return;
193
193
  initialized = true;
194
194
  try {
195
- const { getProviderConnections, getSettings } = await import("@/lib/localDb");
195
+ const { getProviderConnections, getSettings } = await import('../../../dist/lib/localDb.js');
196
196
  const [connections, settings] = await Promise.all([getProviderConnections(), getSettings()]);
197
197
  const resilience = resolveResilienceSettings(settings);
198
198
  currentRequestQueueSettings = { ...resilience.requestQueue };
@@ -221,7 +221,7 @@ async function initializeRateLimits() {
221
221
  }
222
222
  async function applyRequestQueueSettings(nextSettings) {
223
223
  currentRequestQueueSettings = { ...nextSettings };
224
- const { getProviderConnections } = await import("@/lib/localDb");
224
+ const { getProviderConnections } = await import('../../../dist/lib/localDb.js');
225
225
  const connections = await getProviderConnections();
226
226
  reconcileEnabledConnections(connections, currentRequestQueueSettings);
227
227
  updateAllLimiterSettings();
@@ -465,7 +465,7 @@ function getLearnedLimits() {
465
465
  }
466
466
  async function persistLearnedLimitsNow() {
467
467
  try {
468
- const { updateSettings } = await import("@/lib/db/settings");
468
+ const { updateSettings } = await import('../../../dist/lib/db/settings.js');
469
469
  await updateSettings({ learnedRateLimits: JSON.stringify(learnedLimits) });
470
470
  logRateLimit(
471
471
  `\u{1F4BE} [RATE-LIMIT] Persisted learned limits for ${Object.keys(learnedLimits).length} provider(s)`
@@ -541,7 +541,7 @@ async function __getLimiterStateForTests(provider, connectionId, model = null) {
541
541
  }
542
542
  async function loadPersistedLimits() {
543
543
  try {
544
- const { getSettings } = await import("@/lib/db/settings");
544
+ const { getSettings } = await import('../../../dist/lib/db/settings.js');
545
545
  const settings = await getSettings();
546
546
  const raw = settings?.learnedRateLimits;
547
547
  if (typeof raw !== "string" || raw.trim().length === 0) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fudrouter/fsrouter",
3
- "version": "0.6.63",
3
+ "version": "0.6.65",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "9Router v2 \u2014 Express Backend (API, SSE, DB, Auth, MITM)",