Skip to main content

Version 5.0.0

ยท 4 min read
Richard Walker

The Podium team is pleased to annouce and make available the release of version 5.0.0 of Podium. ๐Ÿฅณ ๐ŸŽ‰

This is a breaking change from the v4.x line but since most of the changes are either under the hood or the removal of deprecations, upgrading, except in a couple notible exceptions, should be pretty simple for most users and may require no changes at all.

Breaking changesโ€‹

There are a couple breaking changes in this release that will need to be addressed if they affect you.

1. The Podium codebase has been converted to ESM and no longer supports common JS.โ€‹

While you can still mix and match podlets and layouts on Podium version 4 and 5, you will need to convert your codebase to ESM before upgrading to Podium version 5 podlets and layouts. See this post for a guide if you need one.

2. An instance of HttpIncoming must now be passed as the first argument to the Podium clientโ€‹

n.b. If you are currently not seeing any deprecation warnings in your Podium version 4 apps, this won't affect you.

The .fetch() and .stream() methods. Usage of the fetch/stream methods without passing in HttpIncoming was deprecated a long while ago.

In Podium version 4, the following was acceptable but will now throw with version 5.

const header = layout.client.register({...});

app.get("/", (req, res) => {
await header.fetch();
});

In Podium version 5, you need to ensure you pass in an HttpIncoming object like so:

const header = layout.client.register({...});

app.get("/", (req, res) => {
const incoming = res.locals.podium;
await header.fetch(incoming);
});

3. Removal of deprecated Podium v3 compatibility in the manifest file and codebase.โ€‹

n.b. If you are currently not seeing any deprecation warnings in your Podium version 4 apps, this won't affect you.

The assets key and its sub keys js and css have been removed from the manifest file.

Previously through all of Podium version 4, we maintained both the assets key and js and css keys for backwards compatibility with Podium version 3. The value for assets.js would always be the same as for js and the value for assets.css would always be the same as css.

Like so:

{
"assets": { "js": [], "css": [] },
"js": [],
"css": []
}

With Podium version 5, we've dropped the assets key (and therefore compatibility with Podium version 3) so that the manifest file will now look like:

{
"js": [],
"css": []
}

4. Support for Node v10 and lower has been intentionally dropped and we are now actively only testing against Node v16 and higher.โ€‹

Releases are now made against Node v20 and we actively run test suites against Node version 16 and up. Versions 12 and 14 should work but we make no guarantees.

5. .js and .css methods on the Podium layout and Podium podlet modules, which are used to set assets, no longer return a valueโ€‹

n.b. If you are currently not seeing any deprecation warnings in your Podium version 4 apps, this won't affect you.

The podlet and layout .js and .css methods used to return a value. This was deprecated a long ways back and has now been removed.

const result = layout.js()
// result is null
const result = podlet.js()
// result is null

6. Previously deprecated Podium client change and dispose events removed.โ€‹

These client registry events, emitted from the Podium client, were previously deprecated and have now been removed. You most likely aren't, but check your codebase to ensure you aren't relying on these events.

Other notable changesโ€‹

None of the following changes require any action when upgrading.

1. Under the hood, the Podium client request module has been replaced.โ€‹

The Request module is deprecated and we've opted to replace it with Undici, a fast modern alternative.

2. The podlet manifest file now supports an array of proxy endpoints instead of just an object.โ€‹

Previously, proxy entries in the podlet manifest were defined as an object and looked like this:

{
"proxy": {
"one": "/target/path/one",
"two": "/target/path/two",
}
}

This has been changed to support an array syntax in which multiple proxies definitions can be added

{
"proxy": [
{ "name": "one": "target": "/target/path/one" },
{ "name": "two": "target": "/target/path/two" },
]
}

The object syntax has been preserved for backwards compatibility.

3. Added prettier printing of Podium client responses when using console.logโ€‹

Log output used to look like:

PodiumClientResponse {
[Symbol(podium:client:response:redirect)]: '',
[Symbol(podium:client:response:content)]: '',
[Symbol(podium:client:response:headers)]: {},
[Symbol(podium:client:response:css)]: [],
[Symbol(podium:client:response:js)]: []
}

But now looks like:

{
redirect: '',
content: '',
headers: {},
css: [],
js: []
}