veryfront 0.1.51 → 0.1.53

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.
Files changed (51) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  3. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +7 -2
  4. package/esm/src/platform/adapters/fs/veryfront/file-list-index.d.ts +5 -0
  5. package/esm/src/platform/adapters/fs/veryfront/file-list-index.d.ts.map +1 -1
  6. package/esm/src/platform/adapters/fs/veryfront/file-list-index.js +18 -3
  7. package/esm/src/platform/adapters/fs/veryfront/invalidation-state.d.ts +1 -0
  8. package/esm/src/platform/adapters/fs/veryfront/invalidation-state.d.ts.map +1 -1
  9. package/esm/src/platform/adapters/fs/veryfront/invalidation-state.js +29 -10
  10. package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.js +2 -1
  11. package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts +2 -0
  12. package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts.map +1 -1
  13. package/esm/src/platform/adapters/fs/veryfront/read-operations.js +62 -24
  14. package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts +7 -0
  15. package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts.map +1 -1
  16. package/esm/src/platform/adapters/fs/veryfront/websocket-manager.js +252 -188
  17. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts.map +1 -1
  18. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.js +4 -1
  19. package/esm/src/proxy/main.js +5 -2
  20. package/esm/src/proxy/token-manager.d.ts.map +1 -1
  21. package/esm/src/proxy/token-manager.js +5 -0
  22. package/esm/src/server/runtime-handler/index.js +1 -1
  23. package/esm/src/server/runtime-handler/request-tracker.d.ts +1 -0
  24. package/esm/src/server/runtime-handler/request-tracker.d.ts.map +1 -1
  25. package/esm/src/server/runtime-handler/request-tracker.js +7 -3
  26. package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
  27. package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
  28. package/esm/src/utils/cache/eviction/eviction-manager.d.ts.map +1 -1
  29. package/esm/src/utils/cache/eviction/eviction-manager.js +11 -1
  30. package/esm/src/utils/cache/stores/memory/lru-cache-adapter.d.ts.map +1 -1
  31. package/esm/src/utils/cache/stores/memory/lru-cache-adapter.js +11 -1
  32. package/esm/src/utils/logger/logger.d.ts +6 -2
  33. package/esm/src/utils/logger/logger.d.ts.map +1 -1
  34. package/esm/src/utils/logger/logger.js +22 -22
  35. package/package.json +1 -1
  36. package/src/deno.js +1 -1
  37. package/src/src/modules/react-loader/ssr-module-loader/loader.ts +7 -2
  38. package/src/src/platform/adapters/fs/veryfront/file-list-index.ts +23 -3
  39. package/src/src/platform/adapters/fs/veryfront/invalidation-state.ts +32 -12
  40. package/src/src/platform/adapters/fs/veryfront/read-operations-helpers.ts +2 -2
  41. package/src/src/platform/adapters/fs/veryfront/read-operations.ts +91 -21
  42. package/src/src/platform/adapters/fs/veryfront/websocket-manager.ts +318 -225
  43. package/src/src/platform/adapters/veryfront-api-client/retry-handler.ts +4 -1
  44. package/src/src/proxy/main.ts +5 -2
  45. package/src/src/proxy/token-manager.ts +5 -0
  46. package/src/src/server/runtime-handler/index.ts +1 -1
  47. package/src/src/server/runtime-handler/request-tracker.ts +5 -2
  48. package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
  49. package/src/src/utils/cache/eviction/eviction-manager.ts +12 -1
  50. package/src/src/utils/cache/stores/memory/lru-cache-adapter.ts +11 -1
  51. package/src/src/utils/logger/logger.ts +35 -21
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/modules/react-loader/ssr-module-loader/loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAiCpC,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AA0B3E;;;;;GAKG;AACH,qBAAa,eAAe;IAKd,OAAO,CAAC,OAAO;IAJ3B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,YAAY,CAAyB;gBAEzB,OAAO,EAAE,sBAAsB;IAWnD,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,4BAA4B;YAetB,qBAAqB;YAuCrB,0BAA0B;IA2FxC,UAAU,CACR,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YA+C1C,2BAA2B;IAYzC,OAAO,CAAC,yBAAyB;YAiBnB,2BAA2B;CAqV1C"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/modules/react-loader/ssr-module-loader/loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAiCpC,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AA0B3E;;;;;GAKG;AACH,qBAAa,eAAe;IAKd,OAAO,CAAC,OAAO;IAJ3B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,YAAY,CAAyB;gBAEzB,OAAO,EAAE,sBAAsB;IAWnD,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,4BAA4B;YAetB,qBAAqB;YAuCrB,0BAA0B;IA2FxC,UAAU,CACR,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YA+C1C,2BAA2B;IAYzC,OAAO,CAAC,yBAAyB;YAiBnB,2BAA2B;CA0V1C"}
@@ -306,9 +306,14 @@ export class SSRModuleLoader {
306
306
  resolveTransform = resolve;
307
307
  rejectTransform = reject;
308
308
  });
309
- // Attach no-op catch to prevent unhandled rejection when waiters timeout
309
+ // Attach catch to prevent unhandled rejection when waiters timeout
310
310
  // and stop listening. The actual error is thrown to the caller directly.
311
- transformPromise.catch(() => { });
311
+ transformPromise.catch((err) => {
312
+ logger.debug("Transform rejected (waiters may have timed out)", {
313
+ key: inProgressKey,
314
+ error: err instanceof Error ? err.message : String(err),
315
+ });
316
+ });
312
317
  globalInProgress.set(inProgressKey, transformPromise);
313
318
  try {
314
319
  let parseResult = await parseLocalImports(code, filePath, this.options.projectDir, this.options.adapter);
@@ -11,7 +11,12 @@ export declare class FileListIndex {
11
11
  constructor(getFileListCache?: (() => Promise<Array<FileListCacheEntry> | undefined>) | undefined);
12
12
  setReadyPromise(promise: Promise<void>): void;
13
13
  clear(): void;
14
+ private ensureReady;
14
15
  lookup(normalizedPath: string): Promise<string | undefined>;
16
+ findFirstWithContent(normalizedPaths: string[]): Promise<{
17
+ path: string;
18
+ content: string;
19
+ } | undefined>;
15
20
  private getOrBuild;
16
21
  }
17
22
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"file-list-index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/file-list-index.ts"],"names":[],"mappings":"AAIA,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAeD,qBAAa,aAAa;IAOtB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IANpC,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAA8B;gBAG/B,gBAAgB,CAAC,GAAE,MAAM,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC,aAAA;IAG1F,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAI7C,KAAK,IAAI,IAAI;IAUP,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;YAmCnD,UAAU;CA0EzB"}
1
+ {"version":3,"file":"file-list-index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/file-list-index.ts"],"names":[],"mappings":"AAIA,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAeD,qBAAa,aAAa;IAOtB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IANpC,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAA8B;gBAG/B,gBAAgB,CAAC,GAAE,MAAM,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC,aAAA;IAG1F,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAI7C,KAAK,IAAI,IAAI;YAUC,WAAW;IAWnB,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA4B3D,oBAAoB,CACxB,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;YAc3C,UAAU;CA0EzB"}
@@ -25,13 +25,13 @@ export class FileListIndex {
25
25
  clear() {
26
26
  if (!this.index)
27
27
  return;
28
- const size = this.index.size;
28
+ const indexedWithContent = this.index.size;
29
29
  this.index = null;
30
30
  this.indexKey = null;
31
31
  this.indexBuiltAt = 0;
32
- logger.debug("Cleared file list index", { entriesCleared: size });
32
+ logger.debug("Cleared file list index", { indexedWithContent });
33
33
  }
34
- async lookup(normalizedPath) {
34
+ async ensureReady() {
35
35
  if (this.readyPromise) {
36
36
  try {
37
37
  await this.readyPromise;
@@ -41,6 +41,9 @@ export class FileListIndex {
41
41
  logger.debug("File list initialization failed, will fetch individually");
42
42
  }
43
43
  }
44
+ }
45
+ async lookup(normalizedPath) {
46
+ await this.ensureReady();
44
47
  const index = await this.getOrBuild();
45
48
  if (!index) {
46
49
  logger.debug("No file list cache available");
@@ -62,6 +65,18 @@ export class FileListIndex {
62
65
  });
63
66
  return content;
64
67
  }
68
+ async findFirstWithContent(normalizedPaths) {
69
+ await this.ensureReady();
70
+ const index = await this.getOrBuild();
71
+ if (!index)
72
+ return undefined;
73
+ for (const path of normalizedPaths) {
74
+ const content = index.get(path);
75
+ if (content)
76
+ return { path, content };
77
+ }
78
+ return undefined;
79
+ }
65
80
  async getOrBuild() {
66
81
  if (!this.getFileListCache) {
67
82
  logger.debug("getOrBuildFileListIndex: no getFileListCache function");
@@ -9,6 +9,7 @@ export declare function getInvalidationDebugState(): {
9
9
  prefix: string;
10
10
  ageMs: number;
11
11
  startedAt: number;
12
+ count: number;
12
13
  }>;
13
14
  };
14
15
  export declare function clearAllPendingInvalidations(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"invalidation-state.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/invalidation-state.ts"],"names":[],"mappings":"AAqCA,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAS3D;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAW9D;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAqBhE;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED,wBAAgB,yBAAyB,IAAI;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtE,CAYA;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAGnD"}
1
+ {"version":3,"file":"invalidation-state.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/invalidation-state.ts"],"names":[],"mappings":"AAsCA,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAgB3D;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAqB9D;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAsBhE;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED,wBAAgB,yBAAyB,IAAI;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrF,CAaA;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAGnD"}
@@ -11,7 +11,8 @@ function cleanupStaleInvalidations() {
11
11
  return;
12
12
  lastCleanupTime = now;
13
13
  const staleEntries = [];
14
- for (const [prefix, startedAt] of pendingInvalidations) {
14
+ for (const [prefix, entry] of pendingInvalidations) {
15
+ const { startedAt } = entry;
15
16
  const ageMs = now - startedAt;
16
17
  if (ageMs <= STALE_INVALIDATION_THRESHOLD_MS)
17
18
  continue;
@@ -28,34 +29,51 @@ function cleanupStaleInvalidations() {
28
29
  }
29
30
  export function addPendingInvalidation(prefix) {
30
31
  const startedAt = Date.now();
31
- pendingInvalidations.set(prefix, startedAt);
32
+ const existing = pendingInvalidations.get(prefix);
33
+ pendingInvalidations.set(prefix, {
34
+ startedAt: existing?.startedAt ?? startedAt,
35
+ count: (existing?.count ?? 0) + 1,
36
+ });
37
+ const count = pendingInvalidations.get(prefix)?.count ?? 1;
32
38
  logger.info("INVALIDATION_STARTED - cache prefix marked for invalidation", {
33
39
  prefix,
34
40
  startedAt,
41
+ count,
35
42
  totalPending: pendingInvalidations.size,
36
43
  });
37
44
  }
38
45
  export function removePendingInvalidation(prefix) {
39
- const startedAt = pendingInvalidations.get(prefix);
40
- const durationMs = startedAt != null ? Date.now() - startedAt : null;
41
- pendingInvalidations.delete(prefix);
46
+ const entry = pendingInvalidations.get(prefix);
47
+ const durationMs = entry != null ? Date.now() - entry.startedAt : null;
48
+ if (entry && entry.count > 1) {
49
+ pendingInvalidations.set(prefix, {
50
+ startedAt: entry.startedAt,
51
+ count: entry.count - 1,
52
+ });
53
+ }
54
+ else {
55
+ pendingInvalidations.delete(prefix);
56
+ }
57
+ const remainingCount = pendingInvalidations.get(prefix)?.count ?? 0;
42
58
  logger.info("INVALIDATION_COMPLETED - cache prefix invalidation finished", {
43
59
  prefix,
44
60
  durationMs,
61
+ remainingCount,
45
62
  totalPending: pendingInvalidations.size,
46
63
  });
47
64
  }
48
65
  export function isPrefixBeingInvalidated(prefix) {
49
66
  cleanupStaleInvalidations();
50
- for (const [pendingPrefix, startedAt] of pendingInvalidations) {
67
+ for (const [pendingPrefix, entry] of pendingInvalidations) {
51
68
  if (!prefix.startsWith(pendingPrefix) && !pendingPrefix.startsWith(prefix))
52
69
  continue;
53
- const ageMs = Date.now() - startedAt;
70
+ const ageMs = Date.now() - entry.startedAt;
54
71
  totalBlockedReads++;
55
72
  logger.info("CACHE_READ_BLOCKED - preventing stale cache read", {
56
73
  requestedPrefix: prefix,
57
74
  blockingPrefix: pendingPrefix,
58
75
  invalidationAgeMs: ageMs,
76
+ blockingCount: entry.count,
59
77
  totalBlockedReads,
60
78
  totalPending: pendingInvalidations.size,
61
79
  });
@@ -71,10 +89,11 @@ export function getInvalidationDebugState() {
71
89
  return {
72
90
  pendingCount: pendingInvalidations.size,
73
91
  totalBlockedReads,
74
- entries: Array.from(pendingInvalidations, ([prefix, startedAt]) => ({
92
+ entries: Array.from(pendingInvalidations, ([prefix, entry]) => ({
75
93
  prefix,
76
- startedAt,
77
- ageMs: now - startedAt,
94
+ startedAt: entry.startedAt,
95
+ ageMs: now - entry.startedAt,
96
+ count: entry.count,
78
97
  })),
79
98
  };
80
99
  }
@@ -18,7 +18,8 @@ export function buildReadFetchState(options) {
18
18
  const cacheKey = `${cacheKeyPrefix}:${normalizedPath}`;
19
19
  const isProduction = contextProvider?.isProductionMode() ?? false;
20
20
  const releaseId = contentContext?.releaseId;
21
- const isPrefixInvalidated = (isProduction && contextProvider?.isPersistentCacheInvalidated?.(cacheKeyPrefix)) ?? false;
21
+ const isPrefixInvalidated = contextProvider?.isPersistentCacheInvalidated?.(cacheKeyPrefix) ??
22
+ false;
22
23
  const isReleaseInvalidated = isProduction && releaseId
23
24
  ? contextProvider?.isReleaseBeingInvalidated?.(releaseId)
24
25
  : undefined;
@@ -45,6 +45,8 @@ export declare class ReadOperations {
45
45
  private getFileListCacheHit;
46
46
  private setupInFlightFetch;
47
47
  private tryResolveExtensionlessPath;
48
+ private tryResolveExtensionlessPathFromFileList;
49
+ private cacheResolvedContent;
48
50
  private fetchContent;
49
51
  private fetchPublishedContent;
50
52
  private tryFallbackExtensions;
@@ -1 +1 @@
1
- {"version":3,"file":"read-operations.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/read-operations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,q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C1B,eAAe,CAAC,EAAE,sBAAsB,YAAA,EACxC,kBAAkB,CAAC,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,aAAA,EAC7C,gBAAgB,CAAC,GAAE,MAAM,OAAO,CAC/C,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CACtD,aAAA;IAKH,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIrD,kBAAkB,IAAI,IAAI;IAK1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAY3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY3C,OAAO,CAAC,mBAAmB;YAsBb,+BAA+B;YA0C/B,mBAAmB;IAgDjC,OAAO,CAAC,kBAAkB;YAoFZ,2BAA2B;YA8D3B,uCAAuC;IAmCrD,OAAO,CAAC,oBAAoB;YAgBd,YAAY;YAgGZ,qBAAqB;YA8DrB,qBAAqB;YAgDrB,+BAA+B;YA8D/B,iBAAiB;CAyBhC"}
@@ -204,20 +204,22 @@ export class ReadOperations {
204
204
  this.inFlightRequests.set(cacheKey, fetchPromise, Date.now());
205
205
  return fetchPromise;
206
206
  }
207
- async tryResolveExtensionlessPath(apiPath, cacheKeyPrefix, cacheKey, isProduction) {
207
+ async tryResolveExtensionlessPath(apiPath, cacheKeyPrefix, cacheKey, isProduction, skipPersistentCaches) {
208
208
  // Check extension resolution cache first to skip the API call entirely.
209
209
  // Once we know pages/home → pages/home.tsx, we never need to ask the API again.
210
- const cachedResolvedPath = this.extensionResolutionCache.get(apiPath);
211
- if (cachedResolvedPath) {
212
- const resolvedCacheKey = getResolvedCacheKey(cacheKeyPrefix, cachedResolvedPath);
213
- const cached = this.cache.get(resolvedCacheKey) ?? this.cache.get(cacheKey);
214
- if (cached) {
215
- logger.debug("Extension resolution cache hit", {
216
- basePath: apiPath,
217
- resolvedPath: cachedResolvedPath,
218
- });
219
- setRequestScopedFile(cacheKey, cached);
220
- return cached;
210
+ if (!skipPersistentCaches) {
211
+ const cachedResolvedPath = this.extensionResolutionCache.get(apiPath);
212
+ if (cachedResolvedPath) {
213
+ const resolvedCacheKey = getResolvedCacheKey(cacheKeyPrefix, cachedResolvedPath);
214
+ const cached = this.cache.get(resolvedCacheKey) ?? this.cache.get(cacheKey);
215
+ if (cached) {
216
+ logger.debug("Extension resolution cache hit", {
217
+ basePath: apiPath,
218
+ resolvedPath: cachedResolvedPath,
219
+ });
220
+ setRequestScopedFile(cacheKey, cached);
221
+ return cached;
222
+ }
221
223
  }
222
224
  }
223
225
  try {
@@ -234,15 +236,7 @@ export class ReadOperations {
234
236
  cacheKey,
235
237
  resolvedCacheKey: resolvedCacheKey === cacheKey ? undefined : resolvedCacheKey,
236
238
  });
237
- if (isProduction) {
238
- this.cache.set(cacheKey, resolved.content);
239
- if (resolvedCacheKey !== cacheKey)
240
- this.cache.set(resolvedCacheKey, resolved.content);
241
- }
242
- setRequestScopedFile(cacheKey, resolved.content);
243
- if (resolvedCacheKey !== cacheKey) {
244
- setRequestScopedFile(resolvedCacheKey, resolved.content);
245
- }
239
+ this.cacheResolvedContent(cacheKey, resolvedCacheKey, resolved.content, isProduction && !skipPersistentCaches);
246
240
  return resolved.content;
247
241
  }
248
242
  catch (error) {
@@ -253,6 +247,40 @@ export class ReadOperations {
253
247
  return null;
254
248
  }
255
249
  }
250
+ async tryResolveExtensionlessPathFromFileList(normalizedPath, cacheKeyPrefix, cacheKey, isProduction, ctx, isPreviewMode) {
251
+ const candidatePaths = EXTENSION_PRIORITY.map((ext) => `${normalizedPath}${ext}`);
252
+ const resolved = await this.fileListIndex.findFirstWithContent(candidatePaths);
253
+ if (!resolved)
254
+ return null;
255
+ const resolvedCacheKey = getResolvedCacheKey(cacheKeyPrefix, resolved.path);
256
+ this.extensionResolutionCache.set(normalizedPath, resolved.path);
257
+ logContentMetric("FILE_LIST_HIT", {
258
+ path: normalizedPath,
259
+ resolvedPath: resolved.path,
260
+ mode: ctx?.sourceType ?? "unknown",
261
+ cacheKey,
262
+ isPreviewMode,
263
+ });
264
+ logger.debug("Resolved extension from file list index", {
265
+ basePath: normalizedPath,
266
+ resolvedPath: resolved.path,
267
+ cacheKey,
268
+ resolvedCacheKey: resolvedCacheKey === cacheKey ? undefined : resolvedCacheKey,
269
+ });
270
+ this.cacheResolvedContent(cacheKey, resolvedCacheKey, resolved.content, isProduction);
271
+ return resolved.content;
272
+ }
273
+ cacheResolvedContent(cacheKey, resolvedCacheKey, content, persistToCache) {
274
+ if (persistToCache) {
275
+ this.cache.set(cacheKey, content);
276
+ if (resolvedCacheKey !== cacheKey)
277
+ this.cache.set(resolvedCacheKey, content);
278
+ }
279
+ setRequestScopedFile(cacheKey, content);
280
+ if (resolvedCacheKey !== cacheKey) {
281
+ setRequestScopedFile(resolvedCacheKey, content);
282
+ }
283
+ }
256
284
  async fetchContent(normalizedPath) {
257
285
  // Framework paths should NEVER be fetched from API - they must be read from local filesystem.
258
286
  // If we reach here for a framework path, the module server's local resolution failed.
@@ -285,7 +313,12 @@ export class ReadOperations {
285
313
  if (fileListCached)
286
314
  return fileListCached;
287
315
  if (!hasKnownExt) {
288
- const resolved = await this.tryResolveExtensionlessPath(apiPath, cacheKeyPrefix, cacheKey, isProduction);
316
+ if (!skipPersistentCaches) {
317
+ const resolvedFromFileList = await this.tryResolveExtensionlessPathFromFileList(normalizedPath, cacheKeyPrefix, cacheKey, isProduction, ctx, isPreviewMode);
318
+ if (resolvedFromFileList)
319
+ return resolvedFromFileList;
320
+ }
321
+ const resolved = await this.tryResolveExtensionlessPath(apiPath, cacheKeyPrefix, cacheKey, isProduction, skipPersistentCaches);
289
322
  if (resolved)
290
323
  return resolved;
291
324
  }
@@ -376,8 +409,13 @@ export class ReadOperations {
376
409
  });
377
410
  // Mark all promises as handled to prevent unhandled rejection errors
378
411
  // when we return early after a high-priority success (skipping lower-priority promises).
379
- for (const p of promises)
380
- p.catch(() => { });
412
+ for (const p of promises) {
413
+ p.catch((err) => {
414
+ logger.debug("Fallback attempt failed", {
415
+ error: err instanceof Error ? err.message : String(err),
416
+ });
417
+ });
418
+ }
381
419
  // Await in priority order: return as soon as highest-priority succeeds
382
420
  for (const promise of promises) {
383
421
  try {
@@ -29,9 +29,16 @@ export declare class WebSocketManager {
29
29
  private pendingChangedPaths;
30
30
  private wsConnectionId;
31
31
  private wsConsecutiveFailures;
32
+ private wsErrorLogged;
32
33
  private disposed;
34
+ private previewInvalidationVersion;
35
+ private activePreviewInvalidationPrefixes;
33
36
  private pokeMetrics;
34
37
  constructor(deps: WebSocketDeps);
38
+ private getConnectionLogContext;
39
+ private getPreviewInvalidationPrefixes;
40
+ private beginPreviewInvalidation;
41
+ private completePreviewInvalidation;
35
42
  getPokeMetrics(): {
36
43
  received: number;
37
44
  invalidationsTriggered: number;
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/websocket-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAsB/F,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,qBAAqB,EAAE,qBAAqB,CAAC;IAE7C,iBAAiB,EAAE,MAAM,sBAAsB,GAAG,IAAI,CAAC;IACvD,gBAAgB,EAAE,MAAM,aAAa,CAAC;IACtC,aAAa,EAAE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AAO,CAAC,WAAW;CAyBpB"}
1
+ {"version":3,"file":"websocket-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/websocket-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAwB/F,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,qBAAqB,EAAE,qBAAqB,CAAC;IAE7C,iBAAiB,EAAE,MAAM,sBAAsB,GAAG,IAAI,CAAC;IACvD,gBAAgB,EAAE,MAAM,aAAa,CAAC;IACtC,aAAa,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACxC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,gBAAgB,EAAE,CAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,KAC7C,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,qBAAa,gBAAgB;IAqBf,OAAO,CAAC,QAAQ,CAAC,IAAI;IApBjC,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,gBAAgB,CAAsD;IAC9E,OAAO,CAAC,gBAAgB,CAAuD;IAC/E,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,iBAAiB,CAAsD;IAC/E,OAAO,CAAC,0BAA0B,CAAsD;IACxF,OAAO,C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