v3.0.1
svelte-spa-router has reached version 3.0! 🎉🥳
This major release contains a set of new features, most notably support for dynamically-imported components (which enables code-splitting)!
Breaking changes:
- Because parameters from the URL are now URL-decoded, if you were doing it on your application before, you might need to update the code to avoid URL-decoding twice
- The
wrap
method exported bysvelte-spa-router
is now considered deprecated and using it will throw a warning; it will be removed in a future version. Please upgrade to the newwrap
method exported bysvelte-spa-router/wrap
, which also supports dynamically-imported routes. See the documentation for route pre-conditions. - The method
nextTickPromise
, which was already deprecated, has been removed
New features:
- Add support for dynamically-imported components (fixes #73)
- Restore scroll position on navigation (thanks @liquiddandruff)
- Route pre-conditions can be async functions (fixes #125)
- Can now pass static props to a component using the wrap method (fixes #131) (thanks @matt-psaltis)
- Route Loaded event includes the path of the route (fixes #132)
Changes:
- Decode URL-encoded parameters from URL (fixes #107)
- Prefix for nested routers can be a regular expression that will be removed if matched (fixes #134)
- Using the
tick
method from Svelte rather than re-implementing it. The methodnextTickPromise
, which was already deprecated, has been removed. - svelte-spa-router now uses ES2016 features (async/await) internally and requires a recent-enough browser (most browsers from 2017 onwards should be good), or transpilation with Babel
- Added devcontainer, so you can develop inside a Docker container or GitHub Codespaces
Fixes:
- Tests now run against Chrome running in Docker, so there's no more issues with the CI server updating Chrome
Note: version 3.0.0 was retired minutes after release because of an issue with the .npmignore file that caused more files to be included in the NPM bundle than needed. No code changes happened between 3.0.0 and 3.0.1.