Skip to content

Lazy-load optional OPFS Blueprint dependencies - #4218

Closed
ashfame wants to merge 1 commit into
agent/opfs-export-filteringfrom
agent/opfs-export-boundary
Closed

Lazy-load optional OPFS Blueprint dependencies#4218
ashfame wants to merge 1 commit into
agent/opfs-export-filteringfrom
agent/opfs-export-boundary

Conversation

@ashfame

@ashfame ashfame commented Jul 30, 2026

Copy link
Copy Markdown
Member

What

Keeps saved-site metadata serialization in opfs-site-storage.ts and loads Blueprint bundle storage only when a Blueprint-backed site is read or reset. Export-only consumers avoid eagerly loading the optional Blueprint editor path without introducing a separate metadata serializer.

Why

Bundle restoration and reset support are conditional, while metadata serialization belongs with the OPFS storage implementation. This keeps the useful lazy boundary and addresses the review concern about moving metadataToStoredFormat() solely for loading behavior.

Stack

Checks

  • npm exec nx test playground-website
  • npm exec nx lint playground-website
  • npm exec nx typecheck playground-website
  • npm exec nx build playground-website

@ashfame
ashfame force-pushed the agent/opfs-export-boundary branch from 3912eb4 to fe66b7e Compare July 30, 2026 19:31
@ashfame

ashfame commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Optimization analysis reveals no savings, but negligibly worse:

   API startup                Raw JS      gzip JS    Requests
  ━━━━━━━━━━━━━━━━━━━━━━  ━━━━━━━━━━━  ━━━━━━━━━━━  ━━━━━━━━━━
   Eager imports           706,309 B    174,286 B           3
  ──────────────────────  ───────────  ───────────  ──────────
   Lazy imports (#4218)    706,762 B    174,293 B           3
  ──────────────────────  ───────────  ───────────  ──────────
   Lazy-loading savings       −453 B         −7 B           0

The lazy version is negligibly larger: 0.064% raw and 0.004% gzip.

The reason is Rollup’s chunk assignment:

  • With eager imports, the small Blueprint-bundle storage helper is incorporated into opfs-site-storage.
  • With this PR, its dynamic import resolves through the existing Blueprint Editor chunk.
  • A cold Blueprint-backed read or reset then preloads nine editor-related assets totalling approximately 1.50 MB raw / 483 KB gzip. A regular ZIP export does not trigger these assets—but it did not trigger them in the eager build either.

Hence, Closing this PR. cc: @brandonpayton

@ashfame ashfame closed this Jul 30, 2026
@ashfame
ashfame deleted the agent/opfs-export-boundary branch July 31, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant