Files
webstudio/packages/protocol
Oleg Isonen 6e10ae3809 fix: Fix Builder paste transfer data handling and publish sync edge cases (#5861)
- Fix publish sync for empty JSON data variables
- Retry transient asset downloads once with shared sync-client backoff
- Fix Builder paste handling for Webstudio transfer data
- Add transfer/data-envelope terminology and colocated runtime
data-format modules
- Rename page clipboard runtime operation to page transfer semantics
- Report malformed Webstudio/Webflow paste data through paste results
instead of inserting it as text
- Add browser-level E2E coverage for instance, page, folder, template,
generic plugin, malformed data, native input, and content-mode paste
flows

## Details

- Allows empty JSON data variables to sync/publish correctly.
- Adds asset download retry coverage and uses shared backoff logic.
- Introduces runtime `data-formats` modules for data envelopes, instance
transfer data, and page transfer data.
- Removes stale clipboard aliases and `validateTemplateStructure`.
- Keeps clipboard as a Builder UI transport concern while
runtime/protocol use transfer-data terminology.
- Changes paste plugins to return expressive success/error results so
callers can show toast errors and stop fallback insertion.
- Prevents malformed Webstudio transfer payloads from falling through to
text/HTML/markdown insertion.
- Handles malformed Webflow-owned paste data without throwing.
- Adds shared copy-paste fragment insertion helpers to reduce duplicated
breakpoint-warning/fragment-data logic.
2026-07-10 13:51:55 +02:00
..

Protocol

@webstudio-is/protocol owns Webstudio data exchange protocols.

The project bundle is the external export/import artifact used by sync, local .webstudio/data.json, project import, transferred asset files, and prebuild. This package owns the assembled bundle schemas, transfer RPC payloads, and bundle compatibility/version helpers.

Domain models such as pages, assets, and serialized builds remain owned by their domain packages and are composed here through schema-only entrypoints. Do not copy those schemas into this package.

Terminology

Project bundle is the authoritative external project artifact. It is used by sync, .webstudio/data.json, project import, transferred asset files, and prebuild.

Data envelope is a serialized single-key object whose key is a versioned Webstudio marker, for example { "@webstudio/instance/v0.1": data }. The envelope identifies the payload version and lets consumers detect malformed Webstudio-owned data before falling back to other formats.

Transfer data is the domain payload inside a data envelope. Examples include InstanceTransferData, InstancesTransferData, and PageTransferData. Transfer data is portable and detached from a project; insertion/import remaps ids and merges it into authoritative project state. Runtime-owned transfer formats live in @webstudio-is/project-build/runtime/data-formats/*.

Clipboard data is a UI transport concern. Builder copy/paste may serialize transfer data into a data envelope and place it on the browser clipboard, but runtime and protocol code should name the reusable format as data envelope or transfer data, not clipboard.