You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Protocol-first iframe runtime for explicit host/child communication.
10
11
11
-
`@crup/port` exists for the part of embedded app work that usually rots first: lifecycle, handshake timing, and message discipline. It gives the host page a small runtime for mounting an iframe, opening it inline or in a modal, enforcing origin checks, and exchanging request/response messages without ad hoc `postMessage` glue.
12
+
`@crup/port` exists for the part of embedded app work that usually rots first: lifecycle, handshake timing, and message discipline. It gives the host page a small runtime for mounting an iframe, opening it inline or in a modal, pinning exact origins, and exchanging request/response/error messages without ad hoc `postMessage` glue.
-`docs.yml` deploys the Vite demo to GitHub Pages at `https://crup.github.io/port/`.
192
-
-`release.yml` is a guarded manual stable release workflow modeled on `crup/react-timer-hook`.
210
+
-`release.yml` is a guarded manual stable release workflow modeled on `crup/react-timer-hook`, and it persists the published version back to `main`.
193
211
-`prerelease.yml` publishes a manual alpha prerelease from the `next` branch.
194
212
195
213
## Security
196
214
197
-
This package helps with origin checks, but it cannot secure a weak embed strategy on its own. Always pin `allowedOrigin`, set restrictive iframe attributes, and validate application-level payloads. The practical guidance lives in [`docs/security.md`](docs/security.md).
215
+
This package helps enforce the runtime boundary, but it cannot secure a weak embed strategy on its own. Always pin `allowedOrigin`, set restrictive iframe attributes, and validate application-level payloads. The practical guidance lives in [`docs/security.md`](docs/security.md).
Copy file name to clipboardExpand all lines: docs/api-reference.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,8 @@ Removes a previously registered handler.
62
62
63
63
Mutates the in-memory config for future runtime behavior.
64
64
65
+
Once the port has mounted, only timeout and sizing fields may change. `url`, `allowedOrigin`, `target`, and `mode` are fixed for the lifetime of the mounted session.
66
+
65
67
#### `getState(): PortState`
66
68
67
69
Returns the current runtime state.
@@ -85,15 +87,15 @@ Returns the current runtime state.
@@ -147,12 +152,10 @@ Document your own contract in a table like this:
147
152
148
153
## Error Strategy
149
154
150
-
You have two choices when child-side work fails:
151
-
152
-
1. respond with a domain payload that includes failure details
153
-
2. emit `kind: 'error'` so the host receives `MESSAGE_REJECTED`
155
+
You have two good choices when child-side work fails:
154
156
155
-
The current child runtime exposes `respond()` only, so if you need richer rejection semantics you can either send a failure-shaped success payload or extend the runtime for explicit error responses.
157
+
1.`reject(messageId, payload)` when the host should take a true failure path
158
+
2.`respond(messageId, payload)` with a domain-level failure shape when the host still treats it as a normal result
Copy file name to clipboardExpand all lines: docs/getting-started.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ const child = createChildPort({
54
54
});
55
55
```
56
56
57
-
The child stays idle until it receives a valid `port:hello` message. Once origin validation succeeds, it replies with `port:ready` automatically.
57
+
The child stays idle until it receives a valid `port:hello` message from the exact configured `allowedOrigin`. Once origin validation succeeds, it replies with `port:ready` automatically.
Copy file name to clipboardExpand all lines: docs/lifecycle.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,6 +125,8 @@ Look at:
125
125
-`allowedOrigin` mismatch
126
126
-`handshakeTimeoutMs` too low for the actual child startup path
127
127
128
+
Failed `mount()` calls now clean up the iframe and reset the runtime to `idle`, so a corrected retry can mount again without creating a poisoned instance.
129
+
128
130
### Host calls too early
129
131
130
132
`send()` and `call()` require the runtime to be `ready`, `open`, or `closed`. Calling them earlier throws `INVALID_STATE`.
Copy file name to clipboardExpand all lines: docs/releasing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ This repository now has a release flow similar in shape to `crup/react-timer-hoo
14
14
-`release.yml` is a manual workflow dispatch from `main`.
15
15
- It uses a guarded release gate, a separate verify job, and a dedicated publish job.
16
16
-`NPM_TOKEN` is passed directly to the publish step via `NODE_AUTH_TOKEN` and `NPM_TOKEN`.
17
-
- After publish, the workflow creates a GitHub release tag and release notes.
17
+
- After publish, the workflow commits the released `package.json` version back to `main`, then creates the GitHub release tag and notes from that release commit.
0 commit comments