Skip to content

Releases: single-spa/single-spa

v5.3.1

02 Apr 15:58
Compare
Choose a tag to compare

Fixes

  • Fix duplicate error codes for single-spa error documentation (#499 via @Sauloxd)
  • Typescript: now exporting StartOpts type (#501 via @kuitos)
  • Typescript: allow for each lifecycle to be either an array or function (#502 via @kuitos)
  • Typescript: correct problem with mountParcel and mountRootParcel typings (#500 via @kuitos)

v5.3.0

01 Apr 22:02
Compare
Choose a tag to compare

Features

  • single-spa can now run in NodeJS (#494).
  • The registerApplication API now accepts an object, as an alternative to multiple arguments (#482 from @Sauloxd)
  • The registerApplication API now accepts strings as activity functions, when using object registration. Strings are presumed to be route prefixes, and may contain dynamic params (#497 from @Sauloxd)
  • The registerApplication API now accepts an array of activity functions, when using object registration. When multiple activity functions are provided, the application will be active when any of the activity functions returns a truthy value
// Parts of single-spa now work in NodeJS
const { registerApplication, checkActivityFunctions } = require('single-spa');

registerApplication('app1', () => System.import('thing'), location => location.pathname.startsWith('/app1'));
console.log(checkActivityFunctions({pathname: '/app1'})) // ['app1']
console.log(checkActivityFunctions({pathname: '/other'})) // []
// registerApplication can now be called with an object
registerApplication({
  name: 'app1',
  app: () => System.import('app1'),
  activeWhen: location => location.pathname.startsWith('/app1')
})

// A string passed to activeWhen is a prefix
registerApplication({
  name: 'app2',
  app: () => System.import('app2'),
  activeWhen: '/app1'
})

// You can specify route params in the strings
registerApplication({
  name: 'app3',
  app: () => System.import('app3'),
  activeWhen: '/users/:userId/'
})

// Multiple activity functions are now supported
registerApplication({
  name: 'app4',
  app: () => System.import('app4'),
  activeWhen: [
    '/app4',
    location => location.pathname.startsWith('/other'),
    '/users/:userId'
  ]
})

Maintenance

v5.2.1

20 Mar 14:45
Compare
Choose a tag to compare

Fixes

v5.2.0

19 Mar 20:51
Compare
Choose a tag to compare

Features

  • Added new urlRerouteOnly configuration option, passed to start() (#487). This is beneficial to performance (avoids unnecessary re-renders and single-spa code execution) and will not break things in most applications. It means that history.replaceState(newState, 'title') will no longer cause a popstate event (and re-render).

Documentation

singleSpa.start({
  urlRerouteOnly: true
})

v5.1.2

14 Mar 16:16
Compare
Choose a tag to compare

Fixes

  • Not throwing a second error when unmount fails after mount (#480)

Maintenance

  • Upgrade acorn to address security vulnerability (#479)

v5.1.1

09 Mar 18:56
Compare
Choose a tag to compare

Fixes

  • Error handlers are now called after application / parcel status is updated. The error message still has the status from before the error occurred in it. (#467)
  • Typescript definition for parcel object now includes update function (#468)

v5.1.0

02 Mar 17:11
Compare
Choose a tag to compare

Features

  • Begin mounting applications before others have been loaded (#457 #452 @StyleT)

Maintenance

  • Add test for parcels (#439)
  • Upgrading dev dependencies to resolve security warnings (#456)
  • Removing unused jasmine.json (#455)

v5.0.0

24 Feb 16:42
Compare
Choose a tag to compare

Motivation

Full blog post

single-spa@5 is focused on performance and developer experience. The bundle size for single-spa has gone down from ~25kb to ~15kb ungzipped (6kb to 5kb gzipped). We have created new error pages which give in-depth information about console errors, and link to those pages in both development and production builds. We now publish single-spa.dev.js files for easier debugging of single-spa itself. And we have removed all of our deprecated APIs (that have been deprecated and not documented for about two years).

Migration path

99% of single-spa users can simply upgrade to single-spa@5.0.0 without any changes to their code and everything will work exactly as it was before. You'll just benefit from a smaller bundle size and better DX for errors. See the breaking changes below for the few breaking changes that exist.

Breaking changes

  • Removing the declareChildApplication and unloadChildApplication apis that have been deprecated for two years. You can use the registerApplication and unloadApplication apis instead. (#390).
  • Removing err.name and err.appName from errors passed to single-spa error handlers (#404)

Features

  • Switching to "error codes" to communicate what went wrong with single-spa applications. The error codes link to pages such as https://single-spa.js.org/error/?code=1 which give in-depth explanations of what is happening.
  • Adding support for warningMillis timeout configuration. This lets you configure or turn off the "application's mount lifecycle did not resolve or reject in 1000 milliseconds" console warnings. (#389)

Fixes

  • Fixing link to the new error code documentation pages (#406)
  • Fixing error debugging info for parcel-related messages (#407)
  • Fix bug where route listeners that throw errors caused other route listeners not to be called (#449)

Performance

  • Reducing bundle size with babel/rollup changes (#392)
  • Reducing bundle size by removing class syntax (#393)
  • Reducing bundle size with various refactors (#396)
  • Reducing bundle size by switching from object spread syntax to a manual object assign (#401)

Maintenance

  • Adding prettier and speeding up pre-commit (#391)
  • Fixing build by upgrading NodeJS version in Travis (#394)
  • Updating rollup.config.js to easier way of doing multiple outputs (#403)

v4.4.3

21 Jan 20:57
Compare
Choose a tag to compare

Fixes

v5.0.0-beta.1

25 Dec 21:33
Compare
Choose a tag to compare

Patches

  • Add version number to a banner comment in output bundles. (#409)
  • Improving error messages for parcels (#410)
  • Add LOAD_ERROR to typescript definitions (#412)