Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 52 additions & 6 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,58 @@ Replaces pywrangler. It drops vendored files your Worker never imports before ea
</div>
</div>

```sh
uvx wynd init # write a new crosswind-workers project
uvx wynd dev # install packages for the Worker's Python, then wrangler dev
uvx wynd deploy # prune unused packages, then wrangler deploy
uvx wynd tail # anything else goes to Wrangler unchanged
```
<div class="highlight cw-term"><pre><code><span class="cw-term__dim">$</span> <span class="cw-term__in">uvx wynd init my-worker</span>
<span class="cw-term__bold"> 1)</span> crosswind-workers
<span class="cw-term__bold"> 2)</span> workers-runtime-sdk
Workers SDK [1]: <span class="cw-term__in">1</span>
<span class="cw-term__bold"> 1)</span> containers-py
<span class="cw-term__bold"> 2)</span> cf-agents
Add SDKs, comma-separated: <span class="cw-term__in"></span>
<span class="cw-term__wynd">wynd:</span> wrote src/env.py
<span class="cw-term__wynd">wynd:</span> created my-worker. Run `wynd dev` in ~/my-worker to serve it.
&#8203;
<span class="cw-term__dim">$</span> <span class="cw-term__in">cd my-worker</span>
<span class="cw-term__dim">$</span> <span class="cw-term__in">uvx wynd dev</span>
⛅️ wrangler 4.129.0
<span class="cw-term__dim">───────────────────────────────────────────────────</span>
╭──────────────────────────╮
│ [b] <span class="cw-term__faint">open a browser </span>│
│ [d] <span class="cw-term__faint">open devtools </span>│
│ [e] <span class="cw-term__faint">open local explorer </span>│
│ [t] <span class="cw-term__faint">start tunnel </span>│
│ [c] <span class="cw-term__faint">clear console </span>│
│ [x] <span class="cw-term__faint">to exit </span>│
╰──────────────────────────╯
Attaching additional modules:
<span class="cw-term__dim">┌────────────────────┬────────┬────────────┐</span>
<span class="cw-term__dim">│</span><span class="cw-term__head"> Name </span><span class="cw-term__dim">│</span><span class="cw-term__head"> Type </span><span class="cw-term__dim">│</span><span class="cw-term__head"> Size </span><span class="cw-term__dim">│</span>
<span class="cw-term__dim">├────────────────────┼────────┼────────────┤</span>
<span class="cw-term__dim">│</span> env.py <span class="cw-term__dim">│</span> python <span class="cw-term__dim">│</span> 0.13 KiB <span class="cw-term__dim">│</span>
<span class="cw-term__dim">├────────────────────┼────────┼────────────┤</span>
<span class="cw-term__dim">│</span> Vendored Modules <span class="cw-term__dim">│</span> <span class="cw-term__dim">│</span> 131.24 KiB <span class="cw-term__dim">│</span>
<span class="cw-term__dim">├────────────────────┼────────┼────────────┤</span>
<span class="cw-term__dim">│</span> Total (43 modules) <span class="cw-term__dim">│</span> <span class="cw-term__dim">│</span> 131.37 KiB <span class="cw-term__dim">│</span>
<span class="cw-term__dim">└────────────────────┴────────┴────────────┘</span>
<span class="cw-term__faint">⎔ Starting local server...</span>
<span class="cw-term__ok">[wrangler:info]</span> Ready on <span class="cw-term__ok">http://localhost:8787</span>
&#8203;
<span class="cw-term__dim">$</span> <span class="cw-term__in">uvx wynd deploy --dry-run</span>
<span class="cw-term__wynd">wynd:</span> python_modules is 134,389 bytes, 85,098 after pruning (49,291 fewer). Each file's decision is in .wynd/shake.txt.
⛅️ wrangler 4.129.0
<span class="cw-term__dim">───────────────────────────────────────────────────</span>
Attaching additional modules:
<span class="cw-term__dim">┌────────────────────┬────────┬───────────┐</span>
<span class="cw-term__dim">│</span><span class="cw-term__head"> Name </span><span class="cw-term__dim">│</span><span class="cw-term__head"> Type </span><span class="cw-term__dim">│</span><span class="cw-term__head"> Size </span><span class="cw-term__dim">│</span>
<span class="cw-term__dim">├────────────────────┼────────┼───────────┤</span>
<span class="cw-term__dim">│</span> env.py <span class="cw-term__dim">│</span> python <span class="cw-term__dim">│</span> 0.13 KiB <span class="cw-term__dim">│</span>
<span class="cw-term__dim">├────────────────────┼────────┼───────────┤</span>
<span class="cw-term__dim">│</span> Vendored Modules <span class="cw-term__dim">│</span> <span class="cw-term__dim">│</span> 83.10 KiB <span class="cw-term__dim">│</span>
<span class="cw-term__dim">├────────────────────┼────────┼───────────┤</span>
<span class="cw-term__dim">│</span> Total (37 modules) <span class="cw-term__dim">│</span> <span class="cw-term__dim">│</span> 83.24 KiB <span class="cw-term__dim">│</span>
<span class="cw-term__dim">└────────────────────┴────────┴───────────┘</span>
Total Upload: <span class="cw-term__ok">83.42 KiB / gzip: 19.53 KiB</span>
No bindings found.
--dry-run: exiting now.</code></pre></div>

</div>

Expand Down
110 changes: 110 additions & 0 deletions docs/docs/javascripts/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,113 @@ document.querySelector(".cw-demo button")?.addEventListener("click", (event) =>
frame.allow = "fullscreen; autoplay; gamepad";
event.currentTarget.parentElement.replaceChildren(frame);
});

// Wynd pane: replays the transcript as a terminal session. The static transcript stays
// in the page for screen readers and is what shows without JS or with reduced motion.
(() => {
const box = document.querySelector(".cw-term");
const code = box?.querySelector("code");
if (!code || matchMedia("(prefers-reduced-motion: reduce)").matches) return;

const lines = code.innerHTML.split("\n");
const live = code.cloneNode(false);
live.setAttribute("aria-hidden", "true");
code.classList.add("cw-term__sr");
code.after(live);

const pane = box.closest(".cw-pane");
const button = document.createElement("button");
button.type = "button";
button.className = "cw-term__control";
pane.append(button);

const caret = document.createElement("span");
caret.className = "cw-term__caret";
const sleep = (ms) => new Promise((done) => setTimeout(done, ms));
const isBox = (text) => /^[│├┌└╭╰─]/.test(text);
let run = 0;
let pinned = true; // follow new output until the reader scrolls up

box.addEventListener("scroll", () => {
pinned = box.scrollHeight - box.scrollTop - box.clientHeight < 8;
});
const follow = () => {
if (pinned) box.scrollTop = box.scrollHeight;
};

function addLine(html) {
const line = document.createElement("span");
line.className = "cw-term__line";
line.innerHTML = html;
live.append(line, "\n");
return line;
}

async function play() {
const id = ++run;
const alive = () => id === run;
live.replaceChildren();
pinned = true;
box.scrollTop = 0;
button.textContent = "Skip";

for (const html of lines) {
const at = html.indexOf('<span class="cw-term__in">');
if (at === -1) {
const text = html.replace(/<[^>]+>/g, "");
const pause = text === "​" ? 1400 : isBox(text) ? 12 : /Ready on|Starting local/.test(text) ? 700 : 70;
await sleep(pause);
if (!alive()) return;
addLine(html);
follow();
continue;
}
// A line the user types: show what precedes the input, then type it out
const typed = html.slice(at).replace(/<[^>]+>/g, "");
const line = addLine(html.slice(0, at));
const input = document.createElement("span");
line.append(input, caret);
follow();
caret.classList.add("is-idle");
await sleep(typed ? 650 : 900);
caret.classList.remove("is-idle");
for (const char of typed) {
if (!alive()) return;
input.textContent += char;
await sleep(38 + Math.random() * 60);
}
await sleep(280);
if (!alive()) return;
caret.remove();
await sleep(typed.startsWith("uvx") ? 500 : 120);
}
finish(id);
}

function finish(id) {
if (id !== run) return;
const line = addLine('<span class="cw-term__dim">$</span> ');
caret.classList.add("is-idle");
line.append(caret);
follow();
button.textContent = "Replay";
}

function skip() {
const id = ++run;
live.replaceChildren();
for (const html of lines) addLine(html);
pinned = true;
finish(id);
}

button.addEventListener("click", () => (button.textContent === "Skip" ? skip() : play()));

// Start the first time the pane is on screen; a hidden pane never intersects
const seen = new IntersectionObserver(([entry]) => {
if (!entry.isIntersecting) return;
seen.disconnect();
play();
}, { threshold: 0.35 });
seen.observe(box);
})();
99 changes: 99 additions & 0 deletions docs/docs/stylesheets/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -1068,3 +1068,102 @@
display: none;
}
}

/* Wynd pane: real terminal output, coloured as Rich and Wrangler print it */
.cw-term__prompt,
.cw-term__dim {
color: var(--cw-muted);
}

.cw-term__wynd {
color: var(--cw-accent);
font-weight: 700;
}

.cw-term__faint {
color: var(--cw-label);
}

.cw-term__bold {
font-weight: 700;
}

.cw-term__head {
color: var(--cw-purple);
}

.cw-term__ok {
color: var(--cw-accent);
}

/* Wynd pane terminal playback (home.js). The static transcript stays for screen readers. */
.cw-pane:has(.cw-term) {
position: relative;
}

/* Terminal line height, so box-drawing borders join up; room below for the control */
.md-typeset .cw-term pre > code {
padding-bottom: 2.2rem;
line-height: 1.3;
}

.cw-term__sr {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: pre;
}

.cw-term__line {
animation: cw-term-line 120ms var(--cw-ease-out);
}

@keyframes cw-term-line {
from {
opacity: 0.35;
}
}

.cw-term__caret {
display: inline-block;
width: 0.6em;
height: 1.2em;
margin-bottom: -0.25em;
background-color: var(--cw-accent);
}

.cw-term__caret.is-idle {
animation: cw-term-blink 1.06s steps(1) infinite;
}

@keyframes cw-term-blink {
50% {
opacity: 0;
}
}

.cw-term__control {
position: absolute;
right: 0.8rem;
bottom: 0.6rem;
padding: 0.12rem 0.45rem;
border: 1px solid var(--cw-border);
border-radius: var(--cw-radius-m);
background-color: var(--cw-elevated);
color: var(--cw-text-2);
font: 400 0.55rem/1.5 var(--md-code-font-family);
cursor: pointer;
transition: border-color var(--cw-fast), color var(--cw-fast);
}

.cw-term__control:is(:hover, :focus-visible) {
border-color: var(--cw-border-strong);
color: var(--cw-text);
}

.cw-term__control:focus-visible {
outline: 1px solid var(--cw-accent);
outline-offset: 2px;
}
Loading