Skip to content

Upgrading to 0.13 ​

Upgrading a project from ferrovue 0.12 to 0.13: the steps to take and what behaves differently.

The CHANGELOG lists every change; this page picks out what an application notices. 0.13 removes nothing and renames nothing: what it adds was refused before, so an application that compiles with 0.12 compiles with 0.13. The steps are the version of generated code, which moves to 7, and one setting for builds on TypeScript 7. The page for the release before is upgrading_to_0_12.

Steps ​

1. Bump both halves together ​

The npm package and the crates are released together at one version, and generated code works with the crate of its own release. Bump the npm package:

sh
pnpm add -D ferrovue@^0.13.0

and the crate, in Cargo.toml:

toml
ferrovue = "0.13"

ferrovue depends on ferrovue-core, ferrovue-router and ferrovue-i18n at exactly its own version, so an application that names only ferrovue gets the other three with it. One that names any of them itself bumps it to 0.13 as well. A project that lists ferrovue@0.12.0 in pnpm's minimumReleaseAgeExclude adds ferrovue@0.13.0 beside it, and removes the 0.12.0 entry once the lockfile no longer holds it.

2. Generate every component again ​

sh
pnpm ferrovue

The 0.13 compiler writes version 7 of generated code, and mod.rs opens with ferrovue::__compat!(7). Version 7 calls what the 0.12 crate lacks: the canonical key of a loader argument typed as an interface, and JsRegex for regular expression literals. The 0.13 crate supports versions 6 and 7, so a module generated by 0.12 still builds against it. The 0.12 crate stops a module of version 7 at its first line:

text
error: this module was generated as version 7 of ferrovue's generated code, and this `ferrovue` crate supports version 6: use the `ferrovue` npm package and the `ferrovue` crate of one release, and run `ferrovue` to generate the module again

Unions of string literals reach a child's union prop through a match over their variants in more places, so generated files change once. A CI job that runs pnpm ferrovue --check reports each module as stale until it is generated again with 0.13 and committed. See the version check.

3. Give @vitejs/plugin-vue a file system on TypeScript 7 ​

defineProps<P>() with P imported from a .ts file compiles in 0.13. Vue resolves P through TypeScript's JavaScript API, which TypeScript 7 does not have, so @vitejs/plugin-vue needs the file system named by its script.fs option. ferrovue/vite sets it where the options name none, so a build that uses ferrovue's Vite plugin needs no change. A build without it adds the setting shown in Props from a .ts file. TypeScript 5 and 6 need nothing.

Behaviour that changed ​

A string outside a union refuses the render ​

Where the Rust caller holds a string and the render needs a union's enum (a value of a Record<string, Tone>, a store's state), 0.13 parses it as the component renders, and a string outside the union refuses the render with FV0518. 0.12 gave some of these the union's last member. A render that refuses returns Refused from try_render; render panics, as it does for every refusal.

What 0.13 adds ​

Each of these was refused by 0.12 and compiles now: props types imported from .ts files, prop types written in place and tuples, lookup keys from constant numbers and string methods, <component :is> of a defineModel union, a <textarea> or <input v-model> at a component's root, || after an optional value, loaders awaited by Promise.all and loader arguments typed as interfaces, and a subset of regular expression literals. The crate adds Document for the page shell and splice for components in trusted v-html. The CHANGELOG links each to its page of this guide.