Crosswake. Install. Patcher
(crosswake v0.2.4)
View Source
Applies explicit, idempotent Crosswake install patches to host-owned files.
Patch what is canonical, print what is not (D-41)
The endpoint's static plug block is mechanical and identical across every host, so
it is PATCHED inside the same markers the router patch uses. The layout's module
import and the socket constructor's hooks map are not mechanical — the import path
depends on whether the host bundles JavaScript at all, and the LiveSocket
constructor is host-authored — so those are PRINTED for the adopter to place, never
rewritten under them.
Summary
Functions
The canonical endpoint static plug block — the part of the wiring that IS mechanical and therefore gets patched (D-41).
The LiveView hook name the layout registers and the markup references.
The public URL the endpoint's static plug serves the library-owned hook from.
The layout fragments Crosswake PRINTS rather than patches (D-41): the module-script import, the hooks-map entry on the socket constructor, and the single hook element.
Adds the canonical Crosswake static plug block to a host endpoint, inside the same
idempotent markers patch_router/2 uses.
The public URL the endpoint's static plug serves the library's compiled
tokens.css from (Phase 155 D-26). One served copy — hosts never carry their
own tokens.css.
Types
@type patch_action() ::
:marker_reused
| :marker_stale
| :marker_inserted
| :endpoint_static_plug_added
| :live_view_import_replaced
| :live_dashboard_import_scoped
| :crosswake_import_added
@type patch_result() :: %{ router_file: String.t(), changed?: boolean(), actions: [patch_action()] }
Functions
The canonical endpoint static plug block — the part of the wiring that IS mechanical and therefore gets patched (D-41).
It mirrors the shape of the :phoenix and :phoenix_live_view blocks a Phoenix
host already carries, serving the hook AND the library's compiled tokens.css
from the :crosswake application's own priv/static directory at the
/crosswake prefix (Phase 155 D-26 — one served copy, no host-side duplicate).
@spec hook_name() :: String.t()
The LiveView hook name the layout registers and the markup references.
@spec hook_url() :: String.t()
The public URL the endpoint's static plug serves the library-owned hook from.
@spec layout_wiring_lines() :: [String.t()]
The layout fragments Crosswake PRINTS rather than patches (D-41): the module-script import, the hooks-map entry on the socket constructor, and the single hook element.
@spec marker_lines() :: [String.t()]
@spec patch_endpoint(String.t()) :: {:ok, patch_result()} | {:error, String.t()}
Adds the canonical Crosswake static plug block to a host endpoint, inside the same
idempotent markers patch_router/2 uses.
Returns {:ok, result} when the endpoint was patched or already carried the
markers, and {:error, reason} when no endpoint declaration could be found — the
installer prints that as guidance rather than failing the install, because an
adopter can always place the block by hand.
@spec patch_router(String.t(), String.t()) :: {:ok, patch_result()} | {:error, String.t()}
@spec tokens_url() :: String.t()
The public URL the endpoint's static plug serves the library's compiled
tokens.css from (Phase 155 D-26). One served copy — hosts never carry their
own tokens.css.