Upgrading
What changed in each release, what to do when you upgrade, and how wf migrate carries an older project forward.
Installing a newer version
Run the installer again — it replaces the binary in place — or cargo install webfluent --force. wf --version says what you have. Update wf-lsp and the editor extension with it: the language server is built from the same compiler.
The full notes for every release are in RELEASE_NOTES.md; what follows is what an upgrade asks of you.
4.1 (next release)
Nothing to change in your code. New:
- Offline: name
offlinein the config for a service worker, writes kept for later, and an update flow (chapter 19). - Peers:
peer link = rtc(signal: …), a WebRTC data channel to another page (chapter 18). envfrom a.envfile and the shell, on top of the config (chapter 30).- Unknown config keys are reported, with the key they probably meant.
- Pagination:
paginate: .page,.items,.loadMore(),.hasMore. ?lang=opens a page in that locale, as thehreflangalternates promise.class-exported libraries work throughexternal: a class is constructed when called.- Every standard DOM event is accepted in
on ….
Fixed, and worth knowing because they could have bitten you:
- A private
envvalue no longer reaches the bundle. 4.0 refused a page that read a private name, but still wrote the wholeenvmap intoapp.js. If you deployed 4.0 or 4.0.1 with a secret inenv, rotate it. - An action's parameters are its own:
action move(by: Number)readbyas a signal and threw. head { }tags may read a page'sderivedvalues.- A resource's
state,dataanderror, and a socket'smessages, show their values in text. navigatorandlocationcompile as the browser's.- Two declarations on one line —
theme T { color-primary: #0F766E radius-md: 14px }— are two, not one. S04reports two pages on one route;A12counts anh1in each branch of anifas one.
4.0
4.0 changed what the compiler allows. wf migrate handles the mechanical part and names every place that needs a decision:
bash
envis public or private. A page may only read a name beginningPUBLIC_or listed inpublic_env. The migration adds every name your pages already read topublic_envand prints the list: read it, because public means anyone who opens the site can read the value.- An
on*attribute is an error (onclick: "…"); writeon click { }. - A URL a browser would run is refused —
javascript:,data:,vbscript:,blob:,file:inhref:,src:,to:,poster:ornavigate(). - Stores are built on first read, not at boot. A store whose set-up must run anyway takes
eager: true. - A
persistvalue follows other tabs.sync: falseopts out. WF.storeandWF.hostwere renamed in the runtime surface.- Layouts stay as written: a
Rowno longer turns into a column on a narrow screen by itself. The migration adds.stacksto keep the old behaviour.
3.x
WebFluent 3 introduced the grammar this guide describes: lowercase declarations, one positional argument, flags after a dot, on click { } handlers, style { } blocks of CSS.
From WebFluent 2
A WebFluent 2 file (Page Home (path: "/") { … }) is refused by wf build with a pointer to the migration. wf migrate rewrites every .wf under src/ into the current grammar — a change of spelling that builds to what it built before — and wf migrate --wfx writes the result in the indented layout.
Checked by the test suite
Every code block in the guide is parsed, checked and type-checked on each release.